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/11 16:37:20 UTC
[1/9] ISIS-233: adding new test stubs (TODOs)
Updated Branches:
refs/heads/dan/ISIS-233-ro 8210a58d7 -> ca8a43ee1
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionTest_resp_headers.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionTest_resp_headers.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionTest_resp_headers.java
deleted file mode 100644
index df98730..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionTest_resp_headers.java
+++ /dev/null
@@ -1,82 +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.version;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasMaxAge;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasParameter;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasSubType;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.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 VersionTest_resp_headers {
-
- @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 contentType_and_cacheControl() 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));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionTest_resp_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionTest_resp_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionTest_resp_representation.java
deleted file mode 100644
index c44e65d..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionTest_resp_representation.java
+++ /dev/null
@@ -1,113 +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.version;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.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.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.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.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 VersionTest_resp_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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/any/security/AnyResourceTest_notAuthorized.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/any/security/AnyResourceTest_notAuthorized.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/any/security/AnyResourceTest_notAuthorized.java
deleted file mode 100644
index 6588346..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/any/security/AnyResourceTest_notAuthorized.java
+++ /dev/null
@@ -1,51 +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.zzztodo.any.security;
-
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-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 AnyResourceTest_notAuthorized {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
- private RestfulClient client;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
- }
-
- @Ignore("TODO")
- @Test
- public void whenAuthenticated() throws Exception {
-
- }
-
- @Ignore("TODO")
- @Test
- public void whenNotAuthenticated() throws Exception {
- // should return 401 (13.5)
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainobject/instanceid/DomainObjectTest_get_resp_header_cacheControl.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainobject/instanceid/DomainObjectTest_get_resp_header_cacheControl.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainobject/instanceid/DomainObjectTest_get_resp_header_cacheControl.java
deleted file mode 100644
index b5a879b..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainobject/instanceid/DomainObjectTest_get_resp_header_cacheControl.java
+++ /dev/null
@@ -1,61 +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.zzztodo.domainobject.instanceid;
-
-import org.apache.isis.core.webserver.WebServer;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-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 DomainObjectTest_get_resp_header_cacheControl {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- protected RestfulClient client;
-
- @Before
- public void setUp() throws Exception {
- final WebServer webServer = webServerRule.getWebServer();
- client = new RestfulClient(webServer.getBase());
- }
-
- @Ignore
- @Test
- public void noCaching() throws Exception {
-
- }
-
- @Ignore
- @Test
- public void shortTermCaching() throws Exception {
-
- }
-
- @Ignore
- @Test
- public void longTermCaching() throws Exception {
-
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainobject/instanceid/DomainObjectTest_get_resp_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainobject/instanceid/DomainObjectTest_get_resp_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainobject/instanceid/DomainObjectTest_get_resp_representation.java
deleted file mode 100644
index 75b1360..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainobject/instanceid/DomainObjectTest_get_resp_representation.java
+++ /dev/null
@@ -1,408 +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.zzztodo.domainobject.instanceid;
-
-import static org.apache.isis.core.commons.matchers.IsisMatchers.matches;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
-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 static org.junit.Assert.fail;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status.Family;
-
-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.tck.dom.refs.BidirWithSetChildEntity;
-import org.apache.isis.core.tck.dom.scalars.ApplibValuedEntity;
-import org.apache.isis.core.tck.dom.scalars.ApplibValuedEntityRepository;
-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.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.domainobjects.ActionResultRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectResource;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectPropertyRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ScalarValueRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ActionResultRepresentation.ResultType;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-
-public class DomainObjectTest_get_resp_representation {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- protected RestfulClient client;
-
- @Before
- public void setUp() throws Exception {
- final WebServer webServer = webServerRule.getWebServer();
- client = new RestfulClient(webServer.getBase());
- }
-
- @Ignore("to fix")
- @Test
- public void returnsDomainObjectRepresentation() throws Exception {
-
- // given
- final DomainObjectResource domainObjectResource = client.getDomainObjectResource();
-
- // when
- final Response domainObjectResp = domainObjectResource.object("OID","6");
- final RestfulResponse<DomainObjectRepresentation> domainObjectJsonResp = RestfulResponse.ofT(domainObjectResp);
- assertThat(domainObjectJsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));
-
- // then
- final DomainObjectRepresentation domainObjectRepr = domainObjectJsonResp.getEntity();
- assertThat(domainObjectRepr, is(not(nullValue())));
- }
-
- @Ignore("to fix")
- @Test
- public void domainObjectRepresentationForPersistentObject_hasSelfAndOid() throws Exception {
-
- // given, when
- final DomainObjectRepresentation domainObjectRepr = givenDomainObjectRepresentationFor("OID","32");
-
- // then
- final LinkRepresentation self = domainObjectRepr.getSelf();
- assertThat(self, isLink().rel(Rel.SELF).href(matches(".+objects/OID/32")).httpMethod(RestfulHttpMethod.GET).type(MediaType.APPLICATION_JSON_TYPE).typeParameter("profile", "urn:org.restfulobjects/domainobject"));
- assertThat(domainObjectRepr.getLinkWithRel(Rel.DESCRIBEDBY), isLink().href(matches(".+" + BidirWithSetChildEntity.class.getName())).httpMethod(RestfulHttpMethod.GET).type(MediaType.APPLICATION_JSON_TYPE).typeParameter("profile", "urn:org.restfulobjects/domaintype"));
-
- assertThat(domainObjectRepr.getTitle(), is("parent 4 - child 2"));
- assertThat(domainObjectRepr.getOid(), is("OID:32"));
-
- // no icon
- final LinkRepresentation selfIcon = domainObjectRepr.getLinkWithRel(Rel.ICON);
- assertThat(selfIcon, is(nullValue()));
- }
-
- @Ignore("to fix")
- @Test
- public void domainObjectRepresentationForTransient_hasNoSelf_andHasNoOid() throws Exception {
-
- // given, when
- final RestfulRequest request = this.client.createRequest(RestfulHttpMethod.POST, "services/simples/actions/newTransientEntity/invoke");
- final RestfulResponse<ActionResultRepresentation> response = request.executeT();
- final ActionResultRepresentation actionResultRepr = response.getEntity();
- assertThat(actionResultRepr.getResultType(), is(ResultType.DOMAIN_OBJECT));
- assertThat(actionResultRepr.getResult(), is(not(nullValue())));
-
- final DomainObjectRepresentation domainObjectRepr = actionResultRepr.getResult().as(DomainObjectRepresentation.class);
-
- // then
- final LinkRepresentation self = domainObjectRepr.getSelf();
- assertThat(self, is(nullValue()));
-
- assertThat(domainObjectRepr.getOid(), is(nullValue()));
- }
-
- @Ignore("to fix")
- @Test
- public void domainObjectRepresentation_hasTitle() throws Exception {
-
- // given, when
- final DomainObjectRepresentation domainObjectRepr = givenDomainObjectRepresentationFor("OID","32");
-
- // then
- assertThat(domainObjectRepr.getTitle(), is("parent 4 - child 2"));
- }
-
- @Ignore("to fix")
- @Test
- public void domainObjectRepresentation_hasDescribedByLink() throws Exception {
-
- // given, when
- final DomainObjectRepresentation domainObjectRepr = givenDomainObjectRepresentationFor("OID","32");
-
- // then
- assertThat(domainObjectRepr.getLinkWithRel(Rel.DESCRIBEDBY), isLink().href(matches(".+" + BidirWithSetChildEntity.class.getName())).httpMethod(RestfulHttpMethod.GET).type(MediaType.APPLICATION_JSON_TYPE).typeParameter("profile", "urn:org.restfulobjects/domaintype"));
- }
-
- @Ignore("to fix")
- @Test
- public void domainObjectRepresentation_noIcon() throws Exception {
-
- // given, when
- final DomainObjectRepresentation domainObjectRepr = givenDomainObjectRepresentationFor("OID","32");
-
- // then
- final LinkRepresentation selfIcon = domainObjectRepr.getLinkWithRel(Rel.ICON);
- assertThat(selfIcon, is(nullValue()));
- }
-
- @Ignore("TODO")
- @Test
- public void domainObjectWithIcon() throws Exception {
-
- // given, when
- final DomainObjectRepresentation domainObjectRepr = givenDomainObjectRepresentationFor("OID","xxx");
-
- // icon
- final LinkRepresentation selfIcon = domainObjectRepr.getLinkWithRel(Rel.ICON);
- assertThat(selfIcon, isLink().href(matches(".+" + "/images/" + "null\\.png")).httpMethod(RestfulHttpMethod.GET));
-
- }
-
- @Ignore("to fix")
- @Test
- public void domainObjectRepresentationContent_Properties() throws Exception {
-
- // given, when
- final DomainObjectRepresentation domainObjectRepr = givenDomainObjectRepresentationFor("OID","32");
- final LinkRepresentation self = domainObjectRepr.getSelf();
-
- // then properties
- final JsonRepresentation properties = domainObjectRepr.getProperties();
- assertThat(properties.size(), is(2));
-
- // property ('name')
- final JsonRepresentation nameProperty = properties.getRepresentation("[id=name]");
- assertThat(nameProperty.getString("memberType"), is("property"));
- assertThat(nameProperty.getString("value"), is("child 2"));
- assertThat(nameProperty.getString("disabledReason"), is(nullValue()));
-
- final LinkRepresentation namePropertyDetails = nameProperty.getLink("links[rel=details]");
- assertThat(namePropertyDetails, isLink().rel("details").href(self.getHref() + "/properties/name").httpMethod(RestfulHttpMethod.GET));
-
- }
-
- @Ignore("todo")
- @Test
- public void domainObjectRepresentationContent_Collections() throws Exception {
-
- // given, when
- final DomainObjectRepresentation domainObjectRepr = givenDomainObjectRepresentationFor("OID","32");
-
- // then collections
-
- }
-
- @Ignore("TODO")
- @Test
- public void domainObjectRepresentationContent() throws Exception {
-
- // given, when
- final DomainObjectRepresentation domainObjectRepr = givenDomainObjectRepresentationFor("OID","32");
- final LinkRepresentation self = domainObjectRepr.getSelf();
-
- // then actions
- final JsonRepresentation actions = domainObjectRepr.getActions();
- assertThat(actions.size(), is(2));
-
- final JsonRepresentation listAction = actions.getRepresentation("list");
- assertThat(listAction.getString("memberType"), is("action"));
- assertThat(listAction.getString("actionId"), is("list"));
- assertThat(listAction.getString("actionType"), is("USER"));
- assertThat(listAction.getInt("numParameters"), is(0));
-
- final LinkRepresentation listActionType = listAction.getLink("type");
- assertThat(listActionType.getRel(), is("type"));
- assertThat(listActionType.getHref(), matches(".+vnd\\.list\\+json"));
- assertThat(listActionType.getHttpMethod(), is(RestfulHttpMethod.GET));
-
- final LinkRepresentation listActionDetails = listAction.getLink("details");
- assertThat(listActionDetails.getRel(), is("action"));
- assertThat(listActionDetails.getHref(), is(self.getHref() + "/actions/list"));
- assertThat(listActionDetails.getHttpMethod(), is(RestfulHttpMethod.GET));
-
- final JsonRepresentation newEntityAction = actions.getRepresentation("newEntity");
- assertThat(newEntityAction.getString("memberType"), is("action"));
- assertThat(newEntityAction.getString("actionType"), is("USER"));
- assertThat(newEntityAction.getInt("numParameters"), is(0));
-
- final LinkRepresentation newEntityActionType = newEntityAction.getLink("type");
- assertThat(newEntityActionType.getRel(), is("type"));
- assertThat(newEntityActionType.getHref(), matches(".+vnd\\." + ApplibValuedEntity.class.getName() + "\\+json"));
- assertThat(newEntityActionType.getHttpMethod(), is(RestfulHttpMethod.GET));
-
- final LinkRepresentation newEntityActionDetails = newEntityAction.getLink("details");
- assertThat(newEntityActionDetails.getRel(), is("action"));
- assertThat(newEntityActionDetails.getHref(), is(self.getHref() + "/actions/newEntity"));
- assertThat(newEntityActionDetails.getHttpMethod(), is(RestfulHttpMethod.GET));
- }
-
- @Ignore("TODO")
- @Test
- public void domainObjectWithDisabledMembers() throws Exception {
-
- // given, when
- final DomainObjectRepresentation domainObjectRepr = givenDomainObjectRepresentationFor("OID","xxx");
-
- // property ('name')
- final JsonRepresentation properties = domainObjectRepr.getProperties();
- final JsonRepresentation nameProperty = properties.getRepresentation("name");
- assertThat(nameProperty.getString("disabledReason"), is(not(nullValue())));
- }
-
- @Ignore("to get working again")
- @Test
- public void propertyDetails() throws Exception {
- // given
- final DomainObjectResource domainObjectResource = client.getDomainObjectResource();
-
- // when
- final Response idPropertyResp = domainObjectResource.propertyDetails("OID","1", "id");
- final RestfulResponse<ObjectPropertyRepresentation> idPropertyJsonResp = RestfulResponse.ofT(idPropertyResp);
- assertThat(idPropertyJsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));
-
- // then
- final ObjectPropertyRepresentation propertyDetailsRepr = idPropertyJsonResp.getEntity();
-
- // _self.link
- final LinkRepresentation selfLink = propertyDetailsRepr.getLink("_self.link");
- assertThat(selfLink.getRel(), is("member"));
- assertThat(selfLink.getHref(), matches(".+objects/OID:1/properties/id"));
- assertThat(selfLink.getHttpMethod(), is(RestfulHttpMethod.GET));
-
- // _self.object
- final LinkRepresentation selfObject = propertyDetailsRepr.getLink("_self.object");
- assertThat(selfObject.getRel(), is("object"));
- assertThat(selfObject.getHref(), matches(".+objects/OID:1"));
- assertThat(selfObject.getHttpMethod(), is(RestfulHttpMethod.GET));
-
- // type
- final LinkRepresentation type = propertyDetailsRepr.getLink("type");
- assertThat(type.getRel(), is("type"));
- assertThat(type.getHref(), matches(".+vnd\\.string\\+json"));
- assertThat(type.getHttpMethod(), is(RestfulHttpMethod.GET));
-
- assertThat(propertyDetailsRepr.getString("memberType"), is("property"));
- assertThat(propertyDetailsRepr.getString("value"), is(ApplibValuedEntityRepository.class.getName()));
- assertThat(propertyDetailsRepr.getString("disabledReason"), is(not(nullValue())));
- }
-
- @Ignore("to get working again")
- @Test
- public void actionPrompt() throws Exception {
- // given
- final DomainObjectResource domainObjectResource = client.getDomainObjectResource();
-
- // when
- final Response actionPromptResp = domainObjectResource.actionPrompt("OID","1", "list");
- final RestfulResponse<ObjectActionRepresentation> actionPromptJsonResp = RestfulResponse.ofT(actionPromptResp);
- assertThat(actionPromptJsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));
-
- // then
- final ObjectActionRepresentation actionPromptRepr = actionPromptJsonResp.getEntity();
-
- // _self.link
- final LinkRepresentation selfLink = actionPromptRepr.getLink("_self.link");
- assertThat(selfLink.getRel(), is("member"));
- assertThat(selfLink.getHref(), matches(".+objects/OID:1/actions/list"));
- assertThat(selfLink.getHttpMethod(), is(RestfulHttpMethod.GET));
-
- // _self.object
- final LinkRepresentation selfObject = actionPromptRepr.getLink("_self.object");
- assertThat(selfObject.getRel(), is("object"));
- assertThat(selfObject.getHref(), matches(".+objects/OID:1"));
- assertThat(selfObject.getHttpMethod(), is(RestfulHttpMethod.GET));
-
- // type
- final LinkRepresentation type = actionPromptRepr.getLink("type");
- assertThat(type.getRel(), is("type"));
- assertThat(type.getHref(), matches(".+vnd\\.list\\+json"));
- assertThat(type.getHttpMethod(), is(RestfulHttpMethod.GET));
-
- assertThat(actionPromptRepr.getString("memberType"), is("action"));
- assertThat(actionPromptRepr.getString("actionType"), is("USER"));
- assertThat(actionPromptRepr.getInt("numParameters"), is(0));
- assertThat(actionPromptRepr.getArray("parameters").size(), is(0));
-
- final LinkRepresentation invokeLink = actionPromptRepr.getLink("invoke");
- assertThat(invokeLink.getRel(), is("invoke"));
- assertThat(invokeLink.getHref(), matches(".+objects/OID:1/actions/list/invoke"));
- assertThat(invokeLink.getHttpMethod(), is(RestfulHttpMethod.POST));
- assertThat(invokeLink.getArguments(), is(not(nullValue())));
- assertThat(invokeLink.getArguments().isArray(), is(true));
- assertThat(invokeLink.getArguments().size(), is(0));
- }
-
- @Ignore("TODO")
- @Test
- public void collectionDetails() throws Exception {
- fail();
- }
-
- @Ignore("to get working again")
- @Test
- public void actionPostInvoke_returningList() throws Exception {
-
- // given
- final DomainObjectResource domainObjectResource = client.getDomainObjectResource();
-
- final JsonRepresentation body = JsonRepresentation.newArray();
-
- // when
- final Response actionInvokeResp = domainObjectResource.invokeAction("OID","1", "list", body.asInputStream());
- final RestfulResponse<ScalarValueRepresentation> actionInvokeJsonResp = RestfulResponse.ofT(actionInvokeResp);
- assertThat(actionInvokeJsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));
-
- // then
- final ScalarValueRepresentation actionInvokeRepr = actionInvokeJsonResp.getEntity();
- assertThat(actionInvokeRepr.isArray(), is(true));
- assertThat(actionInvokeRepr.size(), is(5));
-
- final JsonRepresentation domainObjectRefRepr = actionInvokeRepr.arrayGet(0);
-
- assertThat(domainObjectRefRepr, is(not(nullValue())));
- assertThat(domainObjectRefRepr.getString("title"), is("Untitled Applib Values Entity")); // TODO
-
- final LinkRepresentation domainObjectLink = domainObjectRefRepr.getLink("link");
- assertThat(domainObjectLink.getRel(), is("object"));
- assertThat(domainObjectLink.getHref(), matches("http://localhost:\\d+/objects/OID:7"));
-
- final LinkRepresentation domainObjectTypeLink = domainObjectRefRepr.getLink("type");
- assertThat(domainObjectTypeLink.getRel(), is("type"));
- assertThat(domainObjectTypeLink.getHref(), matches("http://localhost:\\d+/types/application/vnd." + org.apache.isis.core.tck.dom.scalars.ApplibValuedEntity.class.getName() + "\\+json"));
-
- final LinkRepresentation domainObjectIconLink = domainObjectRefRepr.getLink("icon");
- assertThat(domainObjectIconLink.getRel(), is("icon"));
- assertThat(domainObjectIconLink.getHref(), matches("http://localhost:\\d+/images/null.png")); // TODO
- }
-
- private DomainObjectRepresentation givenDomainObjectRepresentationFor(final String domainType, String instanceId) throws JsonParseException, JsonMappingException, IOException {
- final DomainObjectResource domainObjectResource = client.getDomainObjectResource();
-
- final Response domainObjectResp = domainObjectResource.object(domainType, instanceId);
- final RestfulResponse<DomainObjectRepresentation> domainObjectJsonResp = RestfulResponse.ofT(domainObjectResp);
- assertThat(domainObjectJsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));
-
- final DomainObjectRepresentation domainObjectRepr = domainObjectJsonResp.getEntity();
- return domainObjectRepr;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_invoke_TOREFACTOR.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_invoke_TOREFACTOR.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_invoke_TOREFACTOR.java
deleted file mode 100644
index ded6ed4..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_invoke_TOREFACTOR.java
+++ /dev/null
@@ -1,246 +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.zzztodo.domainservice.actioninvoke;
-
-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.LinkRepresentation;
-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.applib.domainobjects.ObjectActionRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ScalarValueRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-
-public class DomainServiceTest_invoke_TOREFACTOR {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- @SuppressWarnings("unused")
- private DomainServiceResource resource;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
-
- resource = client.getDomainServiceResource();
- }
-
-
- @Ignore("TODO - fix broken test resulting from introduction of actionresult repr")
- @Test
- public void invokeIdempotent_withArgs_usingClientFollow() throws Exception {
-
- // given action
- final JsonRepresentation givenAction = givenAction("simples", "newPersistentEntity");
- final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
-
- // when
- final LinkRepresentation invokeLink = actionRepr.getInvoke();
-
- // then
- assertThat(invokeLink, is(not(nullValue())));
-
- final JsonRepresentation args = invokeLink.getArguments();
- assertThat(args.size(), is(2));
- assertThat(args.mapHas("name"), is(true));
- assertThat(args.mapHas("flag"), is(true));
-
- // when
- args.mapPut("name", "New Name");
- args.mapPut("flag", true);
- final RestfulResponse<DomainObjectRepresentation> restfulResponse = client.followT(invokeLink, args);
-
- // then
- final DomainObjectRepresentation objectRepr = restfulResponse.getEntity();
-
- assertThat(objectRepr.getProperty("name").getString("value"), is("New Name"));
- assertThat(objectRepr.getProperty("flag").getBoolean("value"), is(true));
- }
-
- @Ignore("TODO - fix broken test resulting from introduction of actionresult repr")
- @Test
- public void invoke_returningScalar_withReferenceArgs_usingClientFollow() throws Exception {
-
- // given action
- final JsonRepresentation givenAction = givenAction("simples", "count");
- final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
-
- // when
- final LinkRepresentation invokeLink = actionRepr.getInvoke();
-
- // then
- assertThat(invokeLink, is(not(nullValue())));
- final JsonRepresentation args = invokeLink.getArguments();
- assertThat(args.size(), is(0));
-
- // when
- final RestfulResponse<ScalarValueRepresentation> restfulResponse = client.followT(invokeLink, args);
-
- // then
- final ScalarValueRepresentation objectRepr = restfulResponse.getEntity();
-
- assertThat(objectRepr.getValue().asInt(), is(6));
- }
-
- @Ignore("TODO - fix broken test resulting from introduction of actionresult repr")
- @Test
- public void invokeNonIdempotent_returningVoid_withReferenceArgs_usingClientFollow() throws Exception {
-
- // given simple entity with 'flag' property set to true
- final LinkRepresentation linkToSimpleEntity = givenLinkToSimpleEntity(0);
- final RestfulResponse<DomainObjectRepresentation> restfulResponseBefore = client.followT(linkToSimpleEntity);
- final DomainObjectRepresentation simpleEntityBefore = restfulResponseBefore.getEntity();
- final Boolean before = simpleEntityBefore.getProperty("flag").getBoolean("value");
-
- // and given 'toggle' action on repo
- final JsonRepresentation givenAction = givenAction("simples", "toggle");
- final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
-
- // when
- final LinkRepresentation invokeLink = actionRepr.getInvoke();
-
- // then
- assertThat(invokeLink, is(not(nullValue())));
-
- final JsonRepresentation args = invokeLink.getArguments();
- assertThat(args.size(), is(1));
- assertThat(args.mapHas("object"), is(true));
-
- // when
- args.mapPut("object", linkToSimpleEntity);
- final RestfulResponse<JsonRepresentation> restfulResponse = client.followT(invokeLink, args);
-
- // then
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.NO_CONTENT));
-
- // and then simple entity 'flag' property set to false
- final RestfulResponse<DomainObjectRepresentation> restfulResponseAfter = client.followT(linkToSimpleEntity);
- final DomainObjectRepresentation simpleEntityAfter = restfulResponseAfter.getEntity();
-
- final Boolean after = simpleEntityAfter.getProperty("flag").getBoolean("value");
- assertThat(after, is(!before)); // ie has been toggled
- }
-
- @org.junit.Ignore("up to here")
- @Test
- public void invoke_withAllBuiltInArgs_usingClientFollow() throws Exception {
-
- // given simple entity with 'flag' property set to true
- final LinkRepresentation linkToSimpleEntity = givenLinkToSimpleEntity(0);
-
- // given
- final JsonRepresentation givenAction = givenAction("simples", "update");
- final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
-
- // when
- final LinkRepresentation invokeLink = actionRepr.getInvoke();
-
- // then
- assertThat(invokeLink, is(not(nullValue())));
-
- final JsonRepresentation args = invokeLink.getArguments();
- assertThat(args.size(), is(0));
- assertThat(args.mapHas("object"), is(true));
- assertThat(args.mapHas("name"), is(true));
- assertThat(args.mapHas("flag"), is(true));
- assertThat(args.mapHas("Boolean"), is(true));
- assertThat(args.mapHas("int"), is(true));
- assertThat(args.mapHas("integer"), is(true));
- assertThat(args.mapHas("long1"), is(true));
- assertThat(args.mapHas("long2"), is(true));
- assertThat(args.mapHas("double1"), is(true));
- assertThat(args.mapHas("double2"), is(true));
- assertThat(args.mapHas("bigInteger"), is(true));
- assertThat(args.mapHas("bigDecimal"), is(true));
-
- // when
- args.mapPut("name", "New Name");
- args.mapPut("flag", true);
- final RestfulResponse<DomainObjectRepresentation> restfulResponse = client.followT(invokeLink, args);
-
- // then
- final DomainObjectRepresentation objectRepr = restfulResponse.getEntity();
-
- assertThat(objectRepr.getRepresentation("members[propertyId=%s].value", "name").asString(), is("New Name"));
- assertThat(objectRepr.getRepresentation("members[propertyId=%s].value", "flag").asBoolean(), is(true));
- }
-
- private JsonRepresentation givenAction(final String serviceId, final String actionId) throws JsonParseException, JsonMappingException, IOException {
- final String href = givenHrefToService(serviceId);
-
- final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, href).withArg(RequestParameter.FOLLOW_LINKS, "members[id=%s].links[rel=details]", actionId);
- final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- final DomainObjectRepresentation repr = restfulResponse.getEntity();
-
- final JsonRepresentation actionLinkRepr = repr.getAction(actionId);
- return actionLinkRepr.getRepresentation("links[rel=details].value");
- }
-
- 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();
- }
-
- private LinkRepresentation givenLinkToSimpleEntity(final int num) throws JsonParseException, JsonMappingException, IOException, Exception {
- // given
- final JsonRepresentation givenAction = givenAction("simples", "list");
- final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
-
- // when
- final LinkRepresentation invokeLink = actionRepr.getInvoke();
-
- // then
- final RestfulResponse<ListRepresentation> restfulResponse = client.followT(invokeLink);
- final ListRepresentation listRepr = restfulResponse.getEntity();
-
- return listRepr.getValue().arrayGet(num).asLink();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_req_queryarg_xrovalidateonly.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_req_queryarg_xrovalidateonly.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_req_queryarg_xrovalidateonly.java
deleted file mode 100644
index 5a2b8d1..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_req_queryarg_xrovalidateonly.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.zzztodo.domainservice.actioninvoke;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class DomainServiceTest_req_queryarg_xrovalidateonly {
-
- @Ignore
- @Test
- public void success() throws Exception {
- // should return 204 (13.3)
- }
-
- @Ignore
- @Test
- public void failure() throws Exception {
- // should return 422, etc
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_resp_representation_of_List.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_resp_representation_of_List.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_resp_representation_of_List.java
deleted file mode 100644
index a7c1d82..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_resp_representation_of_List.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.zzztodo.domainservice.actioninvoke;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class DomainServiceTest_resp_representation_of_List {
-
- @Ignore
- @Test
- public void todo() throws Exception {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_resp_representation_of_Object.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_resp_representation_of_Object.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_resp_representation_of_Object.java
deleted file mode 100644
index 9827629..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_resp_representation_of_Object.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.zzztodo.domainservice.actioninvoke;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class DomainServiceTest_resp_representation_of_Object {
-
- @Ignore
- @Test
- public void todo() throws Exception {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_resp_representation_of_Scalar.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_resp_representation_of_Scalar.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_resp_representation_of_Scalar.java
deleted file mode 100644
index b0586db..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_resp_representation_of_Scalar.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.zzztodo.domainservice.actioninvoke;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class DomainServiceTest_resp_representation_of_Scalar {
-
- @Ignore
- @Test
- public void todo() throws Exception {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_resp_representation_of_Void.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_resp_representation_of_Void.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_resp_representation_of_Void.java
deleted file mode 100644
index 304a536..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_resp_representation_of_Void.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.zzztodo.domainservice.actioninvoke;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class DomainServiceTest_resp_representation_of_Void {
-
- @Ignore
- @Test
- public void todo() throws Exception {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_resp_throwsError.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_resp_throwsError.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_resp_throwsError.java
deleted file mode 100644
index a77b9f6..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_resp_throwsError.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.zzztodo.domainservice.actioninvoke;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class DomainServiceTest_resp_throwsError {
-
- @Ignore
- @Test
- public void todo() throws Exception {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_when_created_new_object.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_when_created_new_object.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_when_created_new_object.java
deleted file mode 100644
index efe7665..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_when_created_new_object.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.zzztodo.domainservice.actioninvoke;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class DomainServiceTest_when_created_new_object {
-
- @Ignore
- @Test
- public void todo() throws Exception {
- // should return 201 (13.2)
- // if a newly created object
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_when_is_forbidden.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_when_is_forbidden.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_when_is_forbidden.java
deleted file mode 100644
index 53bdb35..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_when_is_forbidden.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.zzztodo.domainservice.actioninvoke;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class DomainServiceTest_when_is_forbidden {
-
- @Ignore
- @Test
- public void todo() throws Exception {
- // should return 403 (13.6)
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/objectsoftype/ObjectsOfTypeResourceTest_domainTypeId_post.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/objectsoftype/ObjectsOfTypeResourceTest_domainTypeId_post.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/objectsoftype/ObjectsOfTypeResourceTest_domainTypeId_post.java
deleted file mode 100644
index 7ceecd3..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/objectsoftype/ObjectsOfTypeResourceTest_domainTypeId_post.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.zzztodo.objectsoftype;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class ObjectsOfTypeResourceTest_domainTypeId_post {
-
- @Ignore
- @Test
- public void todo() throws Exception {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/stories/UserStoryTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/stories/UserStoryTest.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/stories/UserStoryTest.java
deleted file mode 100644
index 5d9892c..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/stories/UserStoryTest.java
+++ /dev/null
@@ -1,86 +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.zzztodo.stories;
-
-import static org.apache.isis.core.commons.matchers.IsisMatchers.matches;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.Response;
-
-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.client.RepresentationWalker;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageResource;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-
-public class UserStoryTest {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- protected RestfulClient client;
-
- @Before
- public void setUp() throws Exception {
- final WebServer webServer = webServerRule.getWebServer();
- client = new RestfulClient(webServer.getBase());
- }
-
- @Ignore("to get working again")
- @Test
- public void walkResources() throws Exception {
-
- // given a response for an initial resource
- final HomePageResource homePageResource = client.getHomePageResource();
- final Response homePageResp = homePageResource.homePage();
-
- // and given a walker starting from this response
- final RepresentationWalker walker = client.createWalker(homePageResp);
-
- // when walk the home pages' 'services' link
- walker.walk("services");
-
- // and when locate the ApplibValues repo and walk the its 'object' link
- walker.walk("values[title=ApplibValues].links[rel=object]");
-
- // and when locate the AppLibValues repo's "newEntity" action and walk
- // to its details
- walker.walk("values[memberType=action].details");
-
- // and when find the invoke body for the "newEntity" action and then
- // walk the action using the body
- final JsonRepresentation newEntityActionDetails = walker.getEntity();
- final JsonRepresentation newEntityActionInvokeBody = newEntityActionDetails.getArray("invoke.body");
- walker.walk("invoke", newEntityActionInvokeBody);
-
- // and when walk the link to the returned object
- walker.walk("link");
-
- // then the returned object is created with its OID
- final JsonRepresentation newEntityDomainObject = walker.getEntity();
- assertThat(newEntityDomainObject.getString("_self.link.href"), matches(".+/objects/OID:[\\d]+$"));
- }
-
-}
[6/9] ISIS-233: adding new test stubs (TODOs)
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenValidationRuleForSingleArg_whenArgFails_bad.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenValidationRuleForSingleArg_whenArgFails_bad.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenValidationRuleForSingleArg_whenArgFails_bad.java
new file mode 100644
index 0000000..a7d9f49
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenValidationRuleForSingleArg_whenArgFails_bad.java
@@ -0,0 +1,134 @@
+/*
+ * 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.domainobjectorservice.id.action.invoke;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasStatus;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+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.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulMediaType;
+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.ActionResultRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ActionResultRepresentation.ResultType;
+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.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.hamcrest.Matchers;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class Get_givenValidationRuleForSingleArg_whenArgFails_bad {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ private DomainServiceResource serviceResource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+
+ serviceResource = client.getDomainServiceResource();
+ }
+
+ @Test
+ public void usingClientFollow() throws Exception {
+
+ // given
+ final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subList");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+
+ assertThat(invokeLink, isLink(client)
+ .rel(Rel.INVOKE)
+ .httpMethod(RestfulHttpMethod.GET)
+ .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subList/invoke"))
+ .build());
+
+ JsonRepresentation args =invokeLink.getArguments();
+ assertThat(args.size(), is(2));
+ assertThat(args, RestfulMatchers.mapHas("from"));
+ assertThat(args, RestfulMatchers.mapHas("to"));
+
+ // when
+ args.mapPut("from.value", -1);
+ args.mapPut("to.value", 2);
+
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ // then
+ thenResponseIsAValidationError(restfulResponse);
+ }
+
+
+ @Test
+ public void usingResourceProxy() throws Exception {
+
+ // given, when
+ JsonRepresentation args = JsonRepresentation.newMap();
+ args.mapPut("from.value", -1);
+ args.mapPut("to.value", 2);
+ Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "subList", UrlEncodingUtils.urlEncode(args));
+ RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ // then
+ thenResponseIsAValidationError(restfulResponse);
+ }
+
+ private static void thenResponseIsAValidationError(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
+ assertThat(restfulResponse, hasStatus(HttpStatusCode.VALIDATION_FAILED));
+
+ assertThat(restfulResponse.getHeader(Header.WARNING), containsString("Validation failed, see body for details"));
+
+ // hmmm... what is the media type, though? the spec doesn't say. testing for a generic one.
+ assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(MediaType.APPLICATION_JSON));
+
+ RestfulResponse<JsonRepresentation> restfulResponseOfError = restfulResponse.wraps(JsonRepresentation.class);
+ JsonRepresentation repr = restfulResponseOfError.getEntity();
+
+ assertThat(repr.getString("from.invalidReason"), is("Cannot be less than zero"));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_thenResponseCode_200_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_thenResponseCode_200_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_thenResponseCode_200_ok_TODO.java
new file mode 100644
index 0000000..b42bef2
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_thenResponseCode_200_ok_TODO.java
@@ -0,0 +1,14 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class Get_thenResponseCode_200_ok_TODO {
+
+ @Ignore
+ @Test
+ public void todo() throws Exception {
+ // should return 201 (13.2)
+ // if a newly created object
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_thenResponseHeaders_CacheControl_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_thenResponseHeaders_CacheControl_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_thenResponseHeaders_CacheControl_ok_TODO.java
new file mode 100644
index 0000000..38b3aa3
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_thenResponseHeaders_CacheControl_ok_TODO.java
@@ -0,0 +1,61 @@
+/*
+ * 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.domainobjectorservice.id.action.invoke;
+
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+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 Get_thenResponseHeaders_CacheControl_ok_TODO {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ }
+
+ @Ignore
+ @Test
+ public void noCaching() throws Exception {
+
+ }
+
+ @Ignore
+ @Test
+ public void shortTermCaching() throws Exception {
+
+ }
+
+ @Ignore
+ @Test
+ public void longTermCaching() throws Exception {
+
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenCreatedNewObject_thenResponseCode_201_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenCreatedNewObject_thenResponseCode_201_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenCreatedNewObject_thenResponseCode_201_ok_TODO.java
new file mode 100644
index 0000000..9245a59
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenCreatedNewObject_thenResponseCode_201_ok_TODO.java
@@ -0,0 +1,14 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class Get_whenCreatedNewObject_thenResponseCode_201_ok_TODO {
+
+ @Ignore
+ @Test
+ public void todo() throws Exception {
+ // should return 201 (13.2)
+ // if a newly created object
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenErrorThrown_thenRepresentation_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenErrorThrown_thenRepresentation_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenErrorThrown_thenRepresentation_ok_TODO.java
new file mode 100644
index 0000000..baedd69
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenErrorThrown_thenRepresentation_ok_TODO.java
@@ -0,0 +1,13 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class Get_whenErrorThrown_thenRepresentation_ok_TODO {
+
+ @Ignore
+ @Test
+ public void todo() throws Exception {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenRepresentation_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenRepresentation_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenRepresentation_ok.java
new file mode 100644
index 0000000..0a7a054
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenRepresentation_ok.java
@@ -0,0 +1,112 @@
+/*
+ * 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.domainobjectorservice.id.action.invoke;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.Response;
+
+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.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulMediaType;
+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.domainobjects.ActionResultRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ActionResultRepresentation.ResultType;
+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.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.hamcrest.Matchers;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class Get_whenList_thenRepresentation_ok {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ private DomainServiceResource serviceResource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+
+ serviceResource = client.getDomainServiceResource();
+ }
+
+ @Test
+ public void usingClientFollow() throws Exception {
+
+ // given
+ final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "list");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+
+ assertThat(invokeLink, isLink(client)
+ .rel(Rel.INVOKE)
+ .httpMethod(RestfulHttpMethod.GET)
+ .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/list/invoke"))
+ .arguments(JsonRepresentation.newMap())
+ .build());
+
+ // when
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink);
+
+ // then
+ then(restfulResponse);
+ }
+
+ private static void then(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
+
+ assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(RestfulMediaType.APPLICATION_JSON_ACTION_RESULT));
+ final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
+
+ assertThat(actionResultRepr.getResultType(), is(ResultType.LIST));
+ final ListRepresentation listRepr = actionResultRepr.getResult().as(ListRepresentation.class);
+ assertThat(listRepr.getValue().size(), is(5));
+ }
+
+
+ @Test
+ public void usingResourceProxy() throws Exception {
+
+ // given, when
+ Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "list", null);
+ RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ then(restfulResponse);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_thenRepresentation_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_thenRepresentation_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_thenRepresentation_ok_TODO.java
new file mode 100644
index 0000000..c86172c
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_thenRepresentation_ok_TODO.java
@@ -0,0 +1,13 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class Get_whenObject_thenRepresentation_ok_TODO {
+
+ @Ignore
+ @Test
+ public void todo() throws Exception {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenScalar_thenRepresentation_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenScalar_thenRepresentation_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenScalar_thenRepresentation_ok_TODO.java
new file mode 100644
index 0000000..b5703a1
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenScalar_thenRepresentation_ok_TODO.java
@@ -0,0 +1,13 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class Get_whenScalar_thenRepresentation_ok_TODO {
+
+ @Ignore
+ @Test
+ public void todo() throws Exception {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenVoid_thenRepresentation_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenVoid_thenRepresentation_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenVoid_thenRepresentation_ok_TODO.java
new file mode 100644
index 0000000..7207f1f
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenVoid_thenRepresentation_ok_TODO.java
@@ -0,0 +1,13 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class Get_whenVoid_thenRepresentation_ok_TODO {
+
+ @Ignore
+ @Test
+ public void todo() throws Exception {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Post_givenActionSemanticsOfIdempotent_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Post_givenActionSemanticsOfIdempotent_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Post_givenActionSemanticsOfIdempotent_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..94d5a09
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Post_givenActionSemanticsOfIdempotent_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,112 @@
+/*
+ * 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.domainobjectorservice.id.action.invoke;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasStatus;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.hamcrest.Matchers;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+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.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.domainobjects.ActionResultRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+
+public class Post_givenActionSemanticsOfIdempotent_thenResponseCode_205_bad_TODO {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ private DomainServiceResource serviceResource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+
+ serviceResource = client.getDomainServiceResource();
+ }
+
+ @Ignore("to write - copied from req_safe")
+ @Test
+ public void usingClientFollow() throws Exception {
+
+ // given, when
+ final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subListWithOptionalRange");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+
+ assertThat(invokeLink, isLink(client)
+ .rel(Rel.INVOKE)
+ .httpMethod(RestfulHttpMethod.GET)
+ .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subListWithOptionalRange/invoke"))
+ .build());
+
+ invokeLink.withMethod(RestfulHttpMethod.POST);
+
+ // when
+ JsonRepresentation args = JsonRepresentation.newMap();
+ args = JsonRepresentation.newMap();
+ args.mapPut("id.value", 123);
+
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ // then
+ thenResponseIsErrorWithInvalidReason(restfulResponse);
+ }
+
+
+ // not possible to test using resourceProxy
+
+
+ private static void thenResponseIsErrorWithInvalidReason(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
+ assertThat(restfulResponse, hasStatus(HttpStatusCode.METHOD_NOT_ALLOWED));
+ assertThat(restfulResponse.getHeader(Header.WARNING), is("object is immutable")); // not a good message, but as per spec
+
+ // hmmm... what is the media type, though? the spec doesn't say. testing for a generic one.
+ assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(MediaType.APPLICATION_JSON));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Post_givenActionSemanticsOfSafe_thenResponseCode_205_bad_TOFIX.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Post_givenActionSemanticsOfSafe_thenResponseCode_205_bad_TOFIX.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Post_givenActionSemanticsOfSafe_thenResponseCode_205_bad_TOFIX.java
new file mode 100644
index 0000000..36e5491
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Post_givenActionSemanticsOfSafe_thenResponseCode_205_bad_TOFIX.java
@@ -0,0 +1,112 @@
+/*
+ * 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.domainobjectorservice.id.action.invoke;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasStatus;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.hamcrest.Matchers;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+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.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.domainobjects.ActionResultRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+
+public class Post_givenActionSemanticsOfSafe_thenResponseCode_205_bad_TOFIX {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ private DomainServiceResource serviceResource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+
+ serviceResource = client.getDomainServiceResource();
+ }
+
+ @Ignore("currently failing")
+ @Test
+ public void usingClientFollow() throws Exception {
+
+ // given, when
+ final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subListWithOptionalRange");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+
+ assertThat(invokeLink, isLink(client)
+ .rel(Rel.INVOKE)
+ .httpMethod(RestfulHttpMethod.GET)
+ .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subListWithOptionalRange/invoke"))
+ .build());
+
+ invokeLink.withMethod(RestfulHttpMethod.POST);
+
+ // when
+ JsonRepresentation args = JsonRepresentation.newMap();
+ args = JsonRepresentation.newMap();
+ args.mapPut("id.value", 123);
+
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ // then
+ thenResponseIsErrorWithInvalidReason(restfulResponse);
+ }
+
+
+ // not possible to test using resourceProxy
+
+
+ private static void thenResponseIsErrorWithInvalidReason(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
+ assertThat(restfulResponse, hasStatus(HttpStatusCode.METHOD_NOT_ALLOWED));
+ assertThat(restfulResponse.getHeader(Header.WARNING), is("object is immutable")); // not a good message, but as per spec
+
+ // hmmm... what is the media type, though? the spec doesn't say. testing for a generic one.
+ assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(MediaType.APPLICATION_JSON));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Put_givenActionSemanticsOfNotIdempotent_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Put_givenActionSemanticsOfNotIdempotent_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Put_givenActionSemanticsOfNotIdempotent_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..fd57a21
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Put_givenActionSemanticsOfNotIdempotent_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,112 @@
+/*
+ * 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.domainobjectorservice.id.action.invoke;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasStatus;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.hamcrest.Matchers;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+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.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.domainobjects.ActionResultRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+
+public class Put_givenActionSemanticsOfNotIdempotent_thenResponseCode_205_bad_TODO {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ private DomainServiceResource serviceResource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+
+ serviceResource = client.getDomainServiceResource();
+ }
+
+ @Ignore("to write - copied from req_safe")
+ @Test
+ public void usingClientFollow() throws Exception {
+
+ // given, when
+ final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subListWithOptionalRange");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+
+ assertThat(invokeLink, isLink(client)
+ .rel(Rel.INVOKE)
+ .httpMethod(RestfulHttpMethod.GET)
+ .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subListWithOptionalRange/invoke"))
+ .build());
+
+ invokeLink.withMethod(RestfulHttpMethod.POST);
+
+ // when
+ JsonRepresentation args = JsonRepresentation.newMap();
+ args = JsonRepresentation.newMap();
+ args.mapPut("id.value", 123);
+
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ // then
+ thenResponseIsErrorWithInvalidReason(restfulResponse);
+ }
+
+
+ // not possible to test using resourceProxy
+
+
+ private static void thenResponseIsErrorWithInvalidReason(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
+ assertThat(restfulResponse, hasStatus(HttpStatusCode.METHOD_NOT_ALLOWED));
+ assertThat(restfulResponse.getHeader(Header.WARNING), is("object is immutable")); // not a good message, but as per spec
+
+ // hmmm... what is the media type, though? the spec doesn't say. testing for a generic one.
+ assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(MediaType.APPLICATION_JSON));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Put_givenActionSemanticsOfSafe_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Put_givenActionSemanticsOfSafe_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Put_givenActionSemanticsOfSafe_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..8d33e6b
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Put_givenActionSemanticsOfSafe_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,112 @@
+/*
+ * 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.domainobjectorservice.id.action.invoke;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasStatus;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.hamcrest.Matchers;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+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.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.domainobjects.ActionResultRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+
+public class Put_givenActionSemanticsOfSafe_thenResponseCode_205_bad_TODO {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ private DomainServiceResource serviceResource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+
+ serviceResource = client.getDomainServiceResource();
+ }
+
+ @Ignore("to write - copied from req_safe")
+ @Test
+ public void usingClientFollow() throws Exception {
+
+ // given, when
+ final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subListWithOptionalRange");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+
+ assertThat(invokeLink, isLink(client)
+ .rel(Rel.INVOKE)
+ .httpMethod(RestfulHttpMethod.GET)
+ .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subListWithOptionalRange/invoke"))
+ .build());
+
+ invokeLink.withMethod(RestfulHttpMethod.POST);
+
+ // when
+ JsonRepresentation args = JsonRepresentation.newMap();
+ args = JsonRepresentation.newMap();
+ args.mapPut("id.value", 123);
+
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ // then
+ thenResponseIsErrorWithInvalidReason(restfulResponse);
+ }
+
+
+ // not possible to test using resourceProxy
+
+
+ private static void thenResponseIsErrorWithInvalidReason(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
+ assertThat(restfulResponse, hasStatus(HttpStatusCode.METHOD_NOT_ALLOWED));
+ assertThat(restfulResponse.getHeader(Header.WARNING), is("object is immutable")); // not a good message, but as per spec
+
+ // hmmm... what is the media type, though? the spec doesn't say. testing for a generic one.
+ assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(MediaType.APPLICATION_JSON));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/DomainServiceTest_req_header_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/DomainServiceTest_req_header_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/DomainServiceTest_req_header_accept.java
deleted file mode 100644
index 93b694e..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/DomainServiceTest_req_header_accept.java
+++ /dev/null
@@ -1,105 +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.domainservice.root;
-
-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 DomainServiceTest_req_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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/DomainServiceTest_req_queryarg_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/DomainServiceTest_req_queryarg_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/DomainServiceTest_req_queryarg_xrofollowlinks.java
deleted file mode 100644
index 8568b23..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/DomainServiceTest_req_queryarg_xrofollowlinks.java
+++ /dev/null
@@ -1,152 +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.domainservice.root;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.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 DomainServiceTest_req_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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/DomainServiceTest_resp_headers.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/DomainServiceTest_resp_headers.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/DomainServiceTest_resp_headers.java
deleted file mode 100644
index 4ea2892..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/DomainServiceTest_resp_headers.java
+++ /dev/null
@@ -1,82 +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.domainservice.root;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasMaxAge;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasParameter;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasSubType;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.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 DomainServiceTest_resp_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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/DomainServiceTest_resp_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/DomainServiceTest_resp_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/DomainServiceTest_resp_representation.java
deleted file mode 100644
index 9fec3c4..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/DomainServiceTest_resp_representation.java
+++ /dev/null
@@ -1,128 +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.domainservice.root;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.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 DomainServiceTest_resp_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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_thenRepresentation_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_thenRepresentation_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_thenRepresentation_ok.java
new file mode 100644
index 0000000..02cefba
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_thenRepresentation_ok.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.root;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isArray;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.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 Get_thenRepresentation_ok {
+
+ @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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_thenResponseHeaders_CacheControl_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_thenResponseHeaders_CacheControl_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_thenResponseHeaders_CacheControl_ok.java
new file mode 100644
index 0000000..041f2b4
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_thenResponseHeaders_CacheControl_ok.java
@@ -0,0 +1,68 @@
+/*
+ * 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.root;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasMaxAge;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.CacheControl;
+import javax.ws.rs.core.Response;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+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.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+public class Get_thenResponseHeaders_CacheControl_ok {
+
+ @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 ok() throws Exception {
+ // given
+ final Response resp = resource.services();
+
+ // when
+ final RestfulResponse<ListRepresentation> restfulResponse = RestfulResponse.ofT(resp);
+
+ // 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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_thenResponseHeaders_ContentType_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_thenResponseHeaders_ContentType_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_thenResponseHeaders_ContentType_ok.java
new file mode 100644
index 0000000..c89c3a2
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_thenResponseHeaders_ContentType_ok.java
@@ -0,0 +1,73 @@
+/*
+ * 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.root;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasParameter;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasSubType;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasType;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+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.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+public class Get_thenResponseHeaders_ContentType_ok {
+
+ @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()));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_whenCallWithWrongHttpMethod_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_whenCallWithWrongHttpMethod_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_whenCallWithWrongHttpMethod_bad_TODO.java
new file mode 100644
index 0000000..27972c8
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_whenCallWithWrongHttpMethod_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainservice.root;
+
+public class Get_whenCallWithWrongHttpMethod_bad_TODO {
+
+}
[7/9] ISIS-233: adding new test stubs (TODOs)
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenOptionalArg_whenNoArgProvided_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenOptionalArg_whenNoArgProvided_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenOptionalArg_whenNoArgProvided_ok.java
new file mode 100644
index 0000000..6e737b5
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenOptionalArg_whenNoArgProvided_ok.java
@@ -0,0 +1,164 @@
+/*
+ * 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.domainobjectorservice.id.action.invoke;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.Response;
+
+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.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulMediaType;
+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.domainobjects.ActionResultRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ActionResultRepresentation.ResultType;
+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.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.hamcrest.Matchers;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class Get_givenOptionalArg_whenNoArgProvided_ok {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ private DomainServiceResource serviceResource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+
+ serviceResource = client.getDomainServiceResource();
+ }
+
+ @Test
+ public void usingClientFollow_whenExplicitlySetToNull() throws Exception {
+
+ // given
+ final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subListWithOptionalRange");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+
+ assertThat(invokeLink, isLink(client)
+ .rel(Rel.INVOKE)
+ .httpMethod(RestfulHttpMethod.GET)
+ .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subListWithOptionalRange/invoke"))
+ .build());
+
+ JsonRepresentation args =invokeLink.getArguments();
+ assertThat(args.size(), is(2));
+ assertThat(args, RestfulMatchers.mapHas("from"));
+ assertThat(args, RestfulMatchers.mapHas("to"));
+
+ // when
+ args.mapPut("from.value", (Integer)null);
+ args.mapPut("to.value", (Integer)null);
+
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ then(restfulResponse);
+ }
+
+
+ @Test
+ public void usingResourceProxy_whenExplicitlySetToNull() throws Exception {
+
+ // given, when
+ JsonRepresentation args = JsonRepresentation.newMap();
+ args.mapPut("from.value", (Integer)null);
+ args.mapPut("to.value", (Integer)null);
+ Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "subListWithOptionalRange", UrlEncodingUtils.urlEncode(args));
+ RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ // then
+ then(restfulResponse);
+ }
+
+
+ @Test
+ public void usingClientFollow_whenImplicitlySetToNull() throws Exception {
+
+ // given
+ final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subListWithOptionalRange");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+
+ assertThat(invokeLink, isLink(client)
+ .rel(Rel.INVOKE)
+ .httpMethod(RestfulHttpMethod.GET)
+ .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subListWithOptionalRange/invoke"))
+ .build());
+
+ // when
+ JsonRepresentation args = JsonRepresentation.newMap();
+
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ then(restfulResponse);
+ }
+
+
+ @Test
+ public void usingResourceProxy_whenImplicitlySetToNull() throws Exception {
+
+ // given, when
+ JsonRepresentation args = JsonRepresentation.newMap();
+ Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "subListWithOptionalRange", UrlEncodingUtils.urlEncode(args));
+ RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ // then
+ then(restfulResponse);
+ }
+
+
+ private static void then(RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
+ assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(RestfulMediaType.APPLICATION_JSON_ACTION_RESULT));
+ final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
+
+ assertThat(actionResultRepr.getResultType(), is(ResultType.LIST));
+
+ final ListRepresentation listRepr = actionResultRepr.getResult().as(ListRepresentation.class);
+
+ assertThat(listRepr.getValue().size(), is(5));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenRefArg_whenArgLinkToNonExistentEntity_bad.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenRefArg_whenArgLinkToNonExistentEntity_bad.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenRefArg_whenArgLinkToNonExistentEntity_bad.java
new file mode 100644
index 0000000..2b1b9c2
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenRefArg_whenArgLinkToNonExistentEntity_bad.java
@@ -0,0 +1,126 @@
+/*
+ * 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.domainobjectorservice.id.action.invoke;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasStatus;
+import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
+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.ActionResultRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+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 Get_givenRefArg_whenArgLinkToNonExistentEntity_bad {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ private DomainServiceResource serviceResource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+ serviceResource = client.getDomainServiceResource();
+ }
+
+ @Test
+ public void usingClientFollow() throws Exception {
+
+ // given a reference to a non-existent entity
+ LinkRepresentation nonExistentEntityLink = new LinkRepresentation()
+ .withHref("http://localhost:39393/objects/NONEXISTENT/123");
+
+ // and given a representation of the 'contains' action accepting a entity href
+ final JsonRepresentation containsAction = Util.givenAction(client, "ActionsEntities", "contains");
+ final ObjectActionRepresentation containsActionRepr = containsAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = containsActionRepr.getInvoke();
+ final JsonRepresentation args = invokeLink.getArguments();
+
+ // when query the 'contains' action passing in the reference to the non-existent entity
+ args.mapPut("searchFor.value", nonExistentEntityLink);
+ args.mapPut("from.value", 0);
+ args.mapPut("to.value", 1);
+
+ RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ // then
+ then(args, restfulResponse);
+ }
+
+ @Test
+ public void usingResourceProxy() throws Exception {
+
+ // given a reference to a non-existent entity
+ LinkRepresentation nonExistentEntityLink = new LinkRepresentation()
+ .withHref("http://localhost:39393/objects/NONEXISTENT/123");
+
+ // when query the 'contains' action passing in the reference to the non-existent entity
+ JsonRepresentation args = JsonRepresentation.newMap();
+ args.mapPut("searchFor.value", nonExistentEntityLink);
+ args.mapPut("from.value", 0);
+ args.mapPut("to.value", 3);
+ Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "contains", UrlEncodingUtils.urlEncode(args));
+ RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ // then
+ then(args, restfulResponse);
+ }
+
+ private static void then(final JsonRepresentation args, RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
+ // then the response is an error
+ assertThat(restfulResponse, hasStatus(HttpStatusCode.VALIDATION_FAILED));
+ assertThat(restfulResponse.getHeader(Header.WARNING), is("Validation failed, see body for details"));
+
+ // hmmm... what is the media type, though? the spec doesn't say. testing for a generic one.
+ assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(MediaType.APPLICATION_JSON));
+
+ RestfulResponse<JsonRepresentation> restfulResponseOfError = restfulResponse.wraps(JsonRepresentation.class);
+ JsonRepresentation repr = restfulResponseOfError.getEntity();
+
+ assertThat(repr.getString("searchFor.value.href"), is(args.getString("searchFor.value.href")));
+ assertThat(repr.getString("searchFor.invalidReason"), is("'href' does not reference a known entity"));
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenRefArg_whenArgProvided_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenRefArg_whenArgProvided_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenRefArg_whenArgProvided_ok.java
new file mode 100644
index 0000000..2786250
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenRefArg_whenArgProvided_ok.java
@@ -0,0 +1,172 @@
+/*
+ * 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.domainobjectorservice.id.action.invoke;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+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.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.RestfulMediaType;
+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.ActionResultRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ActionResultRepresentation.ResultType;
+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.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ScalarValueRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.hamcrest.Matchers;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class Get_givenRefArg_whenArgProvided_ok {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+ private DomainServiceResource serviceResource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+
+ serviceResource = client.getDomainServiceResource();
+ }
+
+ @Test
+ public void usingClientFollow() throws Exception {
+
+ // given a reference to the first entity
+ final ListRepresentation subListRepr = givenSublistActionInvoked(0, 1);
+ assertThat(subListRepr.getValue().size(), is(1));
+
+ LinkRepresentation firstEntityLink = subListRepr.getValue().arrayGet(0).asLink();
+
+ // and given a representation of the 'contains' action accepting a entity href
+ final JsonRepresentation containsAction = Util.givenAction(client, "ActionsEntities", "contains");
+ final ObjectActionRepresentation containsActionRepr = containsAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = containsActionRepr.getInvoke();
+ final JsonRepresentation args = invokeLink.getArguments();
+ assertThat(args.size(), is(3));
+
+ // when query the 'contains' action passing in the entity
+ // (for a range where the entity is contained in the range)
+ args.mapPut("searchFor.value", firstEntityLink);
+ args.mapPut("from.value", 0);
+ args.mapPut("to.value", 3);
+
+ RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ // then
+ thenResponseIsScalarValueOf(restfulResponse, true);
+
+
+ // and when query the 'contains' action for a different range which does not
+ // contain the entity
+ args.mapPut("searchFor.value", firstEntityLink);
+ args.mapPut("from.value", 3);
+ args.mapPut("to.values", 5);
+
+ restfulResponse = client.followT(invokeLink, args);
+
+ // then
+ thenResponseIsScalarValueOf(restfulResponse, false);
+ }
+
+
+
+ @Test
+ public void usingResourceProxy() throws Exception {
+
+ // given a reference to the first entity
+ final ListRepresentation subListRepr = givenSublistActionInvoked(0, 1);
+ LinkRepresentation firstEntityLink = subListRepr.getValue().arrayGet(0).asLink();
+
+ // when query the 'contains' action passing in the entity
+ // (for a range where the entity is contained in the range)
+ JsonRepresentation args = JsonRepresentation.newMap();
+ args.mapPut("searchFor.value", firstEntityLink);
+ args.mapPut("from.value", 0);
+ args.mapPut("to.value", 3);
+ Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "contains", UrlEncodingUtils.urlEncode(args));
+ RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ // then
+ thenResponseIsScalarValueOf(restfulResponse, true);
+ }
+
+ private void thenResponseIsScalarValueOf(RestfulResponse<ActionResultRepresentation> restfulResponse, boolean value) throws JsonParseException, JsonMappingException, IOException {
+ assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(RestfulMediaType.APPLICATION_JSON_ACTION_RESULT));
+ ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
+ assertThat(actionResultRepr.getResultType(), is(ResultType.SCALAR_VALUE));
+ JsonRepresentation resultRepr = actionResultRepr.getResult();
+ assertThat(resultRepr, is(not(nullValue())));
+
+ ScalarValueRepresentation scalarValueRepr = resultRepr.as(ScalarValueRepresentation.class);
+
+ LinkRepresentation returnTypeLink = scalarValueRepr.getLinkWithRel(Rel.RETURN_TYPE);
+ assertThat(returnTypeLink, is(not(nullValue())));
+ assertThat(returnTypeLink, isLink(client)
+ .rel(Rel.RETURN_TYPE)
+ .href(Matchers.endsWith(":39393/domain-types/boolean"))
+ .returning(HttpStatusCode.OK)
+ .build());
+
+ assertThat(scalarValueRepr.getValue().asBoolean(), is(value));
+ }
+
+
+ private ListRepresentation givenSublistActionInvoked(int from, int to) throws Exception {
+ final JsonRepresentation givenSubListAction = Util.givenAction(client, "ActionsEntities", "subList");
+ final ObjectActionRepresentation actionRepr = givenSubListAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+ final JsonRepresentation args = invokeLink.getArguments();
+
+ // when
+ args.mapPut("from.value", from);
+ args.mapPut("to.value", to);
+
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
+ return actionResultRepr.getResult().as(ListRepresentation.class);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBigDecimal_whenArgMalformed_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBigDecimal_whenArgMalformed_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBigDecimal_whenArgMalformed_bad_TODO.java
new file mode 100644
index 0000000..22a8e20
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBigDecimal_whenArgMalformed_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Get_givenScalarArgBigDecimal_whenArgMalformed_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBigDecimal_whenArgProvided_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBigDecimal_whenArgProvided_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBigDecimal_whenArgProvided_ok_TODO.java
new file mode 100644
index 0000000..7f845c8
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBigDecimal_whenArgProvided_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Get_givenScalarArgBigDecimal_whenArgProvided_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBigInteger_whenArgMalformed_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBigInteger_whenArgMalformed_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBigInteger_whenArgMalformed_bad_TODO.java
new file mode 100644
index 0000000..4da2b30
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBigInteger_whenArgMalformed_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Get_givenScalarArgBigInteger_whenArgMalformed_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBigInteger_whenArgProvided_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBigInteger_whenArgProvided_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBigInteger_whenArgProvided_ok_TODO.java
new file mode 100644
index 0000000..8939761
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBigInteger_whenArgProvided_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Get_givenScalarArgBigInteger_whenArgProvided_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBlob_whenArgMalformed_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBlob_whenArgMalformed_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBlob_whenArgMalformed_bad_TODO.java
new file mode 100644
index 0000000..f1c5017
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBlob_whenArgMalformed_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Get_givenScalarArgBlob_whenArgMalformed_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBlob_whenArgProvided_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBlob_whenArgProvided_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBlob_whenArgProvided_ok_TODO.java
new file mode 100644
index 0000000..5a0a673
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBlob_whenArgProvided_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Get_givenScalarArgBlob_whenArgProvided_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBoolean_whenArgMalformed_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBoolean_whenArgMalformed_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBoolean_whenArgMalformed_bad_TODO.java
new file mode 100644
index 0000000..d776a96
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBoolean_whenArgMalformed_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Get_givenScalarArgBoolean_whenArgMalformed_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBoolean_whenArgProvided_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBoolean_whenArgProvided_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBoolean_whenArgProvided_ok_TODO.java
new file mode 100644
index 0000000..ebb271b
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgBoolean_whenArgProvided_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Get_givenScalarArgBoolean_whenArgProvided_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgClob_whenArgMalformed_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgClob_whenArgMalformed_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgClob_whenArgMalformed_bad_TODO.java
new file mode 100644
index 0000000..7960cc0
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgClob_whenArgMalformed_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Get_givenScalarArgClob_whenArgMalformed_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgDateTime_whenArgMalformed_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgDateTime_whenArgMalformed_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgDateTime_whenArgMalformed_bad_TODO.java
new file mode 100644
index 0000000..0e0303a
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgDateTime_whenArgMalformed_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Get_givenScalarArgDateTime_whenArgMalformed_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgDateTime_whenArgProvided_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgDateTime_whenArgProvided_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgDateTime_whenArgProvided_ok_TODO.java
new file mode 100644
index 0000000..8f923e8
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgDateTime_whenArgProvided_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Get_givenScalarArgDateTime_whenArgProvided_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgDate_whenArgMalformed_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgDate_whenArgMalformed_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgDate_whenArgMalformed_bad_TODO.java
new file mode 100644
index 0000000..d7edea7
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgDate_whenArgMalformed_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Get_givenScalarArgDate_whenArgMalformed_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgDate_whenArgProvided_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgDate_whenArgProvided_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgDate_whenArgProvided_ok_TODO.java
new file mode 100644
index 0000000..4d5db97
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgDate_whenArgProvided_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Get_givenScalarArgDate_whenArgProvided_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgDecimal_whenArgMalformed_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgDecimal_whenArgMalformed_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgDecimal_whenArgMalformed_bad_TODO.java
new file mode 100644
index 0000000..49a8380
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgDecimal_whenArgMalformed_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Get_givenScalarArgDecimal_whenArgMalformed_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgDecimal_whenArgProvided_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgDecimal_whenArgProvided_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgDecimal_whenArgProvided_ok_TODO.java
new file mode 100644
index 0000000..44af575
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgDecimal_whenArgProvided_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Get_givenScalarArgDecimal_whenArgProvided_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgInteger_whenArgMalformed_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgInteger_whenArgMalformed_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgInteger_whenArgMalformed_bad_TODO.java
new file mode 100644
index 0000000..cb0ab55
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgInteger_whenArgMalformed_bad_TODO.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.domainobjectorservice.id.action.invoke;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+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.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulMediaType;
+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.domainobjects.ActionResultRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ActionResultRepresentation.ResultType;
+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.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.hamcrest.Matchers;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class Get_givenScalarArgInteger_whenArgMalformed_bad_TODO {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ private DomainServiceResource serviceResource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+
+ serviceResource = client.getDomainServiceResource();
+ }
+
+ @Test
+ public void usingClientFollow() throws Exception {
+
+ // given
+ final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subList");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+
+ assertThat(invokeLink, isLink(client)
+ .rel(Rel.INVOKE)
+ .httpMethod(RestfulHttpMethod.GET)
+ .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subList/invoke"))
+ .build());
+
+ JsonRepresentation args =invokeLink.getArguments();
+ assertThat(args.size(), is(2));
+ assertThat(args, RestfulMatchers.mapHas("from"));
+ assertThat(args, RestfulMatchers.mapHas("to"));
+
+ // when
+ args.mapPut("from.value", 1);
+ args.mapPut("to.value", 3);
+
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ then(restfulResponse);
+ }
+
+ @Test
+ public void usingResourceProxy() throws Exception {
+
+ // given, when
+ JsonRepresentation args = JsonRepresentation.newMap();
+ args.mapPut("from.value", 1);
+ args.mapPut("to.value", 3);
+ Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "subList", UrlEncodingUtils.urlEncode(args));
+ RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ // then
+ then(restfulResponse);
+ }
+
+ private static void then(RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
+ assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(RestfulMediaType.APPLICATION_JSON_ACTION_RESULT));
+ final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
+
+ assertThat(actionResultRepr.getResultType(), is(ResultType.LIST));
+
+ final ListRepresentation listRepr = actionResultRepr.getResult().as(ListRepresentation.class);
+
+ assertThat(listRepr.getValue().size(), is(2));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgInteger_whenArgProvided_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgInteger_whenArgProvided_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgInteger_whenArgProvided_ok.java
new file mode 100644
index 0000000..c899d1d
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgInteger_whenArgProvided_ok.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.domainobjectorservice.id.action.invoke;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+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.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulMediaType;
+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.domainobjects.ActionResultRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ActionResultRepresentation.ResultType;
+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.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.hamcrest.Matchers;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class Get_givenScalarArgInteger_whenArgProvided_ok {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ private DomainServiceResource serviceResource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+
+ serviceResource = client.getDomainServiceResource();
+ }
+
+ @Test
+ public void usingClientFollow() throws Exception {
+
+ // given
+ final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subList");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+
+ assertThat(invokeLink, isLink(client)
+ .rel(Rel.INVOKE)
+ .httpMethod(RestfulHttpMethod.GET)
+ .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subList/invoke"))
+ .build());
+
+ JsonRepresentation args =invokeLink.getArguments();
+ assertThat(args.size(), is(2));
+ assertThat(args, RestfulMatchers.mapHas("from"));
+ assertThat(args, RestfulMatchers.mapHas("to"));
+
+ // when
+ args.mapPut("from.value", 1);
+ args.mapPut("to.value", 3);
+
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ then(restfulResponse);
+ }
+
+ @Test
+ public void usingResourceProxy() throws Exception {
+
+ // given, when
+ JsonRepresentation args = JsonRepresentation.newMap();
+ args.mapPut("from.value", 1);
+ args.mapPut("to.value", 3);
+ Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "subList", UrlEncodingUtils.urlEncode(args));
+ RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ // then
+ then(restfulResponse);
+ }
+
+ private static void then(RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
+ assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(RestfulMediaType.APPLICATION_JSON_ACTION_RESULT));
+ final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
+
+ assertThat(actionResultRepr.getResultType(), is(ResultType.LIST));
+
+ final ListRepresentation listRepr = actionResultRepr.getResult().as(ListRepresentation.class);
+
+ assertThat(listRepr.getValue().size(), is(2));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgString_whenArgMalformed_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgString_whenArgMalformed_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgString_whenArgMalformed_bad_TODO.java
new file mode 100644
index 0000000..4c35e4e
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgString_whenArgMalformed_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Get_givenScalarArgString_whenArgMalformed_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgString_whenArgProvided_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgString_whenArgProvided_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgString_whenArgProvided_ok_TODO.java
new file mode 100644
index 0000000..0532d3c
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgString_whenArgProvided_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Get_givenScalarArgString_whenArgProvided_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgTime_whenArgMalformed_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgTime_whenArgMalformed_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgTime_whenArgMalformed_bad_TODO.java
new file mode 100644
index 0000000..7fffcef
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgTime_whenArgMalformed_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Get_givenScalarArgTime_whenArgMalformed_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgTime_whenArgProvided_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgTime_whenArgProvided_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgTime_whenArgProvided_ok_TODO.java
new file mode 100644
index 0000000..0384694
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgTime_whenArgProvided_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Get_givenScalarArgTime_whenArgProvided_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgUtcMillisec_whenArgMalformed_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgUtcMillisec_whenArgMalformed_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgUtcMillisec_whenArgMalformed_bad_TODO.java
new file mode 100644
index 0000000..222e8e9
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgUtcMillisec_whenArgMalformed_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Get_givenScalarArgUtcMillisec_whenArgMalformed_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgUtcMillisec_whenArgProvided_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgUtcMillisec_whenArgProvided_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgUtcMillisec_whenArgProvided_ok_TODO.java
new file mode 100644
index 0000000..340ec0f
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArgUtcMillisec_whenArgProvided_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Get_givenScalarArgUtcMillisec_whenArgProvided_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArg_whenArgMalformedMissingValueNode_bad.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArg_whenArgMalformedMissingValueNode_bad.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArg_whenArgMalformedMissingValueNode_bad.java
new file mode 100644
index 0000000..843784e
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArg_whenArgMalformedMissingValueNode_bad.java
@@ -0,0 +1,118 @@
+/*
+ * 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.domainobjectorservice.id.action.invoke;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.hamcrest.Matchers;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+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.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.domainobjects.ActionResultRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+
+public class Get_givenScalarArg_whenArgMalformedMissingValueNode_bad {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ private DomainServiceResource serviceResource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+ serviceResource = client.getDomainServiceResource();
+ }
+
+
+ @Test
+ public void usingClientFollow_whenImplicitlySetToNull() throws Exception {
+
+ // given
+ final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subListWithOptionalRange");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+
+ assertThat(invokeLink, isLink(client)
+ .rel(Rel.INVOKE)
+ .httpMethod(RestfulHttpMethod.GET)
+ .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subListWithOptionalRange/invoke"))
+ .build());
+
+ // when
+ JsonRepresentation args = JsonRepresentation.newMap();
+ args.mapPut("from", JsonRepresentation.newMap());
+ args.mapPut("to.value", (Integer)null);
+
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ // then
+ then(restfulResponse);
+ }
+
+
+ @Test
+ public void usingResourceProxy_whenExplicitSetToNull() throws Exception {
+
+ // given, when
+ JsonRepresentation args = JsonRepresentation.newMap();
+ args.mapPut("from", JsonRepresentation.newMap());
+ args.mapPut("to.value", (Integer)null);
+
+ Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "subListWithOptionalRange", UrlEncodingUtils.urlEncode(args));
+ RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ // then
+ then(restfulResponse);
+ }
+
+
+ private static void then(RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
+ assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(MediaType.APPLICATION_JSON));
+ final JsonRepresentation errorRepr = restfulResponse.wraps(JsonRepresentation.class).getEntity();
+
+ assertThat(errorRepr.getString("from.invalidReason"), is("No 'value' key"));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArg_whenArgSurplus_bad.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArg_whenArgSurplus_bad.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArg_whenArgSurplus_bad.java
new file mode 100644
index 0000000..85bbd80
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenScalarArg_whenArgSurplus_bad.java
@@ -0,0 +1,135 @@
+/*
+ * 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.domainobjectorservice.id.action.invoke;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasStatus;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.hamcrest.Matchers;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+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.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.domainobjects.ActionResultRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+
+public class Get_givenScalarArg_whenArgSurplus_bad {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ private DomainServiceResource serviceResource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+
+ serviceResource = client.getDomainServiceResource();
+ }
+
+ @Test
+ public void usingClientFollow() throws Exception {
+
+ // given
+ final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subList");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+
+ assertThat(invokeLink, isLink(client)
+ .rel(Rel.INVOKE)
+ .httpMethod(RestfulHttpMethod.GET)
+ .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subList/invoke"))
+ .build());
+
+ JsonRepresentation args =invokeLink.getArguments();
+ assertThat(args.size(), is(2));
+ assertThat(args, RestfulMatchers.mapHas("from"));
+ assertThat(args, RestfulMatchers.mapHas("to"));
+
+ // when
+ args = JsonRepresentation.newMap();
+ args.mapPut("from.value", 0);
+ args.mapPut("to.value", 1);
+ args.mapPut("nonExistent.value", 2);
+ assertThat(args.size(), is(3));
+
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ // then
+ thenResponseIsErrorWithInvalidReason(restfulResponse);
+ }
+
+
+ @Test
+ public void usingResourceProxy() throws Exception {
+
+ // given, when
+ JsonRepresentation args = JsonRepresentation.newMap();
+ args.mapPut("from.value", 0);
+ args.mapPut("to.value", 1);
+ args.mapPut("nonExistent.value", 2);
+ assertThat(args.size(), is(3));
+
+ Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "subList", UrlEncodingUtils.urlEncode(args));
+ RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ // then
+ thenResponseIsErrorWithInvalidReason(restfulResponse);
+ }
+
+ private static void thenResponseIsErrorWithInvalidReason(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
+ assertThat(restfulResponse, hasStatus(HttpStatusCode.BAD_REQUEST));
+ assertThat(restfulResponse.getHeader(Header.WARNING), is("Argument 'nonExistent' found but no such parameter"));
+
+ // hmmm... what is the media type, though? the spec doesn't say. testing for a generic one.
+ assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(MediaType.APPLICATION_JSON));
+
+ RestfulResponse<JsonRepresentation> restfulResponseOfError = restfulResponse.wraps(JsonRepresentation.class);
+ JsonRepresentation repr = restfulResponseOfError.getEntity();
+
+ assertThat(repr.getString("x-ro-invalidReason"), is("Argument 'nonExistent' found but no such parameter"));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenValidatableArg_whenQueryArgXroValidateOnly_andArgFails_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenValidatableArg_whenQueryArgXroValidateOnly_andArgFails_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenValidatableArg_whenQueryArgXroValidateOnly_andArgFails_TODO.java
new file mode 100644
index 0000000..933af1a
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenValidatableArg_whenQueryArgXroValidateOnly_andArgFails_TODO.java
@@ -0,0 +1,20 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class Get_givenValidatableArg_whenQueryArgXroValidateOnly_andArgFails_TODO {
+
+ @Ignore
+ @Test
+ public void success() throws Exception {
+ // should return 204 (13.3)
+ }
+
+ @Ignore
+ @Test
+ public void failure() throws Exception {
+ // should return 422, etc
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenValidatableArg_whenQueryArgXroValidateOnly_andArgPasses_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenValidatableArg_whenQueryArgXroValidateOnly_andArgPasses_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenValidatableArg_whenQueryArgXroValidateOnly_andArgPasses_ok_TODO.java
new file mode 100644
index 0000000..f33ed5d
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenValidatableArg_whenQueryArgXroValidateOnly_andArgPasses_ok_TODO.java
@@ -0,0 +1,20 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class Get_givenValidatableArg_whenQueryArgXroValidateOnly_andArgPasses_ok_TODO {
+
+ @Ignore
+ @Test
+ public void success() throws Exception {
+ // should return 204 (13.3)
+ }
+
+ @Ignore
+ @Test
+ public void failure() throws Exception {
+ // should return 422, etc
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenValidationRuleForAllArgs_whenArgFails_bad.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenValidationRuleForAllArgs_whenArgFails_bad.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenValidationRuleForAllArgs_whenArgFails_bad.java
new file mode 100644
index 0000000..8266123
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenValidationRuleForAllArgs_whenArgFails_bad.java
@@ -0,0 +1,133 @@
+/*
+ * 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.domainobjectorservice.id.action.invoke;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasStatus;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+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.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulMediaType;
+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.ActionResultRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ActionResultRepresentation.ResultType;
+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.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.hamcrest.Matchers;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class Get_givenValidationRuleForAllArgs_whenArgFails_bad {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ private DomainServiceResource serviceResource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+
+ serviceResource = client.getDomainServiceResource();
+ }
+
+ @Test
+ public void usingClientFollow() throws Exception {
+
+ // given
+ final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subList");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+
+ assertThat(invokeLink, isLink(client)
+ .rel(Rel.INVOKE)
+ .httpMethod(RestfulHttpMethod.GET)
+ .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subList/invoke"))
+ .build());
+
+ JsonRepresentation args =invokeLink.getArguments();
+ assertThat(args.size(), is(2));
+ assertThat(args, RestfulMatchers.mapHas("from"));
+ assertThat(args, RestfulMatchers.mapHas("to"));
+
+ // when
+ args.mapPut("from.value", 1);
+ args.mapPut("to.value", 0);
+
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ // then
+ thenResponseIsErrorWithInvalidReason(restfulResponse);
+ }
+
+ @Test
+ public void usingResourceProxy() throws Exception {
+
+ // given, when
+ JsonRepresentation args = JsonRepresentation.newMap();
+ args.mapPut("from.value", 1);
+ args.mapPut("to.value", 0);
+ Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "subList", UrlEncodingUtils.urlEncode(args));
+ RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ // then
+ thenResponseIsErrorWithInvalidReason(restfulResponse);
+ }
+
+ private static void thenResponseIsErrorWithInvalidReason(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
+ assertThat(restfulResponse, hasStatus(HttpStatusCode.VALIDATION_FAILED));
+ assertThat(restfulResponse.getHeader(Header.WARNING), is("Validation failed, see body for details"));
+
+ // hmmm... what is the media type, though? the spec doesn't say. testing for a generic one.
+ assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(MediaType.APPLICATION_JSON));
+
+ RestfulResponse<JsonRepresentation> restfulResponseOfError = restfulResponse.wraps(JsonRepresentation.class);
+ JsonRepresentation repr = restfulResponseOfError.getEntity();
+
+ assertThat(repr.getString("x-ro-invalidReason"), is("'from' cannot be larger than 'to'"));
+ }
+
+
+
+}
[4/9] ISIS-233: adding new test stubs (TODOs)
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenQueryArg_xRoFollowLinks_thenRepresentation_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenQueryArg_xRoFollowLinks_thenRepresentation_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenQueryArg_xRoFollowLinks_thenRepresentation_ok.java
new file mode 100644
index 0000000..cbea601
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenQueryArg_xRoFollowLinks_thenRepresentation_ok.java
@@ -0,0 +1,169 @@
+/*
+ * 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.serviceId;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.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.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.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.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.apache.isis.viewer.restfulobjects.tck.Util;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.*;
+
+public class Get_whenQueryArg_xRoFollowLinks_thenRepresentation_ok {
+
+ @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 self() throws Exception {
+ final String href = givenHrefToService("WrapperValuedEntities");
+
+ final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, href).withArg(RequestParameter.FOLLOW_LINKS, "links[rel=self]");
+ final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+ final DomainObjectRepresentation repr = restfulResponse.getEntity();
+
+ assertThat(repr.getSelf().getValue(), is(not(nullValue())));
+ }
+
+ @Test
+ public void toDescribedBy() throws Exception {
+ final String href = givenHrefToService("WrapperValuedEntities");
+
+ final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, href).withArg(RequestParameter.FOLLOW_LINKS, "links[rel=describedby]");
+ final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+ final DomainObjectRepresentation repr = restfulResponse.getEntity();
+
+ assertThat(repr.getLinkWithRel(Rel.DESCRIBEDBY).getValue(), is(not(nullValue())));
+ }
+
+ @Test
+ public void toMembersDetails() throws Exception {
+ final String href = givenHrefToService("WrapperValuedEntities");
+
+ final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, href).withArg(RequestParameter.FOLLOW_LINKS, "members.links[rel=%s]", Rel.DETAILS.getName());
+ final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+ final DomainObjectRepresentation repr = restfulResponse.getEntity();
+
+ final JsonRepresentation membersList = repr.getMembers();
+ assertThat(membersList, isMap());
+
+ JsonRepresentation actionRepr;
+
+ actionRepr = membersList.getRepresentation("list");
+ assertThat(actionRepr.getRepresentation("links[rel="+Rel.DETAILS.getName()+"]"), is(not(nullValue())));
+ assertThat(actionRepr.getRepresentation("links[rel="+Rel.DETAILS.getName()+"].value"), is(not(nullValue()))); // followed
+
+ actionRepr = membersList.getRepresentation("newEntity");
+ assertThat(actionRepr.getRepresentation("links[rel="+Rel.DETAILS.getName()+"]"), is(not(nullValue())));
+ assertThat(actionRepr.getRepresentation("links[rel="+Rel.DETAILS.getName()+"].value"), is(not(nullValue()))); // also followed
+ }
+
+ @Test
+ public void singleMember_specified_by_criteria() throws Exception {
+
+ final String href = givenHrefToService("WrapperValuedEntities");
+
+ final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, href).withArg(RequestParameter.FOLLOW_LINKS, "members[%s].links[rel=%s]", "list", Rel.DETAILS.getName());
+ final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+ final DomainObjectRepresentation repr = restfulResponse.getEntity();
+
+ final JsonRepresentation membersList = repr.getMembers();
+ assertThat(membersList, isMap());
+
+ JsonRepresentation actionRepr;
+
+ actionRepr = membersList.getRepresentation("list");
+ assertThat(actionRepr.getRepresentation("links[rel="+Rel.DETAILS.getName()+"]"), is(not(nullValue())));
+ assertThat(actionRepr.getRepresentation("links[rel="+Rel.DETAILS.getName()+"].value"), is(not(nullValue()))); // followed
+
+ actionRepr = membersList.getRepresentation("newEntity");
+ assertThat(actionRepr.getRepresentation("links[rel="+Rel.DETAILS.getName()+"]"), is(not(nullValue())));
+ assertThat(actionRepr.getRepresentation("links[rel="+Rel.DETAILS.getName()+"].value"), is(nullValue())); // not followed
+ }
+
+ @Test
+ public void toMultipleMembersDetails() throws Exception {
+
+ final String href = givenHrefToService("WrapperValuedEntities");
+
+ final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, href).withArg(RequestParameter.FOLLOW_LINKS, "members[%s].links[rel=%s],members[%s].links[rel=%s]", "list", Rel.DETAILS.getName(), "newEntity", Rel.DETAILS.getName());
+ final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+ final DomainObjectRepresentation repr = restfulResponse.getEntity();
+
+ final JsonRepresentation membersList = repr.getMembers();
+ assertThat(membersList, isMap());
+
+ JsonRepresentation actionRepr;
+
+ actionRepr = membersList.getRepresentation("list");
+ assertThat(actionRepr.getRepresentation("links[rel="+Rel.DETAILS.getName()+"]"), is(not(nullValue())));
+ assertThat(actionRepr.getRepresentation("links[rel="+Rel.DETAILS.getName()+"].value"), is(not(nullValue()))); // followed
+
+ actionRepr = membersList.getRepresentation("newEntity");
+ assertThat(actionRepr.getRepresentation("links[rel="+Rel.DETAILS.getName()+"]"), is(not(nullValue())));
+ assertThat(actionRepr.getRepresentation("links[rel="+Rel.DETAILS.getName()+"].value"), is(not(nullValue()))); // also followed
+ }
+
+ private String givenHrefToService(final String serviceId) throws JsonParseException, JsonMappingException, IOException {
+ return Util.givenHrefToService(client, serviceId);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java
new file mode 100644
index 0000000..a2cda2b
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainservice.serviceId;
+
+public class Get_whenRequestHeaders_Accept_isInvalid_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenRequestHeaders_Accept_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenRequestHeaders_Accept_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenRequestHeaders_Accept_ok.java
new file mode 100644
index 0000000..8b10d6a
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenRequestHeaders_Accept_ok.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.domainservice.serviceId;
+
+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.apache.isis.viewer.restfulobjects.tck.Util;
+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 Get_whenRequestHeaders_Accept_ok {
+
+ @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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Post_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Post_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Post_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..fd2721a
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Post_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainservice.serviceId;
+
+public class Post_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Put_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Put_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Put_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..7289bac
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Put_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainservice.serviceId;
+
+public class Put_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_forbidden.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_forbidden.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_forbidden.java
deleted file mode 100644
index e80690a..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_forbidden.java
+++ /dev/null
@@ -1,122 +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.domainservice.serviceId.action.invoke;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasStatus;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
-import static org.hamcrest.CoreMatchers.*;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.hamcrest.Matchers;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-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.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.domainobjects.ActionResultRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers;
-import org.apache.isis.viewer.restfulobjects.tck.Util;
-
-public class DomainServiceTest_forbidden {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- private DomainServiceResource serviceResource;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
-
- serviceResource = client.getDomainServiceResource();
- }
-
- @Test
- public void usingClientFollow() throws Exception {
-
- // given, when
- final JsonRepresentation givenAction = Util.givenAction(client, "BusinessRulesEntities", "visibleButNotInvocableAction");
- final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
-
- // then
- final String disabledReason = actionRepr.getDisabledReason();
- assertThat(disabledReason, is("Always disabled"));
-
-
- final LinkRepresentation invokeLink = new LinkRepresentation()
- .withRel(Rel.INVOKE)
- .withHref("http://localhost:39393/services/BusinessRulesEntities/actions/visibleButNotInvocableAction/invoke");
-
- // when
- JsonRepresentation args = JsonRepresentation.newMap();
- args = JsonRepresentation.newMap();
- args.mapPut("id.value", 123);
-
- final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
-
- // then
- thenResponseIsErrorWithInvalidReason(restfulResponse, disabledReason);
- }
-
-
- @Test
- public void usingResourceProxy() throws Exception {
-
- // given, when
- JsonRepresentation args = JsonRepresentation.newMap();
- args.mapPut("id.value", 123);
-
- Response response = serviceResource.invokeActionQueryOnly("BusinessRulesEntities", "visibleButNotInvocableAction", UrlEncodingUtils.urlEncode(args));
- RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
-
- // then
- thenResponseIsErrorWithInvalidReason(restfulResponse, "Always disabled");
- }
-
- private static void thenResponseIsErrorWithInvalidReason(final RestfulResponse<ActionResultRepresentation> restfulResponse, String disabledReason) throws JsonParseException, JsonMappingException, IOException {
- assertThat(restfulResponse, hasStatus(HttpStatusCode.FORBIDDEN));
- assertThat(restfulResponse.getHeader(Header.WARNING), is(disabledReason));
-
- // hmmm... what is the media type, though? the spec doesn't say. testing for a generic one.
- assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(MediaType.APPLICATION_JSON));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_arg_bad_malformed.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_arg_bad_malformed.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_arg_bad_malformed.java
deleted file mode 100644
index 383a075..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_arg_bad_malformed.java
+++ /dev/null
@@ -1,118 +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.domainservice.serviceId.action.invoke;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.hamcrest.Matchers;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-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.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.domainobjects.ActionResultRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.apache.isis.viewer.restfulobjects.tck.Util;
-
-public class DomainServiceTest_req_safe_arg_bad_malformed {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- private DomainServiceResource serviceResource;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
- serviceResource = client.getDomainServiceResource();
- }
-
-
- @Test
- public void usingClientFollow_whenImplicitlySetToNull() throws Exception {
-
- // given
- final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subListWithOptionalRange");
- final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
-
- final LinkRepresentation invokeLink = actionRepr.getInvoke();
-
- assertThat(invokeLink, isLink(client)
- .rel(Rel.INVOKE)
- .httpMethod(RestfulHttpMethod.GET)
- .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subListWithOptionalRange/invoke"))
- .build());
-
- // when
- JsonRepresentation args = JsonRepresentation.newMap();
- args.mapPut("from", JsonRepresentation.newMap());
- args.mapPut("to.value", (Integer)null);
-
- final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
-
- // then
- then(restfulResponse);
- }
-
-
- @Test
- public void usingResourceProxy_whenExplicitSetToNull() throws Exception {
-
- // given, when
- JsonRepresentation args = JsonRepresentation.newMap();
- args.mapPut("from", JsonRepresentation.newMap());
- args.mapPut("to.value", (Integer)null);
-
- Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "subListWithOptionalRange", UrlEncodingUtils.urlEncode(args));
- RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
-
- // then
- then(restfulResponse);
- }
-
-
- private static void then(RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
- assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(MediaType.APPLICATION_JSON));
- final JsonRepresentation errorRepr = restfulResponse.wraps(JsonRepresentation.class).getEntity();
-
- assertThat(errorRepr.getString("from.invalidReason"), is("No 'value' key"));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_noarg_resp_list.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_noarg_resp_list.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_noarg_resp_list.java
deleted file mode 100644
index 612f32b..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_noarg_resp_list.java
+++ /dev/null
@@ -1,112 +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.domainservice.serviceId.action.invoke;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.Response;
-
-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.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulMediaType;
-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.domainobjects.ActionResultRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ActionResultRepresentation.ResultType;
-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.domainobjects.ObjectActionRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.apache.isis.viewer.restfulobjects.tck.Util;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.hamcrest.Matchers;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class DomainServiceTest_req_safe_noarg_resp_list {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- private DomainServiceResource serviceResource;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
-
- serviceResource = client.getDomainServiceResource();
- }
-
- @Test
- public void usingClientFollow() throws Exception {
-
- // given
- final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "list");
- final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
-
- final LinkRepresentation invokeLink = actionRepr.getInvoke();
-
- assertThat(invokeLink, isLink(client)
- .rel(Rel.INVOKE)
- .httpMethod(RestfulHttpMethod.GET)
- .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/list/invoke"))
- .arguments(JsonRepresentation.newMap())
- .build());
-
- // when
- final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink);
-
- // then
- then(restfulResponse);
- }
-
- private static void then(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
-
- assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(RestfulMediaType.APPLICATION_JSON_ACTION_RESULT));
- final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
-
- assertThat(actionResultRepr.getResultType(), is(ResultType.LIST));
- final ListRepresentation listRepr = actionResultRepr.getResult().as(ListRepresentation.class);
- assertThat(listRepr.getValue().size(), is(5));
- }
-
-
- @Test
- public void usingResourceProxy() throws Exception {
-
- // given, when
- Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "list", null);
- RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
-
- then(restfulResponse);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_optionalarg_resp_list.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_optionalarg_resp_list.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_optionalarg_resp_list.java
deleted file mode 100644
index 56195dc..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_optionalarg_resp_list.java
+++ /dev/null
@@ -1,164 +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.domainservice.serviceId.action.invoke;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.Response;
-
-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.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulMediaType;
-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.domainobjects.ActionResultRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ActionResultRepresentation.ResultType;
-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.domainobjects.ObjectActionRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers;
-import org.apache.isis.viewer.restfulobjects.tck.Util;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.hamcrest.Matchers;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class DomainServiceTest_req_safe_optionalarg_resp_list {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- private DomainServiceResource serviceResource;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
-
- serviceResource = client.getDomainServiceResource();
- }
-
- @Test
- public void usingClientFollow_whenExplicitlySetToNull() throws Exception {
-
- // given
- final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subListWithOptionalRange");
- final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
-
- final LinkRepresentation invokeLink = actionRepr.getInvoke();
-
- assertThat(invokeLink, isLink(client)
- .rel(Rel.INVOKE)
- .httpMethod(RestfulHttpMethod.GET)
- .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subListWithOptionalRange/invoke"))
- .build());
-
- JsonRepresentation args =invokeLink.getArguments();
- assertThat(args.size(), is(2));
- assertThat(args, RestfulMatchers.mapHas("from"));
- assertThat(args, RestfulMatchers.mapHas("to"));
-
- // when
- args.mapPut("from.value", (Integer)null);
- args.mapPut("to.value", (Integer)null);
-
- final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
-
- then(restfulResponse);
- }
-
-
- @Test
- public void usingResourceProxy_whenExplicitlySetToNull() throws Exception {
-
- // given, when
- JsonRepresentation args = JsonRepresentation.newMap();
- args.mapPut("from.value", (Integer)null);
- args.mapPut("to.value", (Integer)null);
- Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "subListWithOptionalRange", UrlEncodingUtils.urlEncode(args));
- RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
-
- // then
- then(restfulResponse);
- }
-
-
- @Test
- public void usingClientFollow_whenImplicitlySetToNull() throws Exception {
-
- // given
- final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subListWithOptionalRange");
- final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
-
- final LinkRepresentation invokeLink = actionRepr.getInvoke();
-
- assertThat(invokeLink, isLink(client)
- .rel(Rel.INVOKE)
- .httpMethod(RestfulHttpMethod.GET)
- .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subListWithOptionalRange/invoke"))
- .build());
-
- // when
- JsonRepresentation args = JsonRepresentation.newMap();
-
- final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
-
- then(restfulResponse);
- }
-
-
- @Test
- public void usingResourceProxy_whenImplicitlySetToNull() throws Exception {
-
- // given, when
- JsonRepresentation args = JsonRepresentation.newMap();
- Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "subListWithOptionalRange", UrlEncodingUtils.urlEncode(args));
- RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
-
- // then
- then(restfulResponse);
- }
-
-
- private static void then(RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
- assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(RestfulMediaType.APPLICATION_JSON_ACTION_RESULT));
- final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
-
- assertThat(actionResultRepr.getResultType(), is(ResultType.LIST));
-
- final ListRepresentation listRepr = actionResultRepr.getResult().as(ListRepresentation.class);
-
- assertThat(listRepr.getValue().size(), is(5));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_refarg_bad.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_refarg_bad.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_refarg_bad.java
deleted file mode 100644
index c93b407..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_refarg_bad.java
+++ /dev/null
@@ -1,126 +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.domainservice.serviceId.action.invoke;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasStatus;
-import static org.hamcrest.CoreMatchers.*;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
-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.ActionResultRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.apache.isis.viewer.restfulobjects.tck.Util;
-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 DomainServiceTest_req_safe_refarg_bad {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- private DomainServiceResource serviceResource;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
- serviceResource = client.getDomainServiceResource();
- }
-
- @Test
- public void usingClientFollow() throws Exception {
-
- // given a reference to a non-existent entity
- LinkRepresentation nonExistentEntityLink = new LinkRepresentation()
- .withHref("http://localhost:39393/objects/NONEXISTENT/123");
-
- // and given a representation of the 'contains' action accepting a entity href
- final JsonRepresentation containsAction = Util.givenAction(client, "ActionsEntities", "contains");
- final ObjectActionRepresentation containsActionRepr = containsAction.as(ObjectActionRepresentation.class);
-
- final LinkRepresentation invokeLink = containsActionRepr.getInvoke();
- final JsonRepresentation args = invokeLink.getArguments();
-
- // when query the 'contains' action passing in the reference to the non-existent entity
- args.mapPut("searchFor.value", nonExistentEntityLink);
- args.mapPut("from.value", 0);
- args.mapPut("to.value", 1);
-
- RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
-
- // then
- then(args, restfulResponse);
- }
-
- @Test
- public void usingResourceProxy() throws Exception {
-
- // given a reference to a non-existent entity
- LinkRepresentation nonExistentEntityLink = new LinkRepresentation()
- .withHref("http://localhost:39393/objects/NONEXISTENT/123");
-
- // when query the 'contains' action passing in the reference to the non-existent entity
- JsonRepresentation args = JsonRepresentation.newMap();
- args.mapPut("searchFor.value", nonExistentEntityLink);
- args.mapPut("from.value", 0);
- args.mapPut("to.value", 3);
- Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "contains", UrlEncodingUtils.urlEncode(args));
- RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
-
- // then
- then(args, restfulResponse);
- }
-
- private static void then(final JsonRepresentation args, RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
- // then the response is an error
- assertThat(restfulResponse, hasStatus(HttpStatusCode.VALIDATION_FAILED));
- assertThat(restfulResponse.getHeader(Header.WARNING), is("Validation failed, see body for details"));
-
- // hmmm... what is the media type, though? the spec doesn't say. testing for a generic one.
- assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(MediaType.APPLICATION_JSON));
-
- RestfulResponse<JsonRepresentation> restfulResponseOfError = restfulResponse.wraps(JsonRepresentation.class);
- JsonRepresentation repr = restfulResponseOfError.getEntity();
-
- assertThat(repr.getString("searchFor.value.href"), is(args.getString("searchFor.value.href")));
- assertThat(repr.getString("searchFor.invalidReason"), is("'href' does not reference a known entity"));
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_refarg_resp_scalar.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_refarg_resp_scalar.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_refarg_resp_scalar.java
deleted file mode 100644
index d707510..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_refarg_resp_scalar.java
+++ /dev/null
@@ -1,172 +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.domainservice.serviceId.action.invoke;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
-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.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.RestfulMediaType;
-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.ActionResultRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ActionResultRepresentation.ResultType;
-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.domainobjects.ObjectActionRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ScalarValueRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.apache.isis.viewer.restfulobjects.tck.Util;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.hamcrest.Matchers;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class DomainServiceTest_req_safe_refarg_resp_scalar {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
- private DomainServiceResource serviceResource;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
-
- serviceResource = client.getDomainServiceResource();
- }
-
- @Test
- public void usingClientFollow() throws Exception {
-
- // given a reference to the first entity
- final ListRepresentation subListRepr = givenSublistActionInvoked(0, 1);
- assertThat(subListRepr.getValue().size(), is(1));
-
- LinkRepresentation firstEntityLink = subListRepr.getValue().arrayGet(0).asLink();
-
- // and given a representation of the 'contains' action accepting a entity href
- final JsonRepresentation containsAction = Util.givenAction(client, "ActionsEntities", "contains");
- final ObjectActionRepresentation containsActionRepr = containsAction.as(ObjectActionRepresentation.class);
-
- final LinkRepresentation invokeLink = containsActionRepr.getInvoke();
- final JsonRepresentation args = invokeLink.getArguments();
- assertThat(args.size(), is(3));
-
- // when query the 'contains' action passing in the entity
- // (for a range where the entity is contained in the range)
- args.mapPut("searchFor.value", firstEntityLink);
- args.mapPut("from.value", 0);
- args.mapPut("to.value", 3);
-
- RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
-
- // then
- thenResponseIsScalarValueOf(restfulResponse, true);
-
-
- // and when query the 'contains' action for a different range which does not
- // contain the entity
- args.mapPut("searchFor.value", firstEntityLink);
- args.mapPut("from.value", 3);
- args.mapPut("to.values", 5);
-
- restfulResponse = client.followT(invokeLink, args);
-
- // then
- thenResponseIsScalarValueOf(restfulResponse, false);
- }
-
-
-
- @Test
- public void usingResourceProxy() throws Exception {
-
- // given a reference to the first entity
- final ListRepresentation subListRepr = givenSublistActionInvoked(0, 1);
- LinkRepresentation firstEntityLink = subListRepr.getValue().arrayGet(0).asLink();
-
- // when query the 'contains' action passing in the entity
- // (for a range where the entity is contained in the range)
- JsonRepresentation args = JsonRepresentation.newMap();
- args.mapPut("searchFor.value", firstEntityLink);
- args.mapPut("from.value", 0);
- args.mapPut("to.value", 3);
- Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "contains", UrlEncodingUtils.urlEncode(args));
- RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
-
- // then
- thenResponseIsScalarValueOf(restfulResponse, true);
- }
-
- private void thenResponseIsScalarValueOf(RestfulResponse<ActionResultRepresentation> restfulResponse, boolean value) throws JsonParseException, JsonMappingException, IOException {
- assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(RestfulMediaType.APPLICATION_JSON_ACTION_RESULT));
- ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
- assertThat(actionResultRepr.getResultType(), is(ResultType.SCALAR_VALUE));
- JsonRepresentation resultRepr = actionResultRepr.getResult();
- assertThat(resultRepr, is(not(nullValue())));
-
- ScalarValueRepresentation scalarValueRepr = resultRepr.as(ScalarValueRepresentation.class);
-
- LinkRepresentation returnTypeLink = scalarValueRepr.getLinkWithRel(Rel.RETURN_TYPE);
- assertThat(returnTypeLink, is(not(nullValue())));
- assertThat(returnTypeLink, isLink(client)
- .rel(Rel.RETURN_TYPE)
- .href(Matchers.endsWith(":39393/domain-types/boolean"))
- .returning(HttpStatusCode.OK)
- .build());
-
- assertThat(scalarValueRepr.getValue().asBoolean(), is(value));
- }
-
-
- private ListRepresentation givenSublistActionInvoked(int from, int to) throws Exception {
- final JsonRepresentation givenSubListAction = Util.givenAction(client, "ActionsEntities", "subList");
- final ObjectActionRepresentation actionRepr = givenSubListAction.as(ObjectActionRepresentation.class);
-
- final LinkRepresentation invokeLink = actionRepr.getInvoke();
- final JsonRepresentation args = invokeLink.getArguments();
-
- // when
- args.mapPut("from.value", from);
- args.mapPut("to.value", to);
-
- final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
-
- final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
- return actionResultRepr.getResult().as(ListRepresentation.class);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_simplearg_fail_all_args_validation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_simplearg_fail_all_args_validation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_simplearg_fail_all_args_validation.java
deleted file mode 100644
index 93ab7b1..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_simplearg_fail_all_args_validation.java
+++ /dev/null
@@ -1,133 +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.domainservice.serviceId.action.invoke;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasStatus;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-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.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulMediaType;
-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.ActionResultRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ActionResultRepresentation.ResultType;
-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.domainobjects.ObjectActionRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers;
-import org.apache.isis.viewer.restfulobjects.tck.Util;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.hamcrest.Matchers;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class DomainServiceTest_req_safe_simplearg_fail_all_args_validation {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- private DomainServiceResource serviceResource;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
-
- serviceResource = client.getDomainServiceResource();
- }
-
- @Test
- public void usingClientFollow() throws Exception {
-
- // given
- final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subList");
- final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
-
- final LinkRepresentation invokeLink = actionRepr.getInvoke();
-
- assertThat(invokeLink, isLink(client)
- .rel(Rel.INVOKE)
- .httpMethod(RestfulHttpMethod.GET)
- .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subList/invoke"))
- .build());
-
- JsonRepresentation args =invokeLink.getArguments();
- assertThat(args.size(), is(2));
- assertThat(args, RestfulMatchers.mapHas("from"));
- assertThat(args, RestfulMatchers.mapHas("to"));
-
- // when
- args.mapPut("from.value", 1);
- args.mapPut("to.value", 0);
-
- final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
-
- // then
- thenResponseIsErrorWithInvalidReason(restfulResponse);
- }
-
- @Test
- public void usingResourceProxy() throws Exception {
-
- // given, when
- JsonRepresentation args = JsonRepresentation.newMap();
- args.mapPut("from.value", 1);
- args.mapPut("to.value", 0);
- Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "subList", UrlEncodingUtils.urlEncode(args));
- RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
-
- // then
- thenResponseIsErrorWithInvalidReason(restfulResponse);
- }
-
- private static void thenResponseIsErrorWithInvalidReason(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
- assertThat(restfulResponse, hasStatus(HttpStatusCode.VALIDATION_FAILED));
- assertThat(restfulResponse.getHeader(Header.WARNING), is("Validation failed, see body for details"));
-
- // hmmm... what is the media type, though? the spec doesn't say. testing for a generic one.
- assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(MediaType.APPLICATION_JSON));
-
- RestfulResponse<JsonRepresentation> restfulResponseOfError = restfulResponse.wraps(JsonRepresentation.class);
- JsonRepresentation repr = restfulResponseOfError.getEntity();
-
- assertThat(repr.getString("x-ro-invalidReason"), is("'from' cannot be larger than 'to'"));
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_simplearg_fail_individual_arg_validation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_simplearg_fail_individual_arg_validation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_simplearg_fail_individual_arg_validation.java
deleted file mode 100644
index 7393abb..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_simplearg_fail_individual_arg_validation.java
+++ /dev/null
@@ -1,134 +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.domainservice.serviceId.action.invoke;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasStatus;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
-import static org.hamcrest.CoreMatchers.*;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-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.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulMediaType;
-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.ActionResultRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ActionResultRepresentation.ResultType;
-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.domainobjects.ObjectActionRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers;
-import org.apache.isis.viewer.restfulobjects.tck.Util;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.hamcrest.Matchers;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class DomainServiceTest_req_safe_simplearg_fail_individual_arg_validation {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- private DomainServiceResource serviceResource;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
-
- serviceResource = client.getDomainServiceResource();
- }
-
- @Test
- public void usingClientFollow() throws Exception {
-
- // given
- final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subList");
- final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
-
- final LinkRepresentation invokeLink = actionRepr.getInvoke();
-
- assertThat(invokeLink, isLink(client)
- .rel(Rel.INVOKE)
- .httpMethod(RestfulHttpMethod.GET)
- .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subList/invoke"))
- .build());
-
- JsonRepresentation args =invokeLink.getArguments();
- assertThat(args.size(), is(2));
- assertThat(args, RestfulMatchers.mapHas("from"));
- assertThat(args, RestfulMatchers.mapHas("to"));
-
- // when
- args.mapPut("from.value", -1);
- args.mapPut("to.value", 2);
-
- final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
-
- // then
- thenResponseIsAValidationError(restfulResponse);
- }
-
-
- @Test
- public void usingResourceProxy() throws Exception {
-
- // given, when
- JsonRepresentation args = JsonRepresentation.newMap();
- args.mapPut("from.value", -1);
- args.mapPut("to.value", 2);
- Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "subList", UrlEncodingUtils.urlEncode(args));
- RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
-
- // then
- thenResponseIsAValidationError(restfulResponse);
- }
-
- private static void thenResponseIsAValidationError(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
- assertThat(restfulResponse, hasStatus(HttpStatusCode.VALIDATION_FAILED));
-
- assertThat(restfulResponse.getHeader(Header.WARNING), containsString("Validation failed, see body for details"));
-
- // hmmm... what is the media type, though? the spec doesn't say. testing for a generic one.
- assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(MediaType.APPLICATION_JSON));
-
- RestfulResponse<JsonRepresentation> restfulResponseOfError = restfulResponse.wraps(JsonRepresentation.class);
- JsonRepresentation repr = restfulResponseOfError.getEntity();
-
- assertThat(repr.getString("from.invalidReason"), is("Cannot be less than zero"));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_simplearg_fail_mandatory_missing.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_simplearg_fail_mandatory_missing.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_simplearg_fail_mandatory_missing.java
deleted file mode 100644
index 81af0c1..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_simplearg_fail_mandatory_missing.java
+++ /dev/null
@@ -1,133 +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.domainservice.serviceId.action.invoke;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasStatus;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.hamcrest.Matchers;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-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.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.domainobjects.ActionResultRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers;
-import org.apache.isis.viewer.restfulobjects.tck.Util;
-
-public class DomainServiceTest_req_safe_simplearg_fail_mandatory_missing {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- private DomainServiceResource serviceResource;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
-
- serviceResource = client.getDomainServiceResource();
- }
-
- @Test
- public void usingClientFollow() throws Exception {
-
- // given
- final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subList");
- final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
-
- final LinkRepresentation invokeLink = actionRepr.getInvoke();
-
- assertThat(invokeLink, isLink(client)
- .rel(Rel.INVOKE)
- .httpMethod(RestfulHttpMethod.GET)
- .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subList/invoke"))
- .build());
-
- JsonRepresentation args =invokeLink.getArguments();
- assertThat(args.size(), is(2));
- assertThat(args, RestfulMatchers.mapHas("from"));
- assertThat(args, RestfulMatchers.mapHas("to"));
-
- // when
- args = JsonRepresentation.newMap();
- // nothing for 'from'
- args.mapPut("to.value", 0);
- assertThat(args.size(), is(1));
-
- final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
-
- // then
- thenResponseIsErrorWithInvalidReason(restfulResponse);
- }
-
-
- @Test
- public void usingResourceProxy() throws Exception {
-
- // given, when
- JsonRepresentation args = JsonRepresentation.newMap();
- // nothing for 'from'
- args.mapPut("to.value", 0);
- Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "subList", UrlEncodingUtils.urlEncode(args));
- RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
-
- // then
- thenResponseIsErrorWithInvalidReason(restfulResponse);
- }
-
- private static void thenResponseIsErrorWithInvalidReason(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
- assertThat(restfulResponse, hasStatus(HttpStatusCode.BAD_REQUEST));
- assertThat(restfulResponse.getHeader(Header.WARNING), is("No argument found for (mandatory) parameter 'from'"));
-
- // hmmm... what is the media type, though? the spec doesn't say. testing for a generic one.
- assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(MediaType.APPLICATION_JSON));
-
- RestfulResponse<JsonRepresentation> restfulResponseOfError = restfulResponse.wraps(JsonRepresentation.class);
- JsonRepresentation repr = restfulResponseOfError.getEntity();
-
- assertThat(repr.getString("x-ro-invalidReason"), is("No argument found for (mandatory) parameter 'from'"));
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_simplearg_fail_mandatory_value_null.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_simplearg_fail_mandatory_value_null.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_simplearg_fail_mandatory_value_null.java
deleted file mode 100644
index 5408be2..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_simplearg_fail_mandatory_value_null.java
+++ /dev/null
@@ -1,133 +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.domainservice.serviceId.action.invoke;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasStatus;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.hamcrest.Matchers;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-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.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.domainobjects.ActionResultRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers;
-import org.apache.isis.viewer.restfulobjects.tck.Util;
-
-public class DomainServiceTest_req_safe_simplearg_fail_mandatory_value_null {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- private DomainServiceResource serviceResource;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
-
- serviceResource = client.getDomainServiceResource();
- }
-
- @Test
- public void usingClientFollow() throws Exception {
-
- // given
- final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subList");
- final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
-
- final LinkRepresentation invokeLink = actionRepr.getInvoke();
-
- assertThat(invokeLink, isLink(client)
- .rel(Rel.INVOKE)
- .httpMethod(RestfulHttpMethod.GET)
- .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subList/invoke"))
- .build());
-
- JsonRepresentation args =invokeLink.getArguments();
- assertThat(args.size(), is(2));
- assertThat(args, RestfulMatchers.mapHas("from"));
- assertThat(args, RestfulMatchers.mapHas("to"));
-
- // when
- args.mapPut("from.value", (Integer)null);
- args.mapPut("to.value", 0);
-
- final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
-
- // then
- thenResponseIsErrorWithInvalidReason(restfulResponse);
- }
-
-
- @Test
- public void usingResourceProxy() throws Exception {
-
- // given, when
- JsonRepresentation args = JsonRepresentation.newMap();
- args.mapPut("from.value", (Integer)null);
- args.mapPut("to.value", 0);
- Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "subList", UrlEncodingUtils.urlEncode(args));
- RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
-
- // then
- thenResponseIsErrorWithInvalidReason(restfulResponse);
- }
-
- private static void thenResponseIsErrorWithInvalidReason(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
- assertThat(restfulResponse, hasStatus(HttpStatusCode.VALIDATION_FAILED));
- assertThat(restfulResponse.getHeader(Header.WARNING), is("Validation failed, see body for details"));
-
- // hmmm... what is the media type, though? the spec doesn't say. testing for a generic one.
- assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(MediaType.APPLICATION_JSON));
-
- RestfulResponse<JsonRepresentation> restfulResponseOfError = restfulResponse.wraps(JsonRepresentation.class);
- JsonRepresentation repr = restfulResponseOfError.getEntity();
-
- assertThat(repr.getString("from.invalidReason"), is("Mandatory"));
- // TODO: really ought to be null, but ObjectActionImpl.isProposedArgumentSetValidResultSet also checks that each argument is valid
- assertThat(repr.getString("x-ro-invalidReason"), is("Mandatory"));
- }
-
-
-
-}
[5/9] ISIS-233: adding new test stubs (TODOs)
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_whenQueryArg_xRoFollowLinks_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_whenQueryArg_xRoFollowLinks_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_whenQueryArg_xRoFollowLinks_ok.java
new file mode 100644
index 0000000..d3e8cc8
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_whenQueryArg_xRoFollowLinks_ok.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.root;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isArray;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.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 Get_whenQueryArg_xRoFollowLinks_ok {
+
+ @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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java
new file mode 100644
index 0000000..483b234
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainservice.root;
+
+public class Get_whenRequestHeaders_Accept_isInvalid_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_whenRequestHeaders_Accept_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_whenRequestHeaders_Accept_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_whenRequestHeaders_Accept_ok.java
new file mode 100644
index 0000000..8120709
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_whenRequestHeaders_Accept_ok.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.root;
+
+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 Get_whenRequestHeaders_Accept_ok {
+
+ @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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Delete_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Delete_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Delete_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..922214a
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Delete_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainservice.serviceId;
+
+public class Delete_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_req_header_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_req_header_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_req_header_accept.java
deleted file mode 100644
index a4b4a80..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_req_header_accept.java
+++ /dev/null
@@ -1,111 +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.domainservice.serviceId;
-
-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.apache.isis.viewer.restfulobjects.tck.Util;
-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 DomainServiceTest_req_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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_req_queryarg_xrodomainmodel.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_req_queryarg_xrodomainmodel.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_req_queryarg_xrodomainmodel.java
deleted file mode 100644
index cc95598..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_req_queryarg_xrodomainmodel.java
+++ /dev/null
@@ -1,76 +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.domainservice.serviceId;
-
-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.apache.isis.viewer.restfulobjects.tck.Util;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class DomainServiceTest_req_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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_req_queryarg_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_req_queryarg_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_req_queryarg_xrofollowlinks.java
deleted file mode 100644
index 238e04c..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_req_queryarg_xrofollowlinks.java
+++ /dev/null
@@ -1,169 +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.domainservice.serviceId;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.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.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.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.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.apache.isis.viewer.restfulobjects.tck.Util;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.*;
-
-public class DomainServiceTest_req_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());
- }
-
- @Test
- public void self() throws Exception {
- final String href = givenHrefToService("WrapperValuedEntities");
-
- final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, href).withArg(RequestParameter.FOLLOW_LINKS, "links[rel=self]");
- final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- final DomainObjectRepresentation repr = restfulResponse.getEntity();
-
- assertThat(repr.getSelf().getValue(), is(not(nullValue())));
- }
-
- @Test
- public void toDescribedBy() throws Exception {
- final String href = givenHrefToService("WrapperValuedEntities");
-
- final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, href).withArg(RequestParameter.FOLLOW_LINKS, "links[rel=describedby]");
- final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- final DomainObjectRepresentation repr = restfulResponse.getEntity();
-
- assertThat(repr.getLinkWithRel(Rel.DESCRIBEDBY).getValue(), is(not(nullValue())));
- }
-
- @Test
- public void toMembersDetails() throws Exception {
- final String href = givenHrefToService("WrapperValuedEntities");
-
- final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, href).withArg(RequestParameter.FOLLOW_LINKS, "members.links[rel=%s]", Rel.DETAILS.getName());
- final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- final DomainObjectRepresentation repr = restfulResponse.getEntity();
-
- final JsonRepresentation membersList = repr.getMembers();
- assertThat(membersList, isMap());
-
- JsonRepresentation actionRepr;
-
- actionRepr = membersList.getRepresentation("list");
- assertThat(actionRepr.getRepresentation("links[rel="+Rel.DETAILS.getName()+"]"), is(not(nullValue())));
- assertThat(actionRepr.getRepresentation("links[rel="+Rel.DETAILS.getName()+"].value"), is(not(nullValue()))); // followed
-
- actionRepr = membersList.getRepresentation("newEntity");
- assertThat(actionRepr.getRepresentation("links[rel="+Rel.DETAILS.getName()+"]"), is(not(nullValue())));
- assertThat(actionRepr.getRepresentation("links[rel="+Rel.DETAILS.getName()+"].value"), is(not(nullValue()))); // also followed
- }
-
- @Test
- public void singleMember_specified_by_criteria() throws Exception {
-
- final String href = givenHrefToService("WrapperValuedEntities");
-
- final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, href).withArg(RequestParameter.FOLLOW_LINKS, "members[%s].links[rel=%s]", "list", Rel.DETAILS.getName());
- final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- final DomainObjectRepresentation repr = restfulResponse.getEntity();
-
- final JsonRepresentation membersList = repr.getMembers();
- assertThat(membersList, isMap());
-
- JsonRepresentation actionRepr;
-
- actionRepr = membersList.getRepresentation("list");
- assertThat(actionRepr.getRepresentation("links[rel="+Rel.DETAILS.getName()+"]"), is(not(nullValue())));
- assertThat(actionRepr.getRepresentation("links[rel="+Rel.DETAILS.getName()+"].value"), is(not(nullValue()))); // followed
-
- actionRepr = membersList.getRepresentation("newEntity");
- assertThat(actionRepr.getRepresentation("links[rel="+Rel.DETAILS.getName()+"]"), is(not(nullValue())));
- assertThat(actionRepr.getRepresentation("links[rel="+Rel.DETAILS.getName()+"].value"), is(nullValue())); // not followed
- }
-
- @Test
- public void toMultipleMembersDetails() throws Exception {
-
- final String href = givenHrefToService("WrapperValuedEntities");
-
- final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, href).withArg(RequestParameter.FOLLOW_LINKS, "members[%s].links[rel=%s],members[%s].links[rel=%s]", "list", Rel.DETAILS.getName(), "newEntity", Rel.DETAILS.getName());
- final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- final DomainObjectRepresentation repr = restfulResponse.getEntity();
-
- final JsonRepresentation membersList = repr.getMembers();
- assertThat(membersList, isMap());
-
- JsonRepresentation actionRepr;
-
- actionRepr = membersList.getRepresentation("list");
- assertThat(actionRepr.getRepresentation("links[rel="+Rel.DETAILS.getName()+"]"), is(not(nullValue())));
- assertThat(actionRepr.getRepresentation("links[rel="+Rel.DETAILS.getName()+"].value"), is(not(nullValue()))); // followed
-
- actionRepr = membersList.getRepresentation("newEntity");
- assertThat(actionRepr.getRepresentation("links[rel="+Rel.DETAILS.getName()+"]"), is(not(nullValue())));
- assertThat(actionRepr.getRepresentation("links[rel="+Rel.DETAILS.getName()+"].value"), is(not(nullValue()))); // also followed
- }
-
- private String givenHrefToService(final String serviceId) throws JsonParseException, JsonMappingException, IOException {
- return Util.givenHrefToService(client, serviceId);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_resp_headers.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_resp_headers.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_resp_headers.java
deleted file mode 100644
index 60fc1b3..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_resp_headers.java
+++ /dev/null
@@ -1,70 +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.domainservice.serviceId;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.nullValue;
-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 DomainServiceTest_resp_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", "http://localhost:39393/domain-types/JdkValuedEntities")));
- assertThat(jsonResp.getHeader(RestfulResponse.Header.CACHE_CONTROL).getMaxAge(), is(24 * 60 * 60));
- // update spec so this that an ETag is not required for services
- assertThat(jsonResp.getHeader(RestfulResponse.Header.ETAG), is(nullValue()));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_resp_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_resp_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_resp_representation.java
deleted file mode 100644
index f90a799..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_resp_representation.java
+++ /dev/null
@@ -1,201 +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.domainservice.serviceId;
-
-import static org.apache.isis.core.commons.matchers.IsisMatchers.matches;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isMap;
-import static org.hamcrest.CoreMatchers.endsWith;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.Response;
-
-import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
-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.DomainObjectMemberRepresentation;
-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.hamcrest.Matchers;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class DomainServiceTest_resp_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();
- }
-
- @Test
- public void representation() throws Exception {
-
- // given
- final Response resp = resource.service("JdkValuedEntities");
-
- // 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.getTitle(), matches("JdkValuedEntities"));
-
- assertThat(repr.getDomainType(), is(nullValue()));
- assertThat(repr.getInstanceId(), is(nullValue()));
-
- assertThat(repr.getServiceId(), is("JdkValuedEntities"));
-
- assertThat(repr.getSelf(), isLink().httpMethod(RestfulHttpMethod.GET));
-
- assertThat(repr.getMembers(), isMap());
- assertThat(repr.getMembers().size(), is(2));
- DomainObjectMemberRepresentation listMemberRepr = repr.getAction("list");
-
- assertThat(listMemberRepr.getMemberType(), is("action"));
- assertThat(listMemberRepr.getDisabledReason(), is(nullValue()));
- assertThat(listMemberRepr.getLinks(), isArray());
- assertThat(listMemberRepr.getLinks().size(), is(1));
-
- LinkRepresentation listMemberReprDetailsLink = listMemberRepr.getLinkWithRel(Rel.DETAILS);
- assertThat(listMemberReprDetailsLink, isLink(client)
- .httpMethod(RestfulHttpMethod.GET)
- .href(endsWith("/services/JdkValuedEntities/actions/list"))
- .returning(HttpStatusCode.OK)
- .responseEntityWithSelfHref(listMemberReprDetailsLink.getHref()));
-
-
- assertThat(repr.getLinks(), isArray());
- assertThat(repr.getLinks().size(), is(2));
-
- // link to self (see above)
- // link to describedby
- LinkRepresentation describedByLink = repr.getLinkWithRel(Rel.DESCRIBEDBY);
- assertThat(describedByLink, isLink(client)
- .httpMethod(RestfulHttpMethod.GET)
- .href(endsWith("/domain-types/JdkValuedEntities"))
- );
- assertThat(describedByLink, isLink(client)
- .returning(HttpStatusCode.OK)
- .responseEntityWithSelfHref(describedByLink.getHref()));
-
- assertThat(repr.getLinkWithRel(Rel.PERSIST), is(nullValue()));
- assertThat(repr.getLinkWithRel(Rel.UPDATE), is(nullValue()));
- assertThat(repr.getLinkWithRel(Rel.DELETE), is(nullValue()));
-
- assertThat(repr.getExtensions(), isMap());
- assertThat(repr.getOid(), matches("JdkValuedEntities:2"));
- }
-
-
-
- @Test
- public void visibleAndInvocableAction() throws Exception {
-
- // given
- final Response resp = resource.service("BusinessRulesEntities");
-
- // when
- final RestfulResponse<DomainObjectRepresentation> jsonResp = RestfulResponse.ofT(resp);
-
- // then
- assertThat(jsonResp.getStatus(), is(HttpStatusCode.OK));
- final DomainObjectRepresentation repr = jsonResp.getEntity();
-
- assertThat(repr, isMap());
-
- final DomainObjectMemberRepresentation actionRepr = repr.getAction("visibleAndInvocableAction");
- assertThat(actionRepr, isMap());
-
- assertThat(actionRepr.getDisabledReason(), is(nullValue()));
-
- final LinkRepresentation actionDetailsLink = actionRepr.getLinkWithRel(Rel.DETAILS);
- assertThat(actionDetailsLink, isLink(this.client)
- .rel(Rel.DETAILS)
- .httpMethod(RestfulHttpMethod.GET)
- .href(Matchers.endsWith(":39393/services/BusinessRulesEntities/actions/visibleAndInvocableAction"))
- .returning(HttpStatusCode.OK));
- }
-
-
- @Test
- public void visibleButNotInvocableAction() throws Exception {
-
- // given
- final Response resp = resource.service("BusinessRulesEntities");
-
- // when
- final RestfulResponse<DomainObjectRepresentation> jsonResp = RestfulResponse.ofT(resp);
-
- // then
- assertThat(jsonResp.getStatus(), is(HttpStatusCode.OK));
- final DomainObjectRepresentation repr = jsonResp.getEntity();
-
- final DomainObjectMemberRepresentation actionRepr = repr.getAction("visibleButNotInvocableAction");
- assertThat(actionRepr, isMap());
-
- assertThat(actionRepr.getDisabledReason(), is("Always disabled"));
-
- final LinkRepresentation actionDetailsLink = actionRepr.getLinkWithRel(Rel.DETAILS);
-
- // even though not invocable, still can traverse to its details page
- assertThat(actionDetailsLink, isLink(this.client)
- .href(Matchers.endsWith(":39393/services/BusinessRulesEntities/actions/visibleButNotInvocableAction"))
- .returning(HttpStatusCode.OK));
- }
-
- @Test
- public void invisibleAction() throws Exception {
-
- // given
- final Response resp = resource.service("BusinessRulesEntities");
-
- // when
- final RestfulResponse<DomainObjectRepresentation> jsonResp = RestfulResponse.ofT(resp);
-
- // then
- assertThat(jsonResp.getStatus(), is(HttpStatusCode.OK));
- final DomainObjectRepresentation repr = jsonResp.getEntity();
-
- assertThat(repr.getAction("invisibleAction"), is(nullValue()));
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_when_notFound.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_when_notFound.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_when_notFound.java
deleted file mode 100644
index 6f43799..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_when_notFound.java
+++ /dev/null
@@ -1,70 +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.domainservice.serviceId;
-
-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 DomainServiceTest_when_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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_ResponseHeaders_CacheControl_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_ResponseHeaders_CacheControl_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_ResponseHeaders_CacheControl_ok.java
new file mode 100644
index 0000000..22e464e
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_ResponseHeaders_CacheControl_ok.java
@@ -0,0 +1,63 @@
+/*
+ * 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.serviceId;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.Response;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+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.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+public class Get_ResponseHeaders_CacheControl_ok {
+
+ @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 ok() throws Exception {
+ // given
+ final Response resp = resource.service("JdkValuedEntities");
+
+ // when
+ final RestfulResponse<DomainObjectRepresentation> jsonResp = RestfulResponse.ofT(resp);
+
+ // then
+ assertThat(jsonResp.getHeader(RestfulResponse.Header.CACHE_CONTROL).getMaxAge(), is(24 * 60 * 60));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_thenRepresentation_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_thenRepresentation_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_thenRepresentation_ok.java
new file mode 100644
index 0000000..bdb63b0
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_thenRepresentation_ok.java
@@ -0,0 +1,201 @@
+/*
+ * 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.serviceId;
+
+import static org.apache.isis.core.commons.matchers.IsisMatchers.matches;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isArray;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isMap;
+import static org.hamcrest.CoreMatchers.endsWith;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.Response;
+
+import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
+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.DomainObjectMemberRepresentation;
+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.hamcrest.Matchers;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class Get_thenRepresentation_ok {
+
+ @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 representation() throws Exception {
+
+ // given
+ final Response resp = resource.service("JdkValuedEntities");
+
+ // 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.getTitle(), matches("JdkValuedEntities"));
+
+ assertThat(repr.getDomainType(), is(nullValue()));
+ assertThat(repr.getInstanceId(), is(nullValue()));
+
+ assertThat(repr.getServiceId(), is("JdkValuedEntities"));
+
+ assertThat(repr.getSelf(), isLink().httpMethod(RestfulHttpMethod.GET));
+
+ assertThat(repr.getMembers(), isMap());
+ assertThat(repr.getMembers().size(), is(2));
+ DomainObjectMemberRepresentation listMemberRepr = repr.getAction("list");
+
+ assertThat(listMemberRepr.getMemberType(), is("action"));
+ assertThat(listMemberRepr.getDisabledReason(), is(nullValue()));
+ assertThat(listMemberRepr.getLinks(), isArray());
+ assertThat(listMemberRepr.getLinks().size(), is(1));
+
+ LinkRepresentation listMemberReprDetailsLink = listMemberRepr.getLinkWithRel(Rel.DETAILS);
+ assertThat(listMemberReprDetailsLink, isLink(client)
+ .httpMethod(RestfulHttpMethod.GET)
+ .href(endsWith("/services/JdkValuedEntities/actions/list"))
+ .returning(HttpStatusCode.OK)
+ .responseEntityWithSelfHref(listMemberReprDetailsLink.getHref()));
+
+
+ assertThat(repr.getLinks(), isArray());
+ assertThat(repr.getLinks().size(), is(2));
+
+ // link to self (see above)
+ // link to describedby
+ LinkRepresentation describedByLink = repr.getLinkWithRel(Rel.DESCRIBEDBY);
+ assertThat(describedByLink, isLink(client)
+ .httpMethod(RestfulHttpMethod.GET)
+ .href(endsWith("/domain-types/JdkValuedEntities"))
+ );
+ assertThat(describedByLink, isLink(client)
+ .returning(HttpStatusCode.OK)
+ .responseEntityWithSelfHref(describedByLink.getHref()));
+
+ assertThat(repr.getLinkWithRel(Rel.PERSIST), is(nullValue()));
+ assertThat(repr.getLinkWithRel(Rel.UPDATE), is(nullValue()));
+ assertThat(repr.getLinkWithRel(Rel.DELETE), is(nullValue()));
+
+ assertThat(repr.getExtensions(), isMap());
+ assertThat(repr.getOid(), matches("JdkValuedEntities:2"));
+ }
+
+
+
+ @Test
+ public void visibleAndInvocableAction() throws Exception {
+
+ // given
+ final Response resp = resource.service("BusinessRulesEntities");
+
+ // when
+ final RestfulResponse<DomainObjectRepresentation> jsonResp = RestfulResponse.ofT(resp);
+
+ // then
+ assertThat(jsonResp.getStatus(), is(HttpStatusCode.OK));
+ final DomainObjectRepresentation repr = jsonResp.getEntity();
+
+ assertThat(repr, isMap());
+
+ final DomainObjectMemberRepresentation actionRepr = repr.getAction("visibleAndInvocableAction");
+ assertThat(actionRepr, isMap());
+
+ assertThat(actionRepr.getDisabledReason(), is(nullValue()));
+
+ final LinkRepresentation actionDetailsLink = actionRepr.getLinkWithRel(Rel.DETAILS);
+ assertThat(actionDetailsLink, isLink(this.client)
+ .rel(Rel.DETAILS)
+ .httpMethod(RestfulHttpMethod.GET)
+ .href(Matchers.endsWith(":39393/services/BusinessRulesEntities/actions/visibleAndInvocableAction"))
+ .returning(HttpStatusCode.OK));
+ }
+
+
+ @Test
+ public void visibleButNotInvocableAction() throws Exception {
+
+ // given
+ final Response resp = resource.service("BusinessRulesEntities");
+
+ // when
+ final RestfulResponse<DomainObjectRepresentation> jsonResp = RestfulResponse.ofT(resp);
+
+ // then
+ assertThat(jsonResp.getStatus(), is(HttpStatusCode.OK));
+ final DomainObjectRepresentation repr = jsonResp.getEntity();
+
+ final DomainObjectMemberRepresentation actionRepr = repr.getAction("visibleButNotInvocableAction");
+ assertThat(actionRepr, isMap());
+
+ assertThat(actionRepr.getDisabledReason(), is("Always disabled"));
+
+ final LinkRepresentation actionDetailsLink = actionRepr.getLinkWithRel(Rel.DETAILS);
+
+ // even though not invocable, still can traverse to its details page
+ assertThat(actionDetailsLink, isLink(this.client)
+ .href(Matchers.endsWith(":39393/services/BusinessRulesEntities/actions/visibleButNotInvocableAction"))
+ .returning(HttpStatusCode.OK));
+ }
+
+ @Test
+ public void invisibleAction() throws Exception {
+
+ // given
+ final Response resp = resource.service("BusinessRulesEntities");
+
+ // when
+ final RestfulResponse<DomainObjectRepresentation> jsonResp = RestfulResponse.ofT(resp);
+
+ // then
+ assertThat(jsonResp.getStatus(), is(HttpStatusCode.OK));
+ final DomainObjectRepresentation repr = jsonResp.getEntity();
+
+ assertThat(repr.getAction("invisibleAction"), is(nullValue()));
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_thenResponseCode_200_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_thenResponseCode_200_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_thenResponseCode_200_ok.java
new file mode 100644
index 0000000..a46145d
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_thenResponseCode_200_ok.java
@@ -0,0 +1,64 @@
+/*
+ * 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.serviceId;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.Response;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+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;
+
+public class Get_thenResponseCode_200_ok {
+
+ @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 ok() throws Exception {
+ // given
+ final Response resp = resource.service("JdkValuedEntities");
+
+ // when
+ final RestfulResponse<DomainObjectRepresentation> jsonResp = RestfulResponse.ofT(resp);
+
+ // then
+ assertThat(jsonResp.getStatus(), is(HttpStatusCode.OK));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_thenResponseHeaders_ContentType_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_thenResponseHeaders_ContentType_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_thenResponseHeaders_ContentType_ok.java
new file mode 100644
index 0000000..85859b6
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_thenResponseHeaders_ContentType_ok.java
@@ -0,0 +1,64 @@
+/*
+ * 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.serviceId;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.Response;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+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.domainobjects.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+public class Get_thenResponseHeaders_ContentType_ok {
+
+ @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 ok() throws Exception {
+ // given
+ final Response resp = resource.service("JdkValuedEntities");
+
+ // when
+ final RestfulResponse<DomainObjectRepresentation> jsonResp = RestfulResponse.ofT(resp);
+
+ // then
+ assertThat(jsonResp.getHeader(RestfulResponse.Header.CONTENT_TYPE), is(RepresentationType.DOMAIN_OBJECT.getMediaType("x-ro-domain-type", "http://localhost:39393/domain-types/JdkValuedEntities")));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_thenResponseHeaders_Etag_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_thenResponseHeaders_Etag_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_thenResponseHeaders_Etag_ok.java
new file mode 100644
index 0000000..bfc6fc7
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_thenResponseHeaders_Etag_ok.java
@@ -0,0 +1,65 @@
+/*
+ * 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.serviceId;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.Response;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+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.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+public class Get_thenResponseHeaders_Etag_ok {
+
+ @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 ok() throws Exception {
+ // given
+ final Response resp = resource.service("JdkValuedEntities");
+
+ // when
+ final RestfulResponse<DomainObjectRepresentation> jsonResp = RestfulResponse.ofT(resp);
+
+ // then
+ // TOFIX: ROSPEC: update spec so this that an ETag is not required for services
+ assertThat(jsonResp.getHeader(RestfulResponse.Header.ETAG), is(nullValue()));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenCallWithWrongHttpMethod_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenCallWithWrongHttpMethod_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenCallWithWrongHttpMethod_bad_TODO.java
new file mode 100644
index 0000000..7b8d2bb
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenCallWithWrongHttpMethod_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainservice.serviceId;
+
+public class Get_whenCallWithWrongHttpMethod_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenNotFound_bad.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenNotFound_bad.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenNotFound_bad.java
new file mode 100644
index 0000000..620fcf3
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenNotFound_bad.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.serviceId;
+
+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 Get_whenNotFound_bad {
+
+ @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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenQueryArg_xRoDomainModel_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenQueryArg_xRoDomainModel_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenQueryArg_xRoDomainModel_ok.java
new file mode 100644
index 0000000..e7d13ce
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenQueryArg_xRoDomainModel_ok.java
@@ -0,0 +1,73 @@
+/*
+ * 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.serviceId;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+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.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+
+public class Get_whenQueryArg_xRoDomainModel_ok {
+
+ @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));
+ }
+
+}
[2/9] ISIS-233: adding new test stubs (TODOs)
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_ok_TODO.java
new file mode 100644
index 0000000..c9d3a89
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_ok_TODO.java
@@ -0,0 +1,13 @@
+package org.apache.isis.viewer.restfulobjects.tck.objectsoftype;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class Post_ok_TODO {
+
+ @Ignore
+ @Test
+ public void todo() throws Exception {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgValid_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgValid_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgValid_ok_TODO.java
new file mode 100644
index 0000000..514f9b4
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgValid_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.objectsoftype;
+
+public class Post_whenArgValid_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgsMalformed_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgsMalformed_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgsMalformed_bad_TODO.java
new file mode 100644
index 0000000..053c76c
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgsMalformed_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.objectsoftype;
+
+public class Post_whenArgsMalformed_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgsMissing_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgsMissing_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgsMissing_bad_TODO.java
new file mode 100644
index 0000000..e3d44f5
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgsMissing_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.objectsoftype;
+
+public class Post_whenArgsMissing_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgsRefNonExistentEntity_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgsRefNonExistentEntity_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgsRefNonExistentEntity_bad_TODO.java
new file mode 100644
index 0000000..14d4307
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgsRefNonExistentEntity_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.objectsoftype;
+
+public class Post_whenArgsRefNonExistentEntity_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Put_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Put_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Put_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..521a125
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Put_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.objectsoftype;
+
+public class Put_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Delete_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Delete_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Delete_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..abab672
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Delete_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.user.root;
+
+public class Delete_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Get_thenRepresentation_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Get_thenRepresentation_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Get_thenRepresentation_ok.java
new file mode 100644
index 0000000..be70a0f
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Get_thenRepresentation_ok.java
@@ -0,0 +1,104 @@
+/*
+ * 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.user.root;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isArray;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.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.user.UserRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.user.UserResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class Get_thenRepresentation_ok {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+ private UserResource resource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+ resource = client.getUserResource();
+ }
+
+ @Test
+ public void representation() throws Exception {
+
+ // given
+ final Response resp = resource.user();
+
+ // when
+ final RestfulResponse<UserRepresentation> jsonResp = RestfulResponse.ofT(resp);
+ assertThat(jsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));
+
+ // then
+ assertThat(jsonResp.getStatus(), is(HttpStatusCode.OK));
+
+ final UserRepresentation repr = jsonResp.getEntity();
+ assertThat(repr, is(not(nullValue())));
+ assertThat(repr.isMap(), is(true));
+
+ assertThat(repr.getSelf(), isLink(client)
+ .rel(Rel.SELF)
+ .href(endsWith(":39393/user"))
+ .httpMethod(RestfulHttpMethod.GET)
+ .type(RepresentationType.USER.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.getUserName(), is(not(nullValue())));
+
+ // TODO: change fixture so populated
+ assertThat(repr.getFriendlyName(), is(nullValue()));
+ assertThat(repr.getEmail(), is(nullValue()));
+ assertThat(repr.getRoles(), is(not(nullValue())));
+
+ assertThat(repr.getLinks(), isArray());
+ assertThat(repr.getExtensions(), isMap());
+ }
+}
+
+
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Get_thenResponseHeaders_CacheControl_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Get_thenResponseHeaders_CacheControl_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Get_thenResponseHeaders_CacheControl_ok.java
new file mode 100644
index 0000000..358cba1
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Get_thenResponseHeaders_CacheControl_ok.java
@@ -0,0 +1,68 @@
+/*
+ * 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.user.root;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasMaxAge;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.CacheControl;
+import javax.ws.rs.core.Response;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+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.user.UserRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.user.UserResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+public class Get_thenResponseHeaders_CacheControl_ok {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+ private UserResource resource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+ resource = client.getUserResource();
+ }
+
+
+ @Test
+ public void ok() throws Exception {
+
+ // given
+ final Response resp = resource.user();
+
+ // when
+ final RestfulResponse<UserRepresentation> restfulResponse = RestfulResponse.ofT(resp);
+
+ // then
+ final CacheControl cacheControl = restfulResponse.getHeader(Header.CACHE_CONTROL);
+ assertThat(cacheControl, hasMaxAge(60 * 60));
+ assertThat(cacheControl.getMaxAge(), is(60 * 60));
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Get_thenResponseHeaders_ContentType_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Get_thenResponseHeaders_ContentType_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Get_thenResponseHeaders_ContentType_ok.java
new file mode 100644
index 0000000..5cf8645
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Get_thenResponseHeaders_ContentType_ok.java
@@ -0,0 +1,73 @@
+/*
+ * 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.user.root;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasParameter;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasSubType;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasType;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+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.user.UserRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.user.UserResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+public class Get_thenResponseHeaders_ContentType_ok {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+ private UserResource resource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+ resource = client.getUserResource();
+ }
+
+
+ @Test
+ public void ok() throws Exception {
+
+ // given
+ final Response resp = resource.user();
+
+ // when
+ final RestfulResponse<UserRepresentation> 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/user"));
+ assertThat(contentType, is(RepresentationType.USER.getMediaType()));
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Get_whenQueryArg_xRoFollowLinks_thenRepresentation_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Get_whenQueryArg_xRoFollowLinks_thenRepresentation_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Get_whenQueryArg_xRoFollowLinks_thenRepresentation_ok.java
new file mode 100644
index 0000000..11792cd
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Get_whenQueryArg_xRoFollowLinks_thenRepresentation_ok.java
@@ -0,0 +1,92 @@
+/*
+ * 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.user.root;
+
+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.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.user.UserRepresentation;
+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 Get_whenQueryArg_xRoFollowLinks_thenRepresentation_ok {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ private RestfulRequest request;
+ private RestfulResponse<UserRepresentation> restfulResponse;
+ private UserRepresentation repr;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+
+ }
+
+ @Test
+ public void noFollow() throws Exception {
+
+ request = client.createRequest(RestfulHttpMethod.GET, "user");
+ 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, "user")
+ .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, "user")
+ .withArg(RequestParameter.FOLLOW_LINKS, "links[rel=" + Rel.UP.getName() + "]");
+ restfulResponse = request.executeT();
+ repr = restfulResponse.getEntity();
+
+ assertThat(repr.getUp().getValue(), is(not(nullValue())));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Post_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Post_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Post_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..25738c9
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Post_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.user.root;
+
+public class Post_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Put_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Put_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Put_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..d731a53
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Put_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.user.root;
+
+public class Put_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/RequestHeaders_accept_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/RequestHeaders_accept_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/RequestHeaders_accept_ok.java
new file mode 100644
index 0000000..78b77ec
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/RequestHeaders_accept_ok.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.user.root;
+
+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.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 RequestHeaders_accept_ok {
+
+ @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, "user");
+ }
+
+ @Test
+ public void applicationJson_noProfile_returns200() throws Exception {
+
+ request.withHeader(RestfulRequest.Header.ACCEPT, MediaType.APPLICATION_JSON_TYPE);
+ final RestfulResponse<UserRepresentation> restfulResponse = request.executeT();
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+ assertThat(restfulResponse.getHeader(RestfulResponse.Header.CONTENT_TYPE), is(RepresentationType.USER.getMediaType()));
+ }
+
+ @Test
+ public void applicationJson_profileUser_returns200() throws Exception {
+
+ request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.USER.getMediaType());
+ final RestfulResponse<UserRepresentation> restfulResponse = request.executeT();
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+ }
+
+ @Test
+ public void missingHeader_returns200() throws Exception {
+
+ final RestfulResponse<UserRepresentation> 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<UserRepresentation> restfulResponse = request.executeT();
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
+ }
+
+ @Test
+ public void incorrectMediaType_returnsNotAcceptable() throws Exception {
+
+ // given
+ final ClientRequest clientRequest = client.getClientRequestFactory().createRelativeRequest("user");
+ 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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/RequestHeaders_accept_whenInvalid_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/RequestHeaders_accept_whenInvalid_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/RequestHeaders_accept_whenInvalid_bad_TODO.java
new file mode 100644
index 0000000..069b08f
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/RequestHeaders_accept_whenInvalid_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.user.root;
+
+public class RequestHeaders_accept_whenInvalid_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/UserTest_req_header_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/UserTest_req_header_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/UserTest_req_header_accept.java
deleted file mode 100644
index 6276557..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/UserTest_req_header_accept.java
+++ /dev/null
@@ -1,105 +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.user.root;
-
-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.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 UserTest_req_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, "user");
- }
-
- @Test
- public void applicationJson_noProfile_returns200() throws Exception {
-
- request.withHeader(RestfulRequest.Header.ACCEPT, MediaType.APPLICATION_JSON_TYPE);
- final RestfulResponse<UserRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- assertThat(restfulResponse.getHeader(RestfulResponse.Header.CONTENT_TYPE), is(RepresentationType.USER.getMediaType()));
- }
-
- @Test
- public void applicationJson_profileUser_returns200() throws Exception {
-
- request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.USER.getMediaType());
- final RestfulResponse<UserRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- }
-
- @Test
- public void missingHeader_returns200() throws Exception {
-
- final RestfulResponse<UserRepresentation> 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<UserRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
- }
-
- @Test
- public void incorrectMediaType_returnsNotAcceptable() throws Exception {
-
- // given
- final ClientRequest clientRequest = client.getClientRequestFactory().createRelativeRequest("user");
- 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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/UserTest_req_queryargs_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/UserTest_req_queryargs_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/UserTest_req_queryargs_xrofollowlinks.java
deleted file mode 100644
index e47b8c9..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/UserTest_req_queryargs_xrofollowlinks.java
+++ /dev/null
@@ -1,92 +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.user.root;
-
-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.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.user.UserRepresentation;
-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 UserTest_req_queryargs_xrofollowlinks {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- private RestfulRequest request;
- private RestfulResponse<UserRepresentation> restfulResponse;
- private UserRepresentation repr;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
-
- }
-
- @Test
- public void noFollow() throws Exception {
-
- request = client.createRequest(RestfulHttpMethod.GET, "user");
- 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, "user")
- .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, "user")
- .withArg(RequestParameter.FOLLOW_LINKS, "links[rel=" + Rel.UP.getName() + "]");
- restfulResponse = request.executeT();
- repr = restfulResponse.getEntity();
-
- assertThat(repr.getUp().getValue(), is(not(nullValue())));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/UserTest_resp_headers.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/UserTest_resp_headers.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/UserTest_resp_headers.java
deleted file mode 100644
index b6894d7..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/UserTest_resp_headers.java
+++ /dev/null
@@ -1,96 +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.user.root;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasMaxAge;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasParameter;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasSubType;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasType;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isFollowableLinkToSelf;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.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.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.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;
-
-public class UserTest_resp_headers {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
- private UserResource resource;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
- resource = client.getUserResource();
- }
-
-
- @Test
- public void contentType_and_cacheControl() throws Exception {
-
- // given
- final Response resp = resource.user();
-
- // when
- final RestfulResponse<UserRepresentation> 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/user"));
- assertThat(contentType, is(RepresentationType.USER.getMediaType()));
-
- // then
- final CacheControl cacheControl = restfulResponse.getHeader(Header.CACHE_CONTROL);
- assertThat(cacheControl, hasMaxAge(60 * 60));
- assertThat(cacheControl.getMaxAge(), is(60 * 60));
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/UserTest_resp_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/UserTest_resp_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/UserTest_resp_representation.java
deleted file mode 100644
index 416acc9..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/UserTest_resp_representation.java
+++ /dev/null
@@ -1,104 +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.user.root;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.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.user.UserRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.user.UserResource;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class UserTest_resp_representation {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
- private UserResource resource;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
- resource = client.getUserResource();
- }
-
- @Test
- public void representation() throws Exception {
-
- // given
- final Response resp = resource.user();
-
- // when
- final RestfulResponse<UserRepresentation> jsonResp = RestfulResponse.ofT(resp);
- assertThat(jsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));
-
- // then
- assertThat(jsonResp.getStatus(), is(HttpStatusCode.OK));
-
- final UserRepresentation repr = jsonResp.getEntity();
- assertThat(repr, is(not(nullValue())));
- assertThat(repr.isMap(), is(true));
-
- assertThat(repr.getSelf(), isLink(client)
- .rel(Rel.SELF)
- .href(endsWith(":39393/user"))
- .httpMethod(RestfulHttpMethod.GET)
- .type(RepresentationType.USER.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.getUserName(), is(not(nullValue())));
-
- // TODO: change fixture so populated
- assertThat(repr.getFriendlyName(), is(nullValue()));
- assertThat(repr.getEmail(), is(nullValue()));
- assertThat(repr.getRoles(), is(not(nullValue())));
-
- assertThat(repr.getLinks(), isArray());
- assertThat(repr.getExtensions(), isMap());
- }
-}
-
-
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Delete_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Delete_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Delete_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..fae193c
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Delete_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.version;
+
+public class Delete_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_thenRepresentation_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_thenRepresentation_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_thenRepresentation_ok.java
new file mode 100644
index 0000000..e2b9276
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_thenRepresentation_ok.java
@@ -0,0 +1,113 @@
+/*
+ * 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.version;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isArray;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.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.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.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.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 Get_thenRepresentation_ok {
+
+ @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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_thenResponseHeaders_CacheControl_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_thenResponseHeaders_CacheControl_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_thenResponseHeaders_CacheControl_ok.java
new file mode 100644
index 0000000..d653b59
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_thenResponseHeaders_CacheControl_ok.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.version;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasMaxAge;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasParameter;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasSubType;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.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 Get_thenResponseHeaders_CacheControl_ok {
+
+ @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 ok() throws Exception {
+ // given
+ final Response resp = resource.version();
+
+ // when
+ final RestfulResponse<VersionRepresentation> restfulResponse = RestfulResponse.ofT(resp);
+
+ // 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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_thenResponseHeaders_ContentType_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_thenResponseHeaders_ContentType_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_thenResponseHeaders_ContentType_ok.java
new file mode 100644
index 0000000..5290709
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_thenResponseHeaders_ContentType_ok.java
@@ -0,0 +1,77 @@
+/*
+ * 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.version;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasMaxAge;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasParameter;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasSubType;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.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 Get_thenResponseHeaders_ContentType_ok {
+
+ @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 ok() 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()));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_whenQueryArg_xRoFollowLinks_thenRepresentation_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_whenQueryArg_xRoFollowLinks_thenRepresentation_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_whenQueryArg_xRoFollowLinks_thenRepresentation_ok.java
new file mode 100644
index 0000000..bceefbf
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_whenQueryArg_xRoFollowLinks_thenRepresentation_ok.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.version;
+
+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 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.version.VersionRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class Get_whenQueryArg_xRoFollowLinks_thenRepresentation_ok {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ private RestfulRequest request;
+ private RestfulResponse<VersionRepresentation> restfulResponse;
+ private VersionRepresentation repr;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+
+ }
+
+ @Test
+ public void noFollow() throws Exception {
+
+ request = client.createRequest(RestfulHttpMethod.GET, "version");
+ 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, "version")
+ .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, "version")
+ .withArg(RequestParameter.FOLLOW_LINKS, "links[rel=" + Rel.UP.getName() + "]");
+ restfulResponse = request.executeT();
+ repr = restfulResponse.getEntity();
+
+ assertThat(repr.getUp().getValue(), is(not(nullValue())));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java
new file mode 100644
index 0000000..a3d5a7c
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.version;
+
+public class Get_whenRequestHeaders_Accept_isInvalid_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_whenRequestHeaders_Accept_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_whenRequestHeaders_Accept_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_whenRequestHeaders_Accept_ok.java
new file mode 100644
index 0000000..8c70f94
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_whenRequestHeaders_Accept_ok.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.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 Get_whenRequestHeaders_Accept_ok {
+
+ @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, "version");
+ }
+
+ @Test
+ public void applicationJson_noProfile_returns200() throws Exception {
+
+ request.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 {
+
+ request.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 {
+
+ final RestfulResponse<VersionRepresentation> 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<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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Post_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Post_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Post_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..40704e7
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Post_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.version;
+
+public class Post_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Put_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Put_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Put_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..029bd5a
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Put_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.version;
+
+public class Put_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionTest_req_header_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionTest_req_header_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionTest_req_header_accept.java
deleted file mode 100644
index cdb445c..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionTest_req_header_accept.java
+++ /dev/null
@@ -1,110 +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.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 VersionTest_req_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, "version");
- }
-
- @Test
- public void applicationJson_noProfile_returns200() throws Exception {
-
- request.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 {
-
- request.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 {
-
- final RestfulResponse<VersionRepresentation> 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<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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionTest_req_queryargs_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionTest_req_queryargs_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionTest_req_queryargs_xrofollowlinks.java
deleted file mode 100644
index 60e5347..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionTest_req_queryargs_xrofollowlinks.java
+++ /dev/null
@@ -1,88 +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.version;
-
-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 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.version.VersionRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class VersionTest_req_queryargs_xrofollowlinks {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- private RestfulRequest request;
- private RestfulResponse<VersionRepresentation> restfulResponse;
- private VersionRepresentation repr;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
-
- }
-
- @Test
- public void noFollow() throws Exception {
-
- request = client.createRequest(RestfulHttpMethod.GET, "version");
- 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, "version")
- .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, "version")
- .withArg(RequestParameter.FOLLOW_LINKS, "links[rel=" + Rel.UP.getName() + "]");
- restfulResponse = request.executeT();
- repr = restfulResponse.getEntity();
-
- assertThat(repr.getUp().getValue(), is(not(nullValue())));
- }
-
-}
[9/9] git commit: ISIS-233: adding new test stubs (TODOs)
Posted by da...@apache.org.
ISIS-233: adding new test stubs (TODOs)
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/ca8a43ee
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/ca8a43ee
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/ca8a43ee
Branch: refs/heads/dan/ISIS-233-ro
Commit: ca8a43ee1f242773e906f4d0bf9fe3a1b1bb89db
Parents: 8210a58
Author: Dan Haywood <da...@apache.org>
Authored: Thu Apr 11 15:36:30 2013 +0100
Committer: Dan Haywood <da...@apache.org>
Committed: Thu Apr 11 15:36:30 2013 +0100
----------------------------------------------------------------------
.../tck/all/stories/UserStoryTest_TOFIX.java | 86 +++
.../restfulobjects/tck/any/NotAuthorized_TODO.java | 51 ++
.../oid/Delete_thenResponseCode_205_bad_TODO.java | 5 +
.../oid/Get_thenRepresentation_ok_TOFIX.java | 408 +++++++++++++++
.../oid/Get_thenResponseCode_200_ok_TODO.java | 5 +
...t_thenResponseHeaders_CacheControl_ok_TODO.java | 61 +++
.../oid/Get_thenResponseHeaders_eTag_ok_TODO.java | 5 +
.../Get_whenQueryArg_xRoFollowLinks_ok_TODO.java | 5 +
...enRequestHeaders_Accept_isInvalid_bad_TODO.java | 5 +
.../oid/Get_whenRequestHeaders_Accept_ok_TODO.java | 5 +
.../oid/Post_thenResponseCode_205_bad_TODO.java | 5 +
.../oid/Put_whenMultiplePropertyUpdate_TODO.java | 5 +
...ZzzTodo_idempotent_fail_method_not_allowed.java | 5 -
...Todo_nonidempotent_fail_method_not_allowed.java | 5 -
.../ZzzTodo_safe_fail_method_not_allowed.java | 5 -
...venEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java | 5 +
...tag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java | 5 +
.../Delete_thenRepresentation_ok_TODO.java | 5 +
...henHrefArgLinkToNonExistentEntity_bad_TODO.java | 5 +
...enHrefArgLinksToEntityInCollection_ok_TODO.java | 5 +
...tityThatExistsButIsNotInCollection_ok_TODO.java | 5 +
.../oid/collection/Delete_whenNoArg_bad_TODO.java | 5 +
.../collection/Get_thenRepresentation_ok_TODO.java | 5 +
...t_thenResponseHeaders_CacheControl_ok_TODO.java | 61 +++
.../oid/collection/Get_whenHrefArg_bad_TODO.java | 5 +
..._whenHrefArg_thenResponseCode_205_bad_TODO.java | 5 +
.../Get_whenQueryArg_xRoFollowLinks_ok_TODO.java | 5 +
...enRequestHeaders_Accept_isInvalid_bad_TODO.java | 5 +
.../Get_whenRequestHeaders_Accept_ok_TODO.java | 5 +
...ollection_whenHrefArgLinksToEntity_ok_TODO.java | 5 +
..._whenHrefArg_thenResponseCode_205_bad_TODO.java | 5 +
.../Post_thenRepresentation_ok_TODO.java | 5 +
.../collection/Post_whenInvalidArg_bad_TODO.java | 5 +
.../oid/collection/Post_whenNoArg_bad_TODO.java | 5 +
...venEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java | 5 +
...tag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java | 5 +
...henHrefArgLinkToNonExistentEntity_bad_TODO.java | 5 +
.../PutOrPost_whenHrefArgValid_ok_TODO.java | 5 +
...llection_whenHrefArgLinksToEntity_bad_TODO.java | 5 +
..._whenHrefArg_thenResponseCode_205_bad_TODO.java | 5 +
.../collection/Put_thenRepresentation_ok_TODO.java | 5 +
.../collection/Put_whenInvalidArg_bad_TODO.java | 5 +
.../oid/collection/Put_whenNoArg_bad_TODO.java | 5 +
.../ZzzTodo_addTo_fail_method_not_allowed.java | 5 -
.../ZzzTodo_details_fail_method_not_allowed.java | 5 -
...ZzzTodo_removeFrom_fail_method_not_allowed.java | 5 -
...venEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java | 5 +
...tag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java | 5 +
.../Delete_thenRepresentation_ok_TODO.java | 5 +
.../oid/property/Delete_whenNoArg_bad_TODO.java | 5 +
.../property/Get_thenRepresentation_ok_TODO.java | 5 +
..._whenHrefArg_thenResponseCode_205_bad_TODO.java | 5 +
.../Get_whenQueryArg_xRoFollowLinks_ok_TODO.java | 5 +
.../Get_whenRequestHeaders_Accept_ok_TODO.java | 5 +
...RequestHeaders_Accept_whenInvalid_bad_TODO.java | 5 +
...t_whenResponseHeaders_CacheControl_ok_TODO.java | 61 +++
.../Post_thenResponseCode_205_bad_TODO.java | 5 +
...venEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java | 5 +
...tag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java | 5 +
.../property/Put_thenRepresentation_ok_TODO.java | 5 +
.../oid/property/Put_whenNoArg_bad_TODO.java | 5 +
.../ZzzTodo_clear_fail_method_not_allowed.java | 5 -
.../ZzzTodo_details_fail_method_not_allowed.java | 5 -
.../ZzzTodo_modify_fail_method_not_allowed.java | 5 -
.../Delete_thenResponseCode_205_bad_TODO.java | 5 +
.../id/action/Get_thenRepresentation_ok_TODO.java | 5 +
...t_thenResponseHeaders_CacheControl_ok_TODO.java | 61 +++
.../Get_whenCallWithWrongHttpMethod_bad_TODO.java | 5 +
.../id/action/Get_whenNotFound_bad.java | 70 +++
.../Get_whenQueryArg_xRoFollowLinks_ok_TODO.java | 5 +
...enRequestHeaders_Accept_isInvalid_bad_TODO.java | 5 +
.../Get_whenRequestHeaders_Accept_ok_TODO.java | 5 +
.../action/Post_thenResponseCode_205_bad_TODO.java | 5 +
.../action/Put_thenResponseCode_205_bad_TODO.java | 5 +
.../Delete_thenResponseCode_205_bad_TODO.java | 5 +
...OfIdempotent_thenResponseCode_205_bad_TODO.java | 112 ++++
...otIdempotent_thenResponseCode_205_bad_TODO.java | 112 ++++
.../invoke/Get_givenActionSemanticsOfSafe_ok.java | 112 ++++
...venEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java | 5 +
...tag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java | 5 +
.../id/action/invoke/Get_givenForbidden_bad.java | 122 +++++
...givenMandatorySimpleArg_whenArgMissing_bad.java | 133 +++++
...venMandatorySimpleArg_whenArgNullValue_bad.java | 133 +++++
...pleArgsOfEveryType_whenArgsCorrect_ok_TODO.java | 5 +
...et_givenNoArgRequired_whenNoArgProvided_ok.java | 112 ++++
...leArgs_whenQueryArgXroValidateOnly_ok_TODO.java | 20 +
.../Get_givenOptionalArg_whenNoArgProvided_ok.java | 164 ++++++
...nRefArg_whenArgLinkToNonExistentEntity_bad.java | 126 +++++
.../invoke/Get_givenRefArg_whenArgProvided_ok.java | 172 ++++++
...larArgBigDecimal_whenArgMalformed_bad_TODO.java | 5 +
...calarArgBigDecimal_whenArgProvided_ok_TODO.java | 5 +
...larArgBigInteger_whenArgMalformed_bad_TODO.java | 5 +
...calarArgBigInteger_whenArgProvided_ok_TODO.java | 5 +
...venScalarArgBlob_whenArgMalformed_bad_TODO.java | 5 +
...givenScalarArgBlob_whenArgProvided_ok_TODO.java | 5 +
...ScalarArgBoolean_whenArgMalformed_bad_TODO.java | 5 +
...enScalarArgBoolean_whenArgProvided_ok_TODO.java | 5 +
...venScalarArgClob_whenArgMalformed_bad_TODO.java | 5 +
...calarArgDateTime_whenArgMalformed_bad_TODO.java | 5 +
...nScalarArgDateTime_whenArgProvided_ok_TODO.java | 5 +
...venScalarArgDate_whenArgMalformed_bad_TODO.java | 5 +
...givenScalarArgDate_whenArgProvided_ok_TODO.java | 5 +
...ScalarArgDecimal_whenArgMalformed_bad_TODO.java | 5 +
...enScalarArgDecimal_whenArgProvided_ok_TODO.java | 5 +
...ScalarArgInteger_whenArgMalformed_bad_TODO.java | 125 +++++
...t_givenScalarArgInteger_whenArgProvided_ok.java | 125 +++++
...nScalarArgString_whenArgMalformed_bad_TODO.java | 5 +
...venScalarArgString_whenArgProvided_ok_TODO.java | 5 +
...venScalarArgTime_whenArgMalformed_bad_TODO.java | 5 +
...givenScalarArgTime_whenArgProvided_ok_TODO.java | 5 +
...arArgUtcMillisec_whenArgMalformed_bad_TODO.java | 5 +
...alarArgUtcMillisec_whenArgProvided_ok_TODO.java | 5 +
...arArg_whenArgMalformedMissingValueNode_bad.java | 118 +++++
.../Get_givenScalarArg_whenArgSurplus_bad.java | 135 +++++
...enQueryArgXroValidateOnly_andArgFails_TODO.java | 20 +
...eryArgXroValidateOnly_andArgPasses_ok_TODO.java | 20 +
...nValidationRuleForAllArgs_whenArgFails_bad.java | 133 +++++
...alidationRuleForSingleArg_whenArgFails_bad.java | 134 +++++
.../invoke/Get_thenResponseCode_200_ok_TODO.java | 14 +
...t_thenResponseHeaders_CacheControl_ok_TODO.java | 61 +++
...atedNewObject_thenResponseCode_201_ok_TODO.java | 14 +
...whenErrorThrown_thenRepresentation_ok_TODO.java | 13 +
.../invoke/Get_whenList_thenRepresentation_ok.java | 112 ++++
.../Get_whenObject_thenRepresentation_ok_TODO.java | 13 +
.../Get_whenScalar_thenRepresentation_ok_TODO.java | 13 +
.../Get_whenVoid_thenRepresentation_ok_TODO.java | 13 +
...OfIdempotent_thenResponseCode_205_bad_TODO.java | 112 ++++
...nticsOfSafe_thenResponseCode_205_bad_TOFIX.java | 112 ++++
...otIdempotent_thenResponseCode_205_bad_TODO.java | 112 ++++
...anticsOfSafe_thenResponseCode_205_bad_TODO.java | 112 ++++
.../root/DomainServiceTest_req_header_accept.java | 105 ----
...ainServiceTest_req_queryarg_xrofollowlinks.java | 152 ------
.../root/DomainServiceTest_resp_headers.java | 82 ---
.../DomainServiceTest_resp_representation.java | 128 -----
.../root/Get_thenRepresentation_ok.java | 128 +++++
.../Get_thenResponseHeaders_CacheControl_ok.java | 68 +++
.../Get_thenResponseHeaders_ContentType_ok.java | 73 +++
.../Get_whenCallWithWrongHttpMethod_bad_TODO.java | 5 +
.../root/Get_whenQueryArg_xRoFollowLinks_ok.java | 152 ++++++
...enRequestHeaders_Accept_isInvalid_bad_TODO.java | 5 +
.../root/Get_whenRequestHeaders_Accept_ok.java | 105 ++++
.../Delete_thenResponseCode_205_bad_TODO.java | 5 +
.../DomainServiceTest_req_header_accept.java | 111 ----
...ainServiceTest_req_queryarg_xrodomainmodel.java | 76 ---
...ainServiceTest_req_queryarg_xrofollowlinks.java | 169 ------
.../serviceId/DomainServiceTest_resp_headers.java | 70 ---
.../DomainServiceTest_resp_representation.java | 201 -------
.../serviceId/DomainServiceTest_when_notFound.java | 70 ---
.../Get_ResponseHeaders_CacheControl_ok.java | 63 +++
.../serviceId/Get_thenRepresentation_ok.java | 201 +++++++
.../serviceId/Get_thenResponseCode_200_ok.java | 64 +++
.../Get_thenResponseHeaders_ContentType_ok.java | 64 +++
.../serviceId/Get_thenResponseHeaders_Etag_ok.java | 65 +++
.../Get_whenCallWithWrongHttpMethod_bad_TODO.java | 5 +
.../serviceId/Get_whenNotFound_bad.java | 70 +++
.../Get_whenQueryArg_xRoDomainModel_ok.java | 73 +++
...ryArg_xRoFollowLinks_thenRepresentation_ok.java | 169 ++++++
...enRequestHeaders_Accept_isInvalid_bad_TODO.java | 5 +
.../Get_whenRequestHeaders_Accept_ok.java | 111 ++++
.../Post_thenResponseCode_205_bad_TODO.java | 5 +
.../Put_thenResponseCode_205_bad_TODO.java | 5 +
.../action/invoke/DomainServiceTest_forbidden.java | 122 -----
...mainServiceTest_req_safe_arg_bad_malformed.java | 118 -----
...DomainServiceTest_req_safe_noarg_resp_list.java | 112 ----
...ServiceTest_req_safe_optionalarg_resp_list.java | 164 ------
.../DomainServiceTest_req_safe_refarg_bad.java | 126 -----
...ainServiceTest_req_safe_refarg_resp_scalar.java | 172 ------
...eq_safe_simplearg_fail_all_args_validation.java | 133 -----
...e_simplearg_fail_individual_arg_validation.java | 134 -----
..._req_safe_simplearg_fail_mandatory_missing.java | 133 -----
...q_safe_simplearg_fail_mandatory_value_null.java | 133 -----
...ceTest_req_safe_simplearg_fail_surplus_arg.java | 135 -----
...inServiceTest_req_safe_simplearg_resp_list.java | 125 -----
...est_req_idempotent_fail_method_not_allowed.java | 112 ----
..._req_nonidempotent_fail_method_not_allowed.java | 112 ----
...rviceTest_req_safe_fail_method_not_allowed.java | 112 ----
.../root/Delete_thenResponseCode_205_bad_TODO.java | 5 +
.../homepage/root/Get_thenRepresentation_ok.java | 111 ++++
.../root/Get_thenRequestHeaders_Accept_ok.java | 106 ++++
.../Get_thenResponseHeaders_CacheControl_ok.java | 72 +++
.../Get_thenResponseHeaders_ContentType_ok.java | 74 +++
...ryArg_xRoFollowLinks_thenRepresentation_ok.java | 168 ++++++
...enRequestHeaders_Accept_isInvalid_bad_TODO.java | 5 +
.../root/HomePageTest_req_header_accept.java | 106 ----
.../HomePageTest_req_queryargs_xrofollowlinks.java | 168 ------
.../homepage/root/HomePageTest_resp_headers.java | 79 ---
.../root/HomePageTest_resp_representation.java | 111 ----
.../root/Post_thenResponseCode_205_bad_TODO.java | 5 +
.../root/Put_thenResponseCode_205_bad_TODO.java | 5 +
.../Delete_thenResponseCode_205_bad_TODO.java | 5 +
.../Get_ResponseHeaders_CacheControl_ok_TOFIX.java | 61 +++
.../tck/objectsoftype/Post_ok_TODO.java | 13 +
.../objectsoftype/Post_whenArgValid_ok_TODO.java | 5 +
.../Post_whenArgsMalformed_bad_TODO.java | 5 +
.../Post_whenArgsMissing_bad_TODO.java | 5 +
...Post_whenArgsRefNonExistentEntity_bad_TODO.java | 5 +
.../Put_thenResponseCode_205_bad_TODO.java | 5 +
.../root/Delete_thenResponseCode_205_bad_TODO.java | 5 +
.../tck/user/root/Get_thenRepresentation_ok.java | 104 ++++
.../Get_thenResponseHeaders_CacheControl_ok.java | 68 +++
.../Get_thenResponseHeaders_ContentType_ok.java | 73 +++
...ryArg_xRoFollowLinks_thenRepresentation_ok.java | 92 ++++
.../root/Post_thenResponseCode_205_bad_TODO.java | 5 +
.../root/Put_thenResponseCode_205_bad_TODO.java | 5 +
.../tck/user/root/RequestHeaders_accept_ok.java | 105 ++++
...RequestHeaders_accept_whenInvalid_bad_TODO.java | 5 +
.../tck/user/root/UserTest_req_header_accept.java | 105 ----
.../UserTest_req_queryargs_xrofollowlinks.java | 92 ----
.../tck/user/root/UserTest_resp_headers.java | 96 ----
.../user/root/UserTest_resp_representation.java | 104 ----
.../Delete_thenResponseCode_205_bad_TODO.java | 5 +
.../tck/version/Get_thenRepresentation_ok.java | 113 ++++
.../Get_thenResponseHeaders_CacheControl_ok.java | 75 +++
.../Get_thenResponseHeaders_ContentType_ok.java | 77 +++
...ryArg_xRoFollowLinks_thenRepresentation_ok.java | 88 +++
...enRequestHeaders_Accept_isInvalid_bad_TODO.java | 5 +
.../version/Get_whenRequestHeaders_Accept_ok.java | 110 ++++
.../Post_thenResponseCode_205_bad_TODO.java | 5 +
.../version/Put_thenResponseCode_205_bad_TODO.java | 5 +
.../tck/version/VersionTest_req_header_accept.java | 110 ----
.../VersionTest_req_queryargs_xrofollowlinks.java | 88 ---
.../tck/version/VersionTest_resp_headers.java | 82 ---
.../version/VersionTest_resp_representation.java | 113 ----
.../security/AnyResourceTest_notAuthorized.java | 51 --
...ainObjectTest_get_resp_header_cacheControl.java | 61 ---
.../DomainObjectTest_get_resp_representation.java | 408 ---------------
.../DomainServiceTest_invoke_TOREFACTOR.java | 246 ---------
...inServiceTest_req_queryarg_xrovalidateonly.java | 20 -
...ainServiceTest_resp_representation_of_List.java | 13 -
...nServiceTest_resp_representation_of_Object.java | 13 -
...nServiceTest_resp_representation_of_Scalar.java | 13 -
...ainServiceTest_resp_representation_of_Void.java | 13 -
.../DomainServiceTest_resp_throwsError.java | 13 -
.../DomainServiceTest_when_created_new_object.java | 14 -
.../DomainServiceTest_when_is_forbidden.java | 13 -
...bjectsOfTypeResourceTest_domainTypeId_post.java | 13 -
.../tck/zzztodo/stories/UserStoryTest.java | 86 ---
237 files changed, 7139 insertions(+), 5383 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/all/stories/UserStoryTest_TOFIX.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/all/stories/UserStoryTest_TOFIX.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/all/stories/UserStoryTest_TOFIX.java
new file mode 100644
index 0000000..5e7adb3
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/all/stories/UserStoryTest_TOFIX.java
@@ -0,0 +1,86 @@
+/*
+ * 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.all.stories;
+
+import static org.apache.isis.core.commons.matchers.IsisMatchers.matches;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.Response;
+
+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.client.RepresentationWalker;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+public class UserStoryTest_TOFIX {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ }
+
+ @Ignore("to get working again")
+ @Test
+ public void walkResources() throws Exception {
+
+ // given a response for an initial resource
+ final HomePageResource homePageResource = client.getHomePageResource();
+ final Response homePageResp = homePageResource.homePage();
+
+ // and given a walker starting from this response
+ final RepresentationWalker walker = client.createWalker(homePageResp);
+
+ // when walk the home pages' 'services' link
+ walker.walk("services");
+
+ // and when locate the ApplibValues repo and walk the its 'object' link
+ walker.walk("values[title=ApplibValues].links[rel=object]");
+
+ // and when locate the AppLibValues repo's "newEntity" action and walk
+ // to its details
+ walker.walk("values[memberType=action].details");
+
+ // and when find the invoke body for the "newEntity" action and then
+ // walk the action using the body
+ final JsonRepresentation newEntityActionDetails = walker.getEntity();
+ final JsonRepresentation newEntityActionInvokeBody = newEntityActionDetails.getArray("invoke.body");
+ walker.walk("invoke", newEntityActionInvokeBody);
+
+ // and when walk the link to the returned object
+ walker.walk("link");
+
+ // then the returned object is created with its OID
+ final JsonRepresentation newEntityDomainObject = walker.getEntity();
+ assertThat(newEntityDomainObject.getString("_self.link.href"), matches(".+/objects/OID:[\\d]+$"));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/any/NotAuthorized_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/any/NotAuthorized_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/any/NotAuthorized_TODO.java
new file mode 100644
index 0000000..f4b7a03
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/any/NotAuthorized_TODO.java
@@ -0,0 +1,51 @@
+/*
+ * 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.any;
+
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+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 NotAuthorized_TODO {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+ private RestfulClient client;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+ }
+
+ @Ignore("TODO")
+ @Test
+ public void whenAuthenticated() throws Exception {
+
+ }
+
+ @Ignore("TODO")
+ @Test
+ public void whenNotAuthenticated() throws Exception {
+ // should return 401 (13.5)
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Delete_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Delete_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Delete_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..2e44167
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Delete_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+
+public class Delete_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenRepresentation_ok_TOFIX.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenRepresentation_ok_TOFIX.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenRepresentation_ok_TOFIX.java
new file mode 100644
index 0000000..253fde7
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenRepresentation_ok_TOFIX.java
@@ -0,0 +1,408 @@
+/*
+ * 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.domainobject.oid;
+
+import static org.apache.isis.core.commons.matchers.IsisMatchers.matches;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+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 static org.junit.Assert.fail;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status.Family;
+
+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.tck.dom.refs.BidirWithSetChildEntity;
+import org.apache.isis.core.tck.dom.scalars.ApplibValuedEntity;
+import org.apache.isis.core.tck.dom.scalars.ApplibValuedEntityRepository;
+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.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.domainobjects.ActionResultRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectPropertyRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ScalarValueRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ActionResultRepresentation.ResultType;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+public class Get_thenRepresentation_ok_TOFIX {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ }
+
+ @Ignore("to fix")
+ @Test
+ public void returnsDomainObjectRepresentation() throws Exception {
+
+ // given
+ final DomainObjectResource domainObjectResource = client.getDomainObjectResource();
+
+ // when
+ final Response domainObjectResp = domainObjectResource.object("OID","6");
+ final RestfulResponse<DomainObjectRepresentation> domainObjectJsonResp = RestfulResponse.ofT(domainObjectResp);
+ assertThat(domainObjectJsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));
+
+ // then
+ final DomainObjectRepresentation domainObjectRepr = domainObjectJsonResp.getEntity();
+ assertThat(domainObjectRepr, is(not(nullValue())));
+ }
+
+ @Ignore("to fix")
+ @Test
+ public void domainObjectRepresentationForPersistentObject_hasSelfAndOid() throws Exception {
+
+ // given, when
+ final DomainObjectRepresentation domainObjectRepr = givenDomainObjectRepresentationFor("OID","32");
+
+ // then
+ final LinkRepresentation self = domainObjectRepr.getSelf();
+ assertThat(self, isLink().rel(Rel.SELF).href(matches(".+objects/OID/32")).httpMethod(RestfulHttpMethod.GET).type(MediaType.APPLICATION_JSON_TYPE).typeParameter("profile", "urn:org.restfulobjects/domainobject"));
+ assertThat(domainObjectRepr.getLinkWithRel(Rel.DESCRIBEDBY), isLink().href(matches(".+" + BidirWithSetChildEntity.class.getName())).httpMethod(RestfulHttpMethod.GET).type(MediaType.APPLICATION_JSON_TYPE).typeParameter("profile", "urn:org.restfulobjects/domaintype"));
+
+ assertThat(domainObjectRepr.getTitle(), is("parent 4 - child 2"));
+ assertThat(domainObjectRepr.getOid(), is("OID:32"));
+
+ // no icon
+ final LinkRepresentation selfIcon = domainObjectRepr.getLinkWithRel(Rel.ICON);
+ assertThat(selfIcon, is(nullValue()));
+ }
+
+ @Ignore("to fix")
+ @Test
+ public void domainObjectRepresentationForTransient_hasNoSelf_andHasNoOid() throws Exception {
+
+ // given, when
+ final RestfulRequest request = this.client.createRequest(RestfulHttpMethod.POST, "services/simples/actions/newTransientEntity/invoke");
+ final RestfulResponse<ActionResultRepresentation> response = request.executeT();
+ final ActionResultRepresentation actionResultRepr = response.getEntity();
+ assertThat(actionResultRepr.getResultType(), is(ResultType.DOMAIN_OBJECT));
+ assertThat(actionResultRepr.getResult(), is(not(nullValue())));
+
+ final DomainObjectRepresentation domainObjectRepr = actionResultRepr.getResult().as(DomainObjectRepresentation.class);
+
+ // then
+ final LinkRepresentation self = domainObjectRepr.getSelf();
+ assertThat(self, is(nullValue()));
+
+ assertThat(domainObjectRepr.getOid(), is(nullValue()));
+ }
+
+ @Ignore("to fix")
+ @Test
+ public void domainObjectRepresentation_hasTitle() throws Exception {
+
+ // given, when
+ final DomainObjectRepresentation domainObjectRepr = givenDomainObjectRepresentationFor("OID","32");
+
+ // then
+ assertThat(domainObjectRepr.getTitle(), is("parent 4 - child 2"));
+ }
+
+ @Ignore("to fix")
+ @Test
+ public void domainObjectRepresentation_hasDescribedByLink() throws Exception {
+
+ // given, when
+ final DomainObjectRepresentation domainObjectRepr = givenDomainObjectRepresentationFor("OID","32");
+
+ // then
+ assertThat(domainObjectRepr.getLinkWithRel(Rel.DESCRIBEDBY), isLink().href(matches(".+" + BidirWithSetChildEntity.class.getName())).httpMethod(RestfulHttpMethod.GET).type(MediaType.APPLICATION_JSON_TYPE).typeParameter("profile", "urn:org.restfulobjects/domaintype"));
+ }
+
+ @Ignore("to fix")
+ @Test
+ public void domainObjectRepresentation_noIcon() throws Exception {
+
+ // given, when
+ final DomainObjectRepresentation domainObjectRepr = givenDomainObjectRepresentationFor("OID","32");
+
+ // then
+ final LinkRepresentation selfIcon = domainObjectRepr.getLinkWithRel(Rel.ICON);
+ assertThat(selfIcon, is(nullValue()));
+ }
+
+ @Ignore("TODO")
+ @Test
+ public void domainObjectWithIcon() throws Exception {
+
+ // given, when
+ final DomainObjectRepresentation domainObjectRepr = givenDomainObjectRepresentationFor("OID","xxx");
+
+ // icon
+ final LinkRepresentation selfIcon = domainObjectRepr.getLinkWithRel(Rel.ICON);
+ assertThat(selfIcon, isLink().href(matches(".+" + "/images/" + "null\\.png")).httpMethod(RestfulHttpMethod.GET));
+
+ }
+
+ @Ignore("to fix")
+ @Test
+ public void domainObjectRepresentationContent_Properties() throws Exception {
+
+ // given, when
+ final DomainObjectRepresentation domainObjectRepr = givenDomainObjectRepresentationFor("OID","32");
+ final LinkRepresentation self = domainObjectRepr.getSelf();
+
+ // then properties
+ final JsonRepresentation properties = domainObjectRepr.getProperties();
+ assertThat(properties.size(), is(2));
+
+ // property ('name')
+ final JsonRepresentation nameProperty = properties.getRepresentation("[id=name]");
+ assertThat(nameProperty.getString("memberType"), is("property"));
+ assertThat(nameProperty.getString("value"), is("child 2"));
+ assertThat(nameProperty.getString("disabledReason"), is(nullValue()));
+
+ final LinkRepresentation namePropertyDetails = nameProperty.getLink("links[rel=details]");
+ assertThat(namePropertyDetails, isLink().rel("details").href(self.getHref() + "/properties/name").httpMethod(RestfulHttpMethod.GET));
+
+ }
+
+ @Ignore("todo")
+ @Test
+ public void domainObjectRepresentationContent_Collections() throws Exception {
+
+ // given, when
+ final DomainObjectRepresentation domainObjectRepr = givenDomainObjectRepresentationFor("OID","32");
+
+ // then collections
+
+ }
+
+ @Ignore("TODO")
+ @Test
+ public void domainObjectRepresentationContent() throws Exception {
+
+ // given, when
+ final DomainObjectRepresentation domainObjectRepr = givenDomainObjectRepresentationFor("OID","32");
+ final LinkRepresentation self = domainObjectRepr.getSelf();
+
+ // then actions
+ final JsonRepresentation actions = domainObjectRepr.getActions();
+ assertThat(actions.size(), is(2));
+
+ final JsonRepresentation listAction = actions.getRepresentation("list");
+ assertThat(listAction.getString("memberType"), is("action"));
+ assertThat(listAction.getString("actionId"), is("list"));
+ assertThat(listAction.getString("actionType"), is("USER"));
+ assertThat(listAction.getInt("numParameters"), is(0));
+
+ final LinkRepresentation listActionType = listAction.getLink("type");
+ assertThat(listActionType.getRel(), is("type"));
+ assertThat(listActionType.getHref(), matches(".+vnd\\.list\\+json"));
+ assertThat(listActionType.getHttpMethod(), is(RestfulHttpMethod.GET));
+
+ final LinkRepresentation listActionDetails = listAction.getLink("details");
+ assertThat(listActionDetails.getRel(), is("action"));
+ assertThat(listActionDetails.getHref(), is(self.getHref() + "/actions/list"));
+ assertThat(listActionDetails.getHttpMethod(), is(RestfulHttpMethod.GET));
+
+ final JsonRepresentation newEntityAction = actions.getRepresentation("newEntity");
+ assertThat(newEntityAction.getString("memberType"), is("action"));
+ assertThat(newEntityAction.getString("actionType"), is("USER"));
+ assertThat(newEntityAction.getInt("numParameters"), is(0));
+
+ final LinkRepresentation newEntityActionType = newEntityAction.getLink("type");
+ assertThat(newEntityActionType.getRel(), is("type"));
+ assertThat(newEntityActionType.getHref(), matches(".+vnd\\." + ApplibValuedEntity.class.getName() + "\\+json"));
+ assertThat(newEntityActionType.getHttpMethod(), is(RestfulHttpMethod.GET));
+
+ final LinkRepresentation newEntityActionDetails = newEntityAction.getLink("details");
+ assertThat(newEntityActionDetails.getRel(), is("action"));
+ assertThat(newEntityActionDetails.getHref(), is(self.getHref() + "/actions/newEntity"));
+ assertThat(newEntityActionDetails.getHttpMethod(), is(RestfulHttpMethod.GET));
+ }
+
+ @Ignore("TODO")
+ @Test
+ public void domainObjectWithDisabledMembers() throws Exception {
+
+ // given, when
+ final DomainObjectRepresentation domainObjectRepr = givenDomainObjectRepresentationFor("OID","xxx");
+
+ // property ('name')
+ final JsonRepresentation properties = domainObjectRepr.getProperties();
+ final JsonRepresentation nameProperty = properties.getRepresentation("name");
+ assertThat(nameProperty.getString("disabledReason"), is(not(nullValue())));
+ }
+
+ @Ignore("to get working again")
+ @Test
+ public void propertyDetails() throws Exception {
+ // given
+ final DomainObjectResource domainObjectResource = client.getDomainObjectResource();
+
+ // when
+ final Response idPropertyResp = domainObjectResource.propertyDetails("OID","1", "id");
+ final RestfulResponse<ObjectPropertyRepresentation> idPropertyJsonResp = RestfulResponse.ofT(idPropertyResp);
+ assertThat(idPropertyJsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));
+
+ // then
+ final ObjectPropertyRepresentation propertyDetailsRepr = idPropertyJsonResp.getEntity();
+
+ // _self.link
+ final LinkRepresentation selfLink = propertyDetailsRepr.getLink("_self.link");
+ assertThat(selfLink.getRel(), is("member"));
+ assertThat(selfLink.getHref(), matches(".+objects/OID:1/properties/id"));
+ assertThat(selfLink.getHttpMethod(), is(RestfulHttpMethod.GET));
+
+ // _self.object
+ final LinkRepresentation selfObject = propertyDetailsRepr.getLink("_self.object");
+ assertThat(selfObject.getRel(), is("object"));
+ assertThat(selfObject.getHref(), matches(".+objects/OID:1"));
+ assertThat(selfObject.getHttpMethod(), is(RestfulHttpMethod.GET));
+
+ // type
+ final LinkRepresentation type = propertyDetailsRepr.getLink("type");
+ assertThat(type.getRel(), is("type"));
+ assertThat(type.getHref(), matches(".+vnd\\.string\\+json"));
+ assertThat(type.getHttpMethod(), is(RestfulHttpMethod.GET));
+
+ assertThat(propertyDetailsRepr.getString("memberType"), is("property"));
+ assertThat(propertyDetailsRepr.getString("value"), is(ApplibValuedEntityRepository.class.getName()));
+ assertThat(propertyDetailsRepr.getString("disabledReason"), is(not(nullValue())));
+ }
+
+ @Ignore("to get working again")
+ @Test
+ public void actionPrompt() throws Exception {
+ // given
+ final DomainObjectResource domainObjectResource = client.getDomainObjectResource();
+
+ // when
+ final Response actionPromptResp = domainObjectResource.actionPrompt("OID","1", "list");
+ final RestfulResponse<ObjectActionRepresentation> actionPromptJsonResp = RestfulResponse.ofT(actionPromptResp);
+ assertThat(actionPromptJsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));
+
+ // then
+ final ObjectActionRepresentation actionPromptRepr = actionPromptJsonResp.getEntity();
+
+ // _self.link
+ final LinkRepresentation selfLink = actionPromptRepr.getLink("_self.link");
+ assertThat(selfLink.getRel(), is("member"));
+ assertThat(selfLink.getHref(), matches(".+objects/OID:1/actions/list"));
+ assertThat(selfLink.getHttpMethod(), is(RestfulHttpMethod.GET));
+
+ // _self.object
+ final LinkRepresentation selfObject = actionPromptRepr.getLink("_self.object");
+ assertThat(selfObject.getRel(), is("object"));
+ assertThat(selfObject.getHref(), matches(".+objects/OID:1"));
+ assertThat(selfObject.getHttpMethod(), is(RestfulHttpMethod.GET));
+
+ // type
+ final LinkRepresentation type = actionPromptRepr.getLink("type");
+ assertThat(type.getRel(), is("type"));
+ assertThat(type.getHref(), matches(".+vnd\\.list\\+json"));
+ assertThat(type.getHttpMethod(), is(RestfulHttpMethod.GET));
+
+ assertThat(actionPromptRepr.getString("memberType"), is("action"));
+ assertThat(actionPromptRepr.getString("actionType"), is("USER"));
+ assertThat(actionPromptRepr.getInt("numParameters"), is(0));
+ assertThat(actionPromptRepr.getArray("parameters").size(), is(0));
+
+ final LinkRepresentation invokeLink = actionPromptRepr.getLink("invoke");
+ assertThat(invokeLink.getRel(), is("invoke"));
+ assertThat(invokeLink.getHref(), matches(".+objects/OID:1/actions/list/invoke"));
+ assertThat(invokeLink.getHttpMethod(), is(RestfulHttpMethod.POST));
+ assertThat(invokeLink.getArguments(), is(not(nullValue())));
+ assertThat(invokeLink.getArguments().isArray(), is(true));
+ assertThat(invokeLink.getArguments().size(), is(0));
+ }
+
+ @Ignore("TODO")
+ @Test
+ public void collectionDetails() throws Exception {
+ fail();
+ }
+
+ @Ignore("to get working again")
+ @Test
+ public void actionPostInvoke_returningList() throws Exception {
+
+ // given
+ final DomainObjectResource domainObjectResource = client.getDomainObjectResource();
+
+ final JsonRepresentation body = JsonRepresentation.newArray();
+
+ // when
+ final Response actionInvokeResp = domainObjectResource.invokeAction("OID","1", "list", body.asInputStream());
+ final RestfulResponse<ScalarValueRepresentation> actionInvokeJsonResp = RestfulResponse.ofT(actionInvokeResp);
+ assertThat(actionInvokeJsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));
+
+ // then
+ final ScalarValueRepresentation actionInvokeRepr = actionInvokeJsonResp.getEntity();
+ assertThat(actionInvokeRepr.isArray(), is(true));
+ assertThat(actionInvokeRepr.size(), is(5));
+
+ final JsonRepresentation domainObjectRefRepr = actionInvokeRepr.arrayGet(0);
+
+ assertThat(domainObjectRefRepr, is(not(nullValue())));
+ assertThat(domainObjectRefRepr.getString("title"), is("Untitled Applib Values Entity")); // TODO
+
+ final LinkRepresentation domainObjectLink = domainObjectRefRepr.getLink("link");
+ assertThat(domainObjectLink.getRel(), is("object"));
+ assertThat(domainObjectLink.getHref(), matches("http://localhost:\\d+/objects/OID:7"));
+
+ final LinkRepresentation domainObjectTypeLink = domainObjectRefRepr.getLink("type");
+ assertThat(domainObjectTypeLink.getRel(), is("type"));
+ assertThat(domainObjectTypeLink.getHref(), matches("http://localhost:\\d+/types/application/vnd." + org.apache.isis.core.tck.dom.scalars.ApplibValuedEntity.class.getName() + "\\+json"));
+
+ final LinkRepresentation domainObjectIconLink = domainObjectRefRepr.getLink("icon");
+ assertThat(domainObjectIconLink.getRel(), is("icon"));
+ assertThat(domainObjectIconLink.getHref(), matches("http://localhost:\\d+/images/null.png")); // TODO
+ }
+
+ private DomainObjectRepresentation givenDomainObjectRepresentationFor(final String domainType, String instanceId) throws JsonParseException, JsonMappingException, IOException {
+ final DomainObjectResource domainObjectResource = client.getDomainObjectResource();
+
+ final Response domainObjectResp = domainObjectResource.object(domainType, instanceId);
+ final RestfulResponse<DomainObjectRepresentation> domainObjectJsonResp = RestfulResponse.ofT(domainObjectResp);
+ assertThat(domainObjectJsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));
+
+ final DomainObjectRepresentation domainObjectRepr = domainObjectJsonResp.getEntity();
+ return domainObjectRepr;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseCode_200_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseCode_200_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseCode_200_ok_TODO.java
new file mode 100644
index 0000000..3e4bfa7
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseCode_200_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+
+public class Get_thenResponseCode_200_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseHeaders_CacheControl_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseHeaders_CacheControl_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseHeaders_CacheControl_ok_TODO.java
new file mode 100644
index 0000000..6e22e0a
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseHeaders_CacheControl_ok_TODO.java
@@ -0,0 +1,61 @@
+/*
+ * 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.domainobject.oid;
+
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+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 Get_thenResponseHeaders_CacheControl_ok_TODO {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ }
+
+ @Ignore
+ @Test
+ public void noCaching() throws Exception {
+
+ }
+
+ @Ignore
+ @Test
+ public void shortTermCaching() throws Exception {
+
+ }
+
+ @Ignore
+ @Test
+ public void longTermCaching() throws Exception {
+
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseHeaders_eTag_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseHeaders_eTag_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseHeaders_eTag_ok_TODO.java
new file mode 100644
index 0000000..b6699c5
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseHeaders_eTag_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+
+public class Get_thenResponseHeaders_eTag_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenQueryArg_xRoFollowLinks_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenQueryArg_xRoFollowLinks_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenQueryArg_xRoFollowLinks_ok_TODO.java
new file mode 100644
index 0000000..30d4d9b
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenQueryArg_xRoFollowLinks_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+
+public class Get_whenQueryArg_xRoFollowLinks_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java
new file mode 100644
index 0000000..990a74a
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+
+public class Get_whenRequestHeaders_Accept_isInvalid_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenRequestHeaders_Accept_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenRequestHeaders_Accept_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenRequestHeaders_Accept_ok_TODO.java
new file mode 100644
index 0000000..f8fe865
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenRequestHeaders_Accept_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+
+public class Get_whenRequestHeaders_Accept_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Post_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Post_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Post_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..3d1c005
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Post_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+
+public class Post_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenMultiplePropertyUpdate_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenMultiplePropertyUpdate_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenMultiplePropertyUpdate_TODO.java
new file mode 100644
index 0000000..bf4280e
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenMultiplePropertyUpdate_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+
+public class Put_whenMultiplePropertyUpdate_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/action/invoke/ZzzTodo_idempotent_fail_method_not_allowed.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/action/invoke/ZzzTodo_idempotent_fail_method_not_allowed.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/action/invoke/ZzzTodo_idempotent_fail_method_not_allowed.java
deleted file mode 100644
index 03caba4..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/action/invoke/ZzzTodo_idempotent_fail_method_not_allowed.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.action.invoke;
-
-public class ZzzTodo_idempotent_fail_method_not_allowed {
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/action/invoke/ZzzTodo_nonidempotent_fail_method_not_allowed.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/action/invoke/ZzzTodo_nonidempotent_fail_method_not_allowed.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/action/invoke/ZzzTodo_nonidempotent_fail_method_not_allowed.java
deleted file mode 100644
index 53cfcb5..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/action/invoke/ZzzTodo_nonidempotent_fail_method_not_allowed.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.action.invoke;
-
-public class ZzzTodo_nonidempotent_fail_method_not_allowed {
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/action/invoke/ZzzTodo_safe_fail_method_not_allowed.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/action/invoke/ZzzTodo_safe_fail_method_not_allowed.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/action/invoke/ZzzTodo_safe_fail_method_not_allowed.java
deleted file mode 100644
index f062ecd..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/action/invoke/ZzzTodo_safe_fail_method_not_allowed.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.action.invoke;
-
-public class ZzzTodo_safe_fail_method_not_allowed {
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java
new file mode 100644
index 0000000..3616990
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Delete_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java
new file mode 100644
index 0000000..0863a5c
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Delete_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenRepresentation_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenRepresentation_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenRepresentation_ok_TODO.java
new file mode 100644
index 0000000..c8d9a29
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenRepresentation_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Delete_thenRepresentation_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenHrefArgLinkToNonExistentEntity_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenHrefArgLinkToNonExistentEntity_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenHrefArgLinkToNonExistentEntity_bad_TODO.java
new file mode 100644
index 0000000..740d5b4
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenHrefArgLinkToNonExistentEntity_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Delete_whenHrefArgLinkToNonExistentEntity_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenHrefArgLinksToEntityInCollection_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenHrefArgLinksToEntityInCollection_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenHrefArgLinksToEntityInCollection_ok_TODO.java
new file mode 100644
index 0000000..b2afedd
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenHrefArgLinksToEntityInCollection_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Delete_whenHrefArgLinksToEntityInCollection_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenLinkToEntityThatExistsButIsNotInCollection_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenLinkToEntityThatExistsButIsNotInCollection_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenLinkToEntityThatExistsButIsNotInCollection_ok_TODO.java
new file mode 100644
index 0000000..1bc5feb
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenLinkToEntityThatExistsButIsNotInCollection_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Delete_whenLinkToEntityThatExistsButIsNotInCollection_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenNoArg_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenNoArg_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenNoArg_bad_TODO.java
new file mode 100644
index 0000000..b0df563
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenNoArg_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Delete_whenNoArg_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenRepresentation_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenRepresentation_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenRepresentation_ok_TODO.java
new file mode 100644
index 0000000..c325e6f
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenRepresentation_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Get_thenRepresentation_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseHeaders_CacheControl_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseHeaders_CacheControl_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseHeaders_CacheControl_ok_TODO.java
new file mode 100644
index 0000000..0bc1a3c
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseHeaders_CacheControl_ok_TODO.java
@@ -0,0 +1,61 @@
+/*
+ * 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.domainobject.oid.collection;
+
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+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 Get_thenResponseHeaders_CacheControl_ok_TODO {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ }
+
+ @Ignore
+ @Test
+ public void noCaching() throws Exception {
+
+ }
+
+ @Ignore
+ @Test
+ public void shortTermCaching() throws Exception {
+
+ }
+
+ @Ignore
+ @Test
+ public void longTermCaching() throws Exception {
+
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenHrefArg_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenHrefArg_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenHrefArg_bad_TODO.java
new file mode 100644
index 0000000..bd4ace9
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenHrefArg_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Get_whenHrefArg_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenHrefArg_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenHrefArg_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenHrefArg_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..9c8ff26
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenHrefArg_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Get_whenHrefArg_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenQueryArg_xRoFollowLinks_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenQueryArg_xRoFollowLinks_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenQueryArg_xRoFollowLinks_ok_TODO.java
new file mode 100644
index 0000000..baf35e5
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenQueryArg_xRoFollowLinks_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Get_whenQueryArg_xRoFollowLinks_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java
new file mode 100644
index 0000000..8fce1c1
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Get_whenRequestHeaders_Accept_isInvalid_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenRequestHeaders_Accept_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenRequestHeaders_Accept_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenRequestHeaders_Accept_ok_TODO.java
new file mode 100644
index 0000000..b92f388
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenRequestHeaders_Accept_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Get_whenRequestHeaders_Accept_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenEntityInCollection_whenHrefArgLinksToEntity_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenEntityInCollection_whenHrefArgLinksToEntity_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenEntityInCollection_whenHrefArgLinksToEntity_ok_TODO.java
new file mode 100644
index 0000000..98062f7
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenEntityInCollection_whenHrefArgLinksToEntity_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Post_givenEntityInCollection_whenHrefArgLinksToEntity_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenSetSemantics_whenHrefArg_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenSetSemantics_whenHrefArg_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenSetSemantics_whenHrefArg_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..871254f
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenSetSemantics_whenHrefArg_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Post_givenSetSemantics_whenHrefArg_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenRepresentation_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenRepresentation_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenRepresentation_ok_TODO.java
new file mode 100644
index 0000000..427c3b3
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenRepresentation_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Post_thenRepresentation_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenInvalidArg_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenInvalidArg_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenInvalidArg_bad_TODO.java
new file mode 100644
index 0000000..bfc1ab8
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenInvalidArg_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Post_whenInvalidArg_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenNoArg_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenNoArg_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenNoArg_bad_TODO.java
new file mode 100644
index 0000000..e8d8887
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenNoArg_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Post_whenNoArg_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/PutOrPost_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/PutOrPost_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/PutOrPost_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java
new file mode 100644
index 0000000..da9ab97
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/PutOrPost_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class PutOrPost_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/PutOrPost_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/PutOrPost_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/PutOrPost_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java
new file mode 100644
index 0000000..0d6177a
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/PutOrPost_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class PutOrPost_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/PutOrPost_whenHrefArgLinkToNonExistentEntity_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/PutOrPost_whenHrefArgLinkToNonExistentEntity_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/PutOrPost_whenHrefArgLinkToNonExistentEntity_bad_TODO.java
new file mode 100644
index 0000000..e9da0b9
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/PutOrPost_whenHrefArgLinkToNonExistentEntity_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class PutOrPost_whenHrefArgLinkToNonExistentEntity_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/PutOrPost_whenHrefArgValid_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/PutOrPost_whenHrefArgValid_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/PutOrPost_whenHrefArgValid_ok_TODO.java
new file mode 100644
index 0000000..904bf48
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/PutOrPost_whenHrefArgValid_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class PutOrPost_whenHrefArgValid_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenEntityAlreadyInCollection_whenHrefArgLinksToEntity_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenEntityAlreadyInCollection_whenHrefArgLinksToEntity_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenEntityAlreadyInCollection_whenHrefArgLinksToEntity_bad_TODO.java
new file mode 100644
index 0000000..cc3b11e
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenEntityAlreadyInCollection_whenHrefArgLinksToEntity_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Put_givenEntityAlreadyInCollection_whenHrefArgLinksToEntity_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenListSemantics_whenHrefArg_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenListSemantics_whenHrefArg_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenListSemantics_whenHrefArg_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..c159b27
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenListSemantics_whenHrefArg_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Put_givenListSemantics_whenHrefArg_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenRepresentation_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenRepresentation_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenRepresentation_ok_TODO.java
new file mode 100644
index 0000000..2f37a06
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenRepresentation_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Put_thenRepresentation_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenInvalidArg_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenInvalidArg_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenInvalidArg_bad_TODO.java
new file mode 100644
index 0000000..d595a78
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenInvalidArg_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Put_whenInvalidArg_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenNoArg_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenNoArg_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenNoArg_bad_TODO.java
new file mode 100644
index 0000000..43832d9
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenNoArg_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Put_whenNoArg_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/ZzzTodo_addTo_fail_method_not_allowed.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/ZzzTodo_addTo_fail_method_not_allowed.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/ZzzTodo_addTo_fail_method_not_allowed.java
deleted file mode 100644
index 6b4f1e9..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/ZzzTodo_addTo_fail_method_not_allowed.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
-
-public class ZzzTodo_addTo_fail_method_not_allowed {
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/ZzzTodo_details_fail_method_not_allowed.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/ZzzTodo_details_fail_method_not_allowed.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/ZzzTodo_details_fail_method_not_allowed.java
deleted file mode 100644
index b3b0420..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/ZzzTodo_details_fail_method_not_allowed.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
-
-public class ZzzTodo_details_fail_method_not_allowed {
-
-}
[3/9] ISIS-233: adding new test stubs (TODOs)
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_simplearg_fail_surplus_arg.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_simplearg_fail_surplus_arg.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_simplearg_fail_surplus_arg.java
deleted file mode 100644
index a4798a8..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_simplearg_fail_surplus_arg.java
+++ /dev/null
@@ -1,135 +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.domainservice.serviceId.action.invoke;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasStatus;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.hamcrest.Matchers;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-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.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.domainobjects.ActionResultRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers;
-import org.apache.isis.viewer.restfulobjects.tck.Util;
-
-public class DomainServiceTest_req_safe_simplearg_fail_surplus_arg {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- private DomainServiceResource serviceResource;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
-
- serviceResource = client.getDomainServiceResource();
- }
-
- @Test
- public void usingClientFollow() throws Exception {
-
- // given
- final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subList");
- final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
-
- final LinkRepresentation invokeLink = actionRepr.getInvoke();
-
- assertThat(invokeLink, isLink(client)
- .rel(Rel.INVOKE)
- .httpMethod(RestfulHttpMethod.GET)
- .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subList/invoke"))
- .build());
-
- JsonRepresentation args =invokeLink.getArguments();
- assertThat(args.size(), is(2));
- assertThat(args, RestfulMatchers.mapHas("from"));
- assertThat(args, RestfulMatchers.mapHas("to"));
-
- // when
- args = JsonRepresentation.newMap();
- args.mapPut("from.value", 0);
- args.mapPut("to.value", 1);
- args.mapPut("nonExistent.value", 2);
- assertThat(args.size(), is(3));
-
- final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
-
- // then
- thenResponseIsErrorWithInvalidReason(restfulResponse);
- }
-
-
- @Test
- public void usingResourceProxy() throws Exception {
-
- // given, when
- JsonRepresentation args = JsonRepresentation.newMap();
- args.mapPut("from.value", 0);
- args.mapPut("to.value", 1);
- args.mapPut("nonExistent.value", 2);
- assertThat(args.size(), is(3));
-
- Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "subList", UrlEncodingUtils.urlEncode(args));
- RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
-
- // then
- thenResponseIsErrorWithInvalidReason(restfulResponse);
- }
-
- private static void thenResponseIsErrorWithInvalidReason(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
- assertThat(restfulResponse, hasStatus(HttpStatusCode.BAD_REQUEST));
- assertThat(restfulResponse.getHeader(Header.WARNING), is("Argument 'nonExistent' found but no such parameter"));
-
- // hmmm... what is the media type, though? the spec doesn't say. testing for a generic one.
- assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(MediaType.APPLICATION_JSON));
-
- RestfulResponse<JsonRepresentation> restfulResponseOfError = restfulResponse.wraps(JsonRepresentation.class);
- JsonRepresentation repr = restfulResponseOfError.getEntity();
-
- assertThat(repr.getString("x-ro-invalidReason"), is("Argument 'nonExistent' found but no such parameter"));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_simplearg_resp_list.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_simplearg_resp_list.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_simplearg_resp_list.java
deleted file mode 100644
index cdcaa2e..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_simplearg_resp_list.java
+++ /dev/null
@@ -1,125 +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.domainservice.serviceId.action.invoke;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-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.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulMediaType;
-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.domainobjects.ActionResultRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ActionResultRepresentation.ResultType;
-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.domainobjects.ObjectActionRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers;
-import org.apache.isis.viewer.restfulobjects.tck.Util;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.hamcrest.Matchers;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class DomainServiceTest_req_safe_simplearg_resp_list {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- private DomainServiceResource serviceResource;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
-
- serviceResource = client.getDomainServiceResource();
- }
-
- @Test
- public void usingClientFollow() throws Exception {
-
- // given
- final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subList");
- final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
-
- final LinkRepresentation invokeLink = actionRepr.getInvoke();
-
- assertThat(invokeLink, isLink(client)
- .rel(Rel.INVOKE)
- .httpMethod(RestfulHttpMethod.GET)
- .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subList/invoke"))
- .build());
-
- JsonRepresentation args =invokeLink.getArguments();
- assertThat(args.size(), is(2));
- assertThat(args, RestfulMatchers.mapHas("from"));
- assertThat(args, RestfulMatchers.mapHas("to"));
-
- // when
- args.mapPut("from.value", 1);
- args.mapPut("to.value", 3);
-
- final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
-
- then(restfulResponse);
- }
-
- @Test
- public void usingResourceProxy() throws Exception {
-
- // given, when
- JsonRepresentation args = JsonRepresentation.newMap();
- args.mapPut("from.value", 1);
- args.mapPut("to.value", 3);
- Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "subList", UrlEncodingUtils.urlEncode(args));
- RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
-
- // then
- then(restfulResponse);
- }
-
- private static void then(RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
- assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(RestfulMediaType.APPLICATION_JSON_ACTION_RESULT));
- final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
-
- assertThat(actionResultRepr.getResultType(), is(ResultType.LIST));
-
- final ListRepresentation listRepr = actionResultRepr.getResult().as(ListRepresentation.class);
-
- assertThat(listRepr.getValue().size(), is(2));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/ZzzToDo_DomainServiceTest_req_idempotent_fail_method_not_allowed.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/ZzzToDo_DomainServiceTest_req_idempotent_fail_method_not_allowed.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/ZzzToDo_DomainServiceTest_req_idempotent_fail_method_not_allowed.java
deleted file mode 100644
index ecc445e..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/ZzzToDo_DomainServiceTest_req_idempotent_fail_method_not_allowed.java
+++ /dev/null
@@ -1,112 +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.domainservice.serviceId.action.invoke;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasStatus;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.hamcrest.Matchers;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-
-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.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.domainobjects.ActionResultRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.apache.isis.viewer.restfulobjects.tck.Util;
-
-public class ZzzToDo_DomainServiceTest_req_idempotent_fail_method_not_allowed {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- private DomainServiceResource serviceResource;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
-
- serviceResource = client.getDomainServiceResource();
- }
-
- @Ignore("to write - copied from req_safe")
- @Test
- public void usingClientFollow() throws Exception {
-
- // given, when
- final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subListWithOptionalRange");
- final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
-
- final LinkRepresentation invokeLink = actionRepr.getInvoke();
-
- assertThat(invokeLink, isLink(client)
- .rel(Rel.INVOKE)
- .httpMethod(RestfulHttpMethod.GET)
- .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subListWithOptionalRange/invoke"))
- .build());
-
- invokeLink.withMethod(RestfulHttpMethod.POST);
-
- // when
- JsonRepresentation args = JsonRepresentation.newMap();
- args = JsonRepresentation.newMap();
- args.mapPut("id.value", 123);
-
- final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
-
- // then
- thenResponseIsErrorWithInvalidReason(restfulResponse);
- }
-
-
- // not possible to test using resourceProxy
-
-
- private static void thenResponseIsErrorWithInvalidReason(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
- assertThat(restfulResponse, hasStatus(HttpStatusCode.METHOD_NOT_ALLOWED));
- assertThat(restfulResponse.getHeader(Header.WARNING), is("object is immutable")); // not a good message, but as per spec
-
- // hmmm... what is the media type, though? the spec doesn't say. testing for a generic one.
- assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(MediaType.APPLICATION_JSON));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/ZzzToDo_DomainServiceTest_req_nonidempotent_fail_method_not_allowed.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/ZzzToDo_DomainServiceTest_req_nonidempotent_fail_method_not_allowed.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/ZzzToDo_DomainServiceTest_req_nonidempotent_fail_method_not_allowed.java
deleted file mode 100644
index 957d767..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/ZzzToDo_DomainServiceTest_req_nonidempotent_fail_method_not_allowed.java
+++ /dev/null
@@ -1,112 +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.domainservice.serviceId.action.invoke;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasStatus;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.hamcrest.Matchers;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-
-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.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.domainobjects.ActionResultRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.apache.isis.viewer.restfulobjects.tck.Util;
-
-public class ZzzToDo_DomainServiceTest_req_nonidempotent_fail_method_not_allowed {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- private DomainServiceResource serviceResource;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
-
- serviceResource = client.getDomainServiceResource();
- }
-
- @Ignore("to write - copied from req_safe")
- @Test
- public void usingClientFollow() throws Exception {
-
- // given, when
- final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subListWithOptionalRange");
- final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
-
- final LinkRepresentation invokeLink = actionRepr.getInvoke();
-
- assertThat(invokeLink, isLink(client)
- .rel(Rel.INVOKE)
- .httpMethod(RestfulHttpMethod.GET)
- .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subListWithOptionalRange/invoke"))
- .build());
-
- invokeLink.withMethod(RestfulHttpMethod.POST);
-
- // when
- JsonRepresentation args = JsonRepresentation.newMap();
- args = JsonRepresentation.newMap();
- args.mapPut("id.value", 123);
-
- final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
-
- // then
- thenResponseIsErrorWithInvalidReason(restfulResponse);
- }
-
-
- // not possible to test using resourceProxy
-
-
- private static void thenResponseIsErrorWithInvalidReason(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
- assertThat(restfulResponse, hasStatus(HttpStatusCode.METHOD_NOT_ALLOWED));
- assertThat(restfulResponse.getHeader(Header.WARNING), is("object is immutable")); // not a good message, but as per spec
-
- // hmmm... what is the media type, though? the spec doesn't say. testing for a generic one.
- assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(MediaType.APPLICATION_JSON));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/ZzzToDo_DomainServiceTest_req_safe_fail_method_not_allowed.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/ZzzToDo_DomainServiceTest_req_safe_fail_method_not_allowed.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/ZzzToDo_DomainServiceTest_req_safe_fail_method_not_allowed.java
deleted file mode 100644
index b7eec2a..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/ZzzToDo_DomainServiceTest_req_safe_fail_method_not_allowed.java
+++ /dev/null
@@ -1,112 +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.domainservice.serviceId.action.invoke;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasStatus;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.hamcrest.Matchers;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-
-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.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.domainobjects.ActionResultRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.apache.isis.viewer.restfulobjects.tck.Util;
-
-public class ZzzToDo_DomainServiceTest_req_safe_fail_method_not_allowed {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- private DomainServiceResource serviceResource;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
-
- serviceResource = client.getDomainServiceResource();
- }
-
- @Ignore("currently failing")
- @Test
- public void usingClientFollow() throws Exception {
-
- // given, when
- final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subListWithOptionalRange");
- final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
-
- final LinkRepresentation invokeLink = actionRepr.getInvoke();
-
- assertThat(invokeLink, isLink(client)
- .rel(Rel.INVOKE)
- .httpMethod(RestfulHttpMethod.GET)
- .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subListWithOptionalRange/invoke"))
- .build());
-
- invokeLink.withMethod(RestfulHttpMethod.POST);
-
- // when
- JsonRepresentation args = JsonRepresentation.newMap();
- args = JsonRepresentation.newMap();
- args.mapPut("id.value", 123);
-
- final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
-
- // then
- thenResponseIsErrorWithInvalidReason(restfulResponse);
- }
-
-
- // not possible to test using resourceProxy
-
-
- private static void thenResponseIsErrorWithInvalidReason(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
- assertThat(restfulResponse, hasStatus(HttpStatusCode.METHOD_NOT_ALLOWED));
- assertThat(restfulResponse.getHeader(Header.WARNING), is("object is immutable")); // not a good message, but as per spec
-
- // hmmm... what is the media type, though? the spec doesn't say. testing for a generic one.
- assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(MediaType.APPLICATION_JSON));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Delete_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Delete_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Delete_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..87f3082
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Delete_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.homepage.root;
+
+public class Delete_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_thenRepresentation_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_thenRepresentation_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_thenRepresentation_ok.java
new file mode 100644
index 0000000..9b1c96b
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_thenRepresentation_ok.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.root;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isArray;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.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 Get_thenRepresentation_ok {
+
+ @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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_thenRequestHeaders_Accept_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_thenRequestHeaders_Accept_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_thenRequestHeaders_Accept_ok.java
new file mode 100644
index 0000000..af0a654
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_thenRequestHeaders_Accept_ok.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.root;
+
+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 Get_thenRequestHeaders_Accept_ok {
+
+ @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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_thenResponseHeaders_CacheControl_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_thenResponseHeaders_CacheControl_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_thenResponseHeaders_CacheControl_ok.java
new file mode 100644
index 0000000..783857e
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_thenResponseHeaders_CacheControl_ok.java
@@ -0,0 +1,72 @@
+/*
+ * 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.root;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasMaxAge;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasParameter;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasSubType;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.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 Get_thenResponseHeaders_CacheControl_ok {
+
+ @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 ok() throws Exception {
+ // given
+ final Response resp = resource.homePage();
+
+ // when
+ final RestfulResponse<HomePageRepresentation> restfulResponse = RestfulResponse.ofT(resp);
+
+ // 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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_thenResponseHeaders_ContentType_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_thenResponseHeaders_ContentType_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_thenResponseHeaders_ContentType_ok.java
new file mode 100644
index 0000000..18b259d
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_thenResponseHeaders_ContentType_ok.java
@@ -0,0 +1,74 @@
+/*
+ * 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.root;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasMaxAge;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasParameter;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasSubType;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.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 Get_thenResponseHeaders_ContentType_ok {
+
+ @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 ok() 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()));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_whenQueryArg_xRoFollowLinks_thenRepresentation_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_whenQueryArg_xRoFollowLinks_thenRepresentation_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_whenQueryArg_xRoFollowLinks_thenRepresentation_ok.java
new file mode 100644
index 0000000..92b1593
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_whenQueryArg_xRoFollowLinks_thenRepresentation_ok.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.root;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isArray;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.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 Get_whenQueryArg_xRoFollowLinks_thenRepresentation_ok {
+
+ @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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java
new file mode 100644
index 0000000..3406652
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.homepage.root;
+
+public class Get_whenRequestHeaders_Accept_isInvalid_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/HomePageTest_req_header_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/HomePageTest_req_header_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/HomePageTest_req_header_accept.java
deleted file mode 100644
index 0a25822..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/HomePageTest_req_header_accept.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.homepage.root;
-
-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 HomePageTest_req_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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/HomePageTest_req_queryargs_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/HomePageTest_req_queryargs_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/HomePageTest_req_queryargs_xrofollowlinks.java
deleted file mode 100644
index 758eb9a..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/HomePageTest_req_queryargs_xrofollowlinks.java
+++ /dev/null
@@ -1,168 +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.homepage.root;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.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 HomePageTest_req_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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/HomePageTest_resp_headers.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/HomePageTest_resp_headers.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/HomePageTest_resp_headers.java
deleted file mode 100644
index 80386c1..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/HomePageTest_resp_headers.java
+++ /dev/null
@@ -1,79 +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.homepage.root;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasMaxAge;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasParameter;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasSubType;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.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 HomePageTest_resp_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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/HomePageTest_resp_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/HomePageTest_resp_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/HomePageTest_resp_representation.java
deleted file mode 100644
index 9152369..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/HomePageTest_resp_representation.java
+++ /dev/null
@@ -1,111 +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.homepage.root;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.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 HomePageTest_resp_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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Post_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Post_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Post_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..6e55275
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Post_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.homepage.root;
+
+public class Post_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Put_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Put_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Put_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..e26e441
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Put_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.homepage.root;
+
+public class Put_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Delete_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Delete_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Delete_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..9ac6b60
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Delete_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.objectsoftype;
+
+public class Delete_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Get_ResponseHeaders_CacheControl_ok_TOFIX.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Get_ResponseHeaders_CacheControl_ok_TOFIX.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Get_ResponseHeaders_CacheControl_ok_TOFIX.java
new file mode 100644
index 0000000..814d461
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Get_ResponseHeaders_CacheControl_ok_TOFIX.java
@@ -0,0 +1,61 @@
+/*
+ * 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.objectsoftype;
+
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+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 Get_ResponseHeaders_CacheControl_ok_TOFIX {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ }
+
+ @Ignore
+ @Test
+ public void noCaching() throws Exception {
+
+ }
+
+ @Ignore
+ @Test
+ public void shortTermCaching() throws Exception {
+
+ }
+
+ @Ignore
+ @Test
+ public void longTermCaching() throws Exception {
+
+ }
+
+
+}
[8/9] ISIS-233: adding new test stubs (TODOs)
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/ZzzTodo_removeFrom_fail_method_not_allowed.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/ZzzTodo_removeFrom_fail_method_not_allowed.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/ZzzTodo_removeFrom_fail_method_not_allowed.java
deleted file mode 100644
index adcba23..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/ZzzTodo_removeFrom_fail_method_not_allowed.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
-
-public class ZzzTodo_removeFrom_fail_method_not_allowed {
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java
new file mode 100644
index 0000000..fd859ff
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Delete_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java
new file mode 100644
index 0000000..05df435
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Delete_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenRepresentation_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenRepresentation_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenRepresentation_ok_TODO.java
new file mode 100644
index 0000000..e13e548
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenRepresentation_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Delete_thenRepresentation_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_whenNoArg_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_whenNoArg_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_whenNoArg_bad_TODO.java
new file mode 100644
index 0000000..d11dbb5
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_whenNoArg_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Delete_whenNoArg_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenRepresentation_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenRepresentation_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenRepresentation_ok_TODO.java
new file mode 100644
index 0000000..ef674ce
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenRepresentation_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Get_thenRepresentation_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenHrefArg_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenHrefArg_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenHrefArg_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..1a479fc
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenHrefArg_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Get_whenHrefArg_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenQueryArg_xRoFollowLinks_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenQueryArg_xRoFollowLinks_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenQueryArg_xRoFollowLinks_ok_TODO.java
new file mode 100644
index 0000000..4d483a2
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenQueryArg_xRoFollowLinks_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Get_whenQueryArg_xRoFollowLinks_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenRequestHeaders_Accept_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenRequestHeaders_Accept_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenRequestHeaders_Accept_ok_TODO.java
new file mode 100644
index 0000000..9b74dea
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenRequestHeaders_Accept_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Get_whenRequestHeaders_Accept_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenRequestHeaders_Accept_whenInvalid_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenRequestHeaders_Accept_whenInvalid_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenRequestHeaders_Accept_whenInvalid_bad_TODO.java
new file mode 100644
index 0000000..bc3dd33
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenRequestHeaders_Accept_whenInvalid_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Get_whenRequestHeaders_Accept_whenInvalid_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenResponseHeaders_CacheControl_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenResponseHeaders_CacheControl_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenResponseHeaders_CacheControl_ok_TODO.java
new file mode 100644
index 0000000..5a93877
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenResponseHeaders_CacheControl_ok_TODO.java
@@ -0,0 +1,61 @@
+/*
+ * 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.domainobject.oid.property;
+
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+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 Get_whenResponseHeaders_CacheControl_ok_TODO {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ }
+
+ @Ignore
+ @Test
+ public void noCaching() throws Exception {
+
+ }
+
+ @Ignore
+ @Test
+ public void shortTermCaching() throws Exception {
+
+ }
+
+ @Ignore
+ @Test
+ public void longTermCaching() throws Exception {
+
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Post_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Post_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Post_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..32804e9
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Post_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Post_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java
new file mode 100644
index 0000000..d4b2fc8
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Put_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java
new file mode 100644
index 0000000..8a6a4c4
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Put_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenRepresentation_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenRepresentation_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenRepresentation_ok_TODO.java
new file mode 100644
index 0000000..6ba2663
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenRepresentation_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Put_thenRepresentation_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenNoArg_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenNoArg_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenNoArg_bad_TODO.java
new file mode 100644
index 0000000..4b53185
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenNoArg_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Put_whenNoArg_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/ZzzTodo_clear_fail_method_not_allowed.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/ZzzTodo_clear_fail_method_not_allowed.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/ZzzTodo_clear_fail_method_not_allowed.java
deleted file mode 100644
index 20dd6dd..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/ZzzTodo_clear_fail_method_not_allowed.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
-
-public class ZzzTodo_clear_fail_method_not_allowed {
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/ZzzTodo_details_fail_method_not_allowed.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/ZzzTodo_details_fail_method_not_allowed.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/ZzzTodo_details_fail_method_not_allowed.java
deleted file mode 100644
index 5235bbc..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/ZzzTodo_details_fail_method_not_allowed.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
-
-public class ZzzTodo_details_fail_method_not_allowed {
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/ZzzTodo_modify_fail_method_not_allowed.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/ZzzTodo_modify_fail_method_not_allowed.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/ZzzTodo_modify_fail_method_not_allowed.java
deleted file mode 100644
index b001fac..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/ZzzTodo_modify_fail_method_not_allowed.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
-
-public class ZzzTodo_modify_fail_method_not_allowed {
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Delete_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Delete_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Delete_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..ac8b5de
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Delete_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action;
+
+public class Delete_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenRepresentation_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenRepresentation_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenRepresentation_ok_TODO.java
new file mode 100644
index 0000000..d4cc93b
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenRepresentation_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action;
+
+public class Get_thenRepresentation_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenResponseHeaders_CacheControl_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenResponseHeaders_CacheControl_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenResponseHeaders_CacheControl_ok_TODO.java
new file mode 100644
index 0000000..c767beb
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenResponseHeaders_CacheControl_ok_TODO.java
@@ -0,0 +1,61 @@
+/*
+ * 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.domainobjectorservice.id.action;
+
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+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 Get_thenResponseHeaders_CacheControl_ok_TODO {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ }
+
+ @Ignore
+ @Test
+ public void noCaching() throws Exception {
+
+ }
+
+ @Ignore
+ @Test
+ public void shortTermCaching() throws Exception {
+
+ }
+
+ @Ignore
+ @Test
+ public void longTermCaching() throws Exception {
+
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenCallWithWrongHttpMethod_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenCallWithWrongHttpMethod_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenCallWithWrongHttpMethod_bad_TODO.java
new file mode 100644
index 0000000..9c731b6
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenCallWithWrongHttpMethod_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action;
+
+public class Get_whenCallWithWrongHttpMethod_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenNotFound_bad.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenNotFound_bad.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenNotFound_bad.java
new file mode 100644
index 0000000..b85790b
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenNotFound_bad.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.domainobjectorservice.id.action;
+
+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 Get_whenNotFound_bad {
+
+ @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/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenQueryArg_xRoFollowLinks_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenQueryArg_xRoFollowLinks_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenQueryArg_xRoFollowLinks_ok_TODO.java
new file mode 100644
index 0000000..13c37f0
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenQueryArg_xRoFollowLinks_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action;
+
+public class Get_whenQueryArg_xRoFollowLinks_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java
new file mode 100644
index 0000000..9a6cb3e
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action;
+
+public class Get_whenRequestHeaders_Accept_isInvalid_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenRequestHeaders_Accept_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenRequestHeaders_Accept_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenRequestHeaders_Accept_ok_TODO.java
new file mode 100644
index 0000000..cafdc6c
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenRequestHeaders_Accept_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action;
+
+public class Get_whenRequestHeaders_Accept_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Post_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Post_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Post_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..2b29cad
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Post_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action;
+
+public class Post_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Put_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Put_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Put_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..83688ab
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Put_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action;
+
+public class Put_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Delete_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Delete_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Delete_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..3d75cc3
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Delete_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Delete_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenActionSemanticsOfIdempotent_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenActionSemanticsOfIdempotent_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenActionSemanticsOfIdempotent_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..836a541
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenActionSemanticsOfIdempotent_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,112 @@
+/*
+ * 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.domainobjectorservice.id.action.invoke;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasStatus;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.hamcrest.Matchers;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+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.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.domainobjects.ActionResultRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+
+public class Get_givenActionSemanticsOfIdempotent_thenResponseCode_205_bad_TODO {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ private DomainServiceResource serviceResource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+
+ serviceResource = client.getDomainServiceResource();
+ }
+
+ @Ignore("to write - copied from req_safe")
+ @Test
+ public void usingClientFollow() throws Exception {
+
+ // given, when
+ final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subListWithOptionalRange");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+
+ assertThat(invokeLink, isLink(client)
+ .rel(Rel.INVOKE)
+ .httpMethod(RestfulHttpMethod.GET)
+ .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subListWithOptionalRange/invoke"))
+ .build());
+
+ invokeLink.withMethod(RestfulHttpMethod.POST);
+
+ // when
+ JsonRepresentation args = JsonRepresentation.newMap();
+ args = JsonRepresentation.newMap();
+ args.mapPut("id.value", 123);
+
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ // then
+ thenResponseIsErrorWithInvalidReason(restfulResponse);
+ }
+
+
+ // not possible to test using resourceProxy
+
+
+ private static void thenResponseIsErrorWithInvalidReason(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
+ assertThat(restfulResponse, hasStatus(HttpStatusCode.METHOD_NOT_ALLOWED));
+ assertThat(restfulResponse.getHeader(Header.WARNING), is("object is immutable")); // not a good message, but as per spec
+
+ // hmmm... what is the media type, though? the spec doesn't say. testing for a generic one.
+ assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(MediaType.APPLICATION_JSON));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenActionSemanticsOfNotIdempotent_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenActionSemanticsOfNotIdempotent_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenActionSemanticsOfNotIdempotent_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..4ccc054
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenActionSemanticsOfNotIdempotent_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,112 @@
+/*
+ * 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.domainobjectorservice.id.action.invoke;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasStatus;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.hamcrest.Matchers;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+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.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.domainobjects.ActionResultRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+
+public class Get_givenActionSemanticsOfNotIdempotent_thenResponseCode_205_bad_TODO {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ private DomainServiceResource serviceResource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+
+ serviceResource = client.getDomainServiceResource();
+ }
+
+ @Ignore("to write - copied from req_safe")
+ @Test
+ public void usingClientFollow() throws Exception {
+
+ // given, when
+ final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subListWithOptionalRange");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+
+ assertThat(invokeLink, isLink(client)
+ .rel(Rel.INVOKE)
+ .httpMethod(RestfulHttpMethod.GET)
+ .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subListWithOptionalRange/invoke"))
+ .build());
+
+ invokeLink.withMethod(RestfulHttpMethod.POST);
+
+ // when
+ JsonRepresentation args = JsonRepresentation.newMap();
+ args = JsonRepresentation.newMap();
+ args.mapPut("id.value", 123);
+
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ // then
+ thenResponseIsErrorWithInvalidReason(restfulResponse);
+ }
+
+
+ // not possible to test using resourceProxy
+
+
+ private static void thenResponseIsErrorWithInvalidReason(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
+ assertThat(restfulResponse, hasStatus(HttpStatusCode.METHOD_NOT_ALLOWED));
+ assertThat(restfulResponse.getHeader(Header.WARNING), is("object is immutable")); // not a good message, but as per spec
+
+ // hmmm... what is the media type, though? the spec doesn't say. testing for a generic one.
+ assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(MediaType.APPLICATION_JSON));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenActionSemanticsOfSafe_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenActionSemanticsOfSafe_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenActionSemanticsOfSafe_ok.java
new file mode 100644
index 0000000..5e17e74
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenActionSemanticsOfSafe_ok.java
@@ -0,0 +1,112 @@
+/*
+ * 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.domainobjectorservice.id.action.invoke;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.Response;
+
+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.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulMediaType;
+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.domainobjects.ActionResultRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ActionResultRepresentation.ResultType;
+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.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.hamcrest.Matchers;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class Get_givenActionSemanticsOfSafe_ok {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ private DomainServiceResource serviceResource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+
+ serviceResource = client.getDomainServiceResource();
+ }
+
+ @Test
+ public void usingClientFollow() throws Exception {
+
+ // given
+ final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "list");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+
+ assertThat(invokeLink, isLink(client)
+ .rel(Rel.INVOKE)
+ .httpMethod(RestfulHttpMethod.GET)
+ .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/list/invoke"))
+ .arguments(JsonRepresentation.newMap())
+ .build());
+
+ // when
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink);
+
+ // then
+ then(restfulResponse);
+ }
+
+ private static void then(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
+
+ assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(RestfulMediaType.APPLICATION_JSON_ACTION_RESULT));
+ final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
+
+ assertThat(actionResultRepr.getResultType(), is(ResultType.LIST));
+ final ListRepresentation listRepr = actionResultRepr.getResult().as(ListRepresentation.class);
+ assertThat(listRepr.getValue().size(), is(5));
+ }
+
+
+ @Test
+ public void usingResourceProxy() throws Exception {
+
+ // given, when
+ Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "list", null);
+ RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ then(restfulResponse);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java
new file mode 100644
index 0000000..00b5a15
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Get_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java
new file mode 100644
index 0000000..ef4d708
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Get_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenForbidden_bad.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenForbidden_bad.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenForbidden_bad.java
new file mode 100644
index 0000000..2348041
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenForbidden_bad.java
@@ -0,0 +1,122 @@
+/*
+ * 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.domainobjectorservice.id.action.invoke;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasStatus;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.hamcrest.Matchers;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+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.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.domainobjects.ActionResultRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+
+public class Get_givenForbidden_bad {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ private DomainServiceResource serviceResource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+
+ serviceResource = client.getDomainServiceResource();
+ }
+
+ @Test
+ public void usingClientFollow() throws Exception {
+
+ // given, when
+ final JsonRepresentation givenAction = Util.givenAction(client, "BusinessRulesEntities", "visibleButNotInvocableAction");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ // then
+ final String disabledReason = actionRepr.getDisabledReason();
+ assertThat(disabledReason, is("Always disabled"));
+
+
+ final LinkRepresentation invokeLink = new LinkRepresentation()
+ .withRel(Rel.INVOKE)
+ .withHref("http://localhost:39393/services/BusinessRulesEntities/actions/visibleButNotInvocableAction/invoke");
+
+ // when
+ JsonRepresentation args = JsonRepresentation.newMap();
+ args = JsonRepresentation.newMap();
+ args.mapPut("id.value", 123);
+
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ // then
+ thenResponseIsErrorWithInvalidReason(restfulResponse, disabledReason);
+ }
+
+
+ @Test
+ public void usingResourceProxy() throws Exception {
+
+ // given, when
+ JsonRepresentation args = JsonRepresentation.newMap();
+ args.mapPut("id.value", 123);
+
+ Response response = serviceResource.invokeActionQueryOnly("BusinessRulesEntities", "visibleButNotInvocableAction", UrlEncodingUtils.urlEncode(args));
+ RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ // then
+ thenResponseIsErrorWithInvalidReason(restfulResponse, "Always disabled");
+ }
+
+ private static void thenResponseIsErrorWithInvalidReason(final RestfulResponse<ActionResultRepresentation> restfulResponse, String disabledReason) throws JsonParseException, JsonMappingException, IOException {
+ assertThat(restfulResponse, hasStatus(HttpStatusCode.FORBIDDEN));
+ assertThat(restfulResponse.getHeader(Header.WARNING), is(disabledReason));
+
+ // hmmm... what is the media type, though? the spec doesn't say. testing for a generic one.
+ assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(MediaType.APPLICATION_JSON));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenMandatorySimpleArg_whenArgMissing_bad.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenMandatorySimpleArg_whenArgMissing_bad.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenMandatorySimpleArg_whenArgMissing_bad.java
new file mode 100644
index 0000000..0bc2c4b
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenMandatorySimpleArg_whenArgMissing_bad.java
@@ -0,0 +1,133 @@
+/*
+ * 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.domainobjectorservice.id.action.invoke;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasStatus;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.hamcrest.Matchers;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+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.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.domainobjects.ActionResultRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+
+public class Get_givenMandatorySimpleArg_whenArgMissing_bad {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ private DomainServiceResource serviceResource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+
+ serviceResource = client.getDomainServiceResource();
+ }
+
+ @Test
+ public void usingClientFollow() throws Exception {
+
+ // given
+ final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subList");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+
+ assertThat(invokeLink, isLink(client)
+ .rel(Rel.INVOKE)
+ .httpMethod(RestfulHttpMethod.GET)
+ .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subList/invoke"))
+ .build());
+
+ JsonRepresentation args =invokeLink.getArguments();
+ assertThat(args.size(), is(2));
+ assertThat(args, RestfulMatchers.mapHas("from"));
+ assertThat(args, RestfulMatchers.mapHas("to"));
+
+ // when
+ args = JsonRepresentation.newMap();
+ // nothing for 'from'
+ args.mapPut("to.value", 0);
+ assertThat(args.size(), is(1));
+
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ // then
+ thenResponseIsErrorWithInvalidReason(restfulResponse);
+ }
+
+
+ @Test
+ public void usingResourceProxy() throws Exception {
+
+ // given, when
+ JsonRepresentation args = JsonRepresentation.newMap();
+ // nothing for 'from'
+ args.mapPut("to.value", 0);
+ Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "subList", UrlEncodingUtils.urlEncode(args));
+ RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ // then
+ thenResponseIsErrorWithInvalidReason(restfulResponse);
+ }
+
+ private static void thenResponseIsErrorWithInvalidReason(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
+ assertThat(restfulResponse, hasStatus(HttpStatusCode.BAD_REQUEST));
+ assertThat(restfulResponse.getHeader(Header.WARNING), is("No argument found for (mandatory) parameter 'from'"));
+
+ // hmmm... what is the media type, though? the spec doesn't say. testing for a generic one.
+ assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(MediaType.APPLICATION_JSON));
+
+ RestfulResponse<JsonRepresentation> restfulResponseOfError = restfulResponse.wraps(JsonRepresentation.class);
+ JsonRepresentation repr = restfulResponseOfError.getEntity();
+
+ assertThat(repr.getString("x-ro-invalidReason"), is("No argument found for (mandatory) parameter 'from'"));
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenMandatorySimpleArg_whenArgNullValue_bad.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenMandatorySimpleArg_whenArgNullValue_bad.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenMandatorySimpleArg_whenArgNullValue_bad.java
new file mode 100644
index 0000000..484f988
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenMandatorySimpleArg_whenArgNullValue_bad.java
@@ -0,0 +1,133 @@
+/*
+ * 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.domainobjectorservice.id.action.invoke;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasStatus;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.hamcrest.Matchers;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+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.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.domainobjects.ActionResultRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.util.UrlEncodingUtils;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+
+public class Get_givenMandatorySimpleArg_whenArgNullValue_bad {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ private DomainServiceResource serviceResource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+
+ serviceResource = client.getDomainServiceResource();
+ }
+
+ @Test
+ public void usingClientFollow() throws Exception {
+
+ // given
+ final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "subList");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+
+ assertThat(invokeLink, isLink(client)
+ .rel(Rel.INVOKE)
+ .httpMethod(RestfulHttpMethod.GET)
+ .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/subList/invoke"))
+ .build());
+
+ JsonRepresentation args =invokeLink.getArguments();
+ assertThat(args.size(), is(2));
+ assertThat(args, RestfulMatchers.mapHas("from"));
+ assertThat(args, RestfulMatchers.mapHas("to"));
+
+ // when
+ args.mapPut("from.value", (Integer)null);
+ args.mapPut("to.value", 0);
+
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ // then
+ thenResponseIsErrorWithInvalidReason(restfulResponse);
+ }
+
+
+ @Test
+ public void usingResourceProxy() throws Exception {
+
+ // given, when
+ JsonRepresentation args = JsonRepresentation.newMap();
+ args.mapPut("from.value", (Integer)null);
+ args.mapPut("to.value", 0);
+ Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "subList", UrlEncodingUtils.urlEncode(args));
+ RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ // then
+ thenResponseIsErrorWithInvalidReason(restfulResponse);
+ }
+
+ private static void thenResponseIsErrorWithInvalidReason(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
+ assertThat(restfulResponse, hasStatus(HttpStatusCode.VALIDATION_FAILED));
+ assertThat(restfulResponse.getHeader(Header.WARNING), is("Validation failed, see body for details"));
+
+ // hmmm... what is the media type, though? the spec doesn't say. testing for a generic one.
+ assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(MediaType.APPLICATION_JSON));
+
+ RestfulResponse<JsonRepresentation> restfulResponseOfError = restfulResponse.wraps(JsonRepresentation.class);
+ JsonRepresentation repr = restfulResponseOfError.getEntity();
+
+ assertThat(repr.getString("from.invalidReason"), is("Mandatory"));
+ // TODO: really ought to be null, but ObjectActionImpl.isProposedArgumentSetValidResultSet also checks that each argument is valid
+ assertThat(repr.getString("x-ro-invalidReason"), is("Mandatory"));
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenMultipleArgsOfEveryType_whenArgsCorrect_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenMultipleArgsOfEveryType_whenArgsCorrect_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenMultipleArgsOfEveryType_whenArgsCorrect_ok_TODO.java
new file mode 100644
index 0000000..1920ec6
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenMultipleArgsOfEveryType_whenArgsCorrect_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Get_givenMultipleArgsOfEveryType_whenArgsCorrect_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenNoArgRequired_whenNoArgProvided_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenNoArgRequired_whenNoArgProvided_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenNoArgRequired_whenNoArgProvided_ok.java
new file mode 100644
index 0000000..fe7ed1b
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenNoArgRequired_whenNoArgProvided_ok.java
@@ -0,0 +1,112 @@
+/*
+ * 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.domainobjectorservice.id.action.invoke;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.Response;
+
+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.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulMediaType;
+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.domainobjects.ActionResultRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ActionResultRepresentation.ResultType;
+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.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.hamcrest.Matchers;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class Get_givenNoArgRequired_whenNoArgProvided_ok {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ private DomainServiceResource serviceResource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+
+ serviceResource = client.getDomainServiceResource();
+ }
+
+ @Test
+ public void usingClientFollow() throws Exception {
+
+ // given
+ final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "list");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+
+ assertThat(invokeLink, isLink(client)
+ .rel(Rel.INVOKE)
+ .httpMethod(RestfulHttpMethod.GET)
+ .href(Matchers.endsWith(":39393/services/ActionsEntities/actions/list/invoke"))
+ .arguments(JsonRepresentation.newMap())
+ .build());
+
+ // when
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink);
+
+ // then
+ then(restfulResponse);
+ }
+
+ private static void then(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
+
+ assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(RestfulMediaType.APPLICATION_JSON_ACTION_RESULT));
+ final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
+
+ assertThat(actionResultRepr.getResultType(), is(ResultType.LIST));
+ final ListRepresentation listRepr = actionResultRepr.getResult().as(ListRepresentation.class);
+ assertThat(listRepr.getValue().size(), is(5));
+ }
+
+
+ @Test
+ public void usingResourceProxy() throws Exception {
+
+ // given, when
+ Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "list", null);
+ RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ then(restfulResponse);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ca8a43ee/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenNoValidatableArgs_whenQueryArgXroValidateOnly_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenNoValidatableArgs_whenQueryArgXroValidateOnly_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenNoValidatableArgs_whenQueryArgXroValidateOnly_ok_TODO.java
new file mode 100644
index 0000000..30dd0fe
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenNoValidatableArgs_whenQueryArgXroValidateOnly_ok_TODO.java
@@ -0,0 +1,20 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class Get_givenNoValidatableArgs_whenQueryArgXroValidateOnly_ok_TODO {
+
+ @Ignore
+ @Test
+ public void success() throws Exception {
+ // should return 204 (13.3)
+ }
+
+ @Ignore
+ @Test
+ public void failure() throws Exception {
+ // should return 422, etc
+ }
+
+}