You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2013/04/27 20:31:40 UTC
[21/50] [abbrv] ISIS-233: more testing on actions
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/RestfulMatchers.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/RestfulMatchers.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/RestfulMatchers.java
new file mode 100644
index 0000000..68ff89b
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/RestfulMatchers.java
@@ -0,0 +1,560 @@
+/*
+ * 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;
+
+import javax.ws.rs.core.CacheControl;
+import javax.ws.rs.core.MediaType;
+
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation.HasLinkToSelf;
+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.hamcrest.Description;
+import org.hamcrest.Matcher;
+import org.hamcrest.TypeSafeMatcher;
+import org.junit.Assert;
+
+import com.google.common.base.Objects;
+
+public class RestfulMatchers {
+
+ public static <T extends JsonRepresentation> Matcher<T> isMap() {
+ return new TypeSafeMatcher<T>() {
+
+ @Override
+ public void describeTo(final Description description) {
+ description.appendText("map");
+ }
+
+ @Override
+ public boolean matchesSafely(final T item) {
+ return item != null && item.isMap();
+ }
+ };
+ }
+
+ public static <T extends JsonRepresentation> Matcher<T> isArray() {
+ return new TypeSafeMatcher<T>() {
+
+ @Override
+ public void describeTo(final Description description) {
+ description.appendText("array");
+ }
+
+ @Override
+ public boolean matchesSafely(final T item) {
+ return item != null && item.isArray();
+ }
+ };
+ }
+
+ public static <T extends JsonRepresentation> Matcher<T> isString() {
+ return new TypeSafeMatcher<T>() {
+
+ @Override
+ public void describeTo(final Description description) {
+ description.appendText("string");
+ }
+
+ @Override
+ public boolean matchesSafely(final T item) {
+ return item != null && item.isValue() && item.asJsonNode().isTextual();
+ }
+ };
+ }
+
+ public static Matcher<LinkRepresentation> isLink(final RestfulHttpMethod httpMethod) {
+ return new TypeSafeMatcher<LinkRepresentation>() {
+
+ @Override
+ public void describeTo(final Description description) {
+ description.appendText("link with method " + httpMethod.name());
+ }
+
+ @Override
+ public boolean matchesSafely(final LinkRepresentation item) {
+ return item != null && item.getHttpMethod() == httpMethod;
+ }
+ };
+ }
+
+ public static <T extends JsonRepresentation> Matcher<T> isFollowableLinkToSelf(final RestfulClient client) {
+ return new TypeSafeMatcher<T>() {
+
+ @Override
+ public void describeTo(final Description description) {
+ description.appendText("links to self");
+ }
+
+ @Override
+ public boolean matchesSafely(final T item) {
+ final HasLinkToSelf initialRepr = (HasLinkToSelf) item; // no easy
+ // way to do
+ // this with
+ // Hamcrest
+ // when
+ try {
+ final RestfulResponse<T> followedResp = client.followT(initialRepr.getSelf());
+
+ // then
+ final T repr2 = followedResp.getEntity();
+ final HasLinkToSelf repr2AsLinksToSelf = (HasLinkToSelf) repr2;
+ return initialRepr.getSelf().equals(repr2AsLinksToSelf.getSelf());
+ } catch (final Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ };
+ }
+
+ public static <T extends JsonRepresentation> void assertThat(final T actual, final AbstractMatcherBuilder<T> matcherBuilder) {
+ Assert.assertThat(actual, matcherBuilder.build());
+ }
+
+ public static LinkMatcherBuilder isLink(final RestfulClient client) {
+ return new LinkMatcherBuilder(client);
+ }
+
+ public static LinkMatcherBuilder isLink() {
+ return new LinkMatcherBuilder(null);
+ }
+
+ public static abstract class AbstractMatcherBuilder<T extends JsonRepresentation> {
+ protected RestfulClient client;
+
+ public AbstractMatcherBuilder() {
+ this(null);
+ }
+
+ public AbstractMatcherBuilder(final RestfulClient client) {
+ this.client = client;
+ }
+
+ public abstract Matcher<T> build();
+ }
+
+ public static class LinkMatcherBuilder extends AbstractMatcherBuilder<JsonRepresentation> {
+ private HttpStatusCode statusCode;
+ private RestfulHttpMethod httpMethod;
+ private String rel;
+ private String href;
+ private Matcher<String> relNameMatcher;
+ private Matcher<String> hrefMatcher;
+ private Matcher<JsonRepresentation> valueMatcher;
+ private Boolean novalue;
+ private MediaType mediaType;
+ private String typeParameterName;
+ private String typeParameterValue;
+ private String selfHref;
+ private JsonRepresentation arguments;
+
+ private LinkMatcherBuilder(final RestfulClient client) {
+ super(client);
+ }
+
+ public LinkMatcherBuilder rel(final String rel) {
+ this.rel = rel;
+ return this;
+ }
+
+ public LinkMatcherBuilder rel(final Rel rel) {
+ this.rel = rel.getName();
+ return this;
+ }
+
+ public LinkMatcherBuilder rel(final Matcher<String> relNameMatcher) {
+ this.relNameMatcher = relNameMatcher;
+ return this;
+ }
+
+ public LinkMatcherBuilder href(final String href) {
+ this.href = href;
+ return this;
+ }
+
+ public LinkMatcherBuilder href(final Matcher<String> hrefMatcher) {
+ this.hrefMatcher = hrefMatcher;
+ return this;
+ }
+
+ public LinkMatcherBuilder httpMethod(final RestfulHttpMethod httpMethod) {
+ this.httpMethod = httpMethod;
+ return this;
+ }
+
+ public LinkMatcherBuilder type(final MediaType mediaType) {
+ this.mediaType = mediaType;
+ return this;
+ }
+
+ public LinkMatcherBuilder typeParameter(final String typeParameterName, final String typeParameterValue) {
+ this.typeParameterName = typeParameterName;
+ this.typeParameterValue = typeParameterValue;
+ return this;
+ }
+
+ public LinkMatcherBuilder arguments(JsonRepresentation arguments) {
+ this.arguments = arguments;
+ return this;
+ }
+
+ public LinkMatcherBuilder novalue() {
+ if (valueMatcher != null) {
+ throw new IllegalStateException("cannot assert on both there being a value and there not being a value");
+ }
+ this.novalue = true;
+ return this;
+ }
+
+ public LinkMatcherBuilder value(final Matcher<JsonRepresentation> valueMatcher) {
+ if (this.novalue != null) {
+ throw new IllegalStateException("cannot assert on both there being a value and there not being a value");
+ }
+ this.valueMatcher = valueMatcher;
+ return this;
+ }
+
+ public LinkMatcherBuilder returning(final HttpStatusCode statusCode) {
+ this.statusCode = statusCode;
+ return this;
+ }
+
+ public LinkMatcherBuilder responseEntityWithSelfHref(String selfHref) {
+ this.selfHref = selfHref;
+ return this;
+ }
+
+ @Override
+ public Matcher<JsonRepresentation> build() {
+ return new TypeSafeMatcher<JsonRepresentation>() {
+
+ @Override
+ public void describeTo(final Description description) {
+ description.appendText("a link");
+ if (rel != null) {
+ description.appendText(" with rel '").appendText(rel).appendText("'");
+ }
+ if (relNameMatcher != null) {
+ description.appendText(" with rel '");
+ relNameMatcher.describeTo(description);
+ }
+ if (href != null) {
+ description.appendText(" with href '").appendText(href).appendText("'");
+ }
+ if (hrefMatcher != null) {
+ description.appendText(" with href ");
+ hrefMatcher.describeTo(description);
+ }
+ if (httpMethod != null) {
+ description.appendText(" with method '").appendValue(httpMethod).appendText("'");
+ }
+ if (mediaType != null) {
+ description.appendText(" with type '").appendValue(mediaType).appendText("'");
+ }
+ if (typeParameterName != null) {
+ description.appendText(" with media type parameter '").appendText(typeParameterName).appendText("=").appendText(typeParameterValue).appendText("'");
+ }
+
+ if (arguments != null) {
+ description.appendText(" with arguments").appendText(arguments.toString());
+ }
+
+ if (novalue != null && novalue) {
+ description.appendText(" with no value");
+ }
+ if (valueMatcher != null) {
+ description.appendText(" with value ");
+ valueMatcher.describeTo(description);
+ }
+
+ // trigger link being followed
+ if (statusCode != null || selfHref != null) {
+ if (client == null) {
+ throw new IllegalStateException("require client in order to assert on statusCode");
+ }
+ description.appendText(" that when followed");
+ if (statusCode != null) {
+ description.appendText(" returns status " + statusCode);
+ }
+ if (statusCode != null || selfHref != null) {
+ description.appendText(" and");
+ }
+ if (selfHref != null) {
+ description.appendText(" has a response whose self.href is " + selfHref);
+ }
+ }
+ }
+
+ @Override
+ public boolean matchesSafely(final JsonRepresentation linkRepr) {
+ if (linkRepr == null) {
+ return false;
+ }
+ final LinkRepresentation link = linkRepr.asLink();
+ if (rel != null && !rel.equals(link.getRel())) {
+ return false;
+ }
+ if (relNameMatcher != null && !relNameMatcher.matches(link.getRel())) {
+ return false;
+ }
+ if (href != null && !href.equals(link.getHref())) {
+ return false;
+ }
+ if (hrefMatcher != null && !hrefMatcher.matches(link.getHref())) {
+ return false;
+ }
+ if (httpMethod != null && !httpMethod.equals(link.getHttpMethod())) {
+ return false;
+ }
+ if (mediaType != null && !mediaType.isCompatible(mediaType)) {
+ return false;
+ }
+ if (typeParameterName != null) {
+ final MediaType mediaType = link.getType();
+ final String parameterValue = mediaType.getParameters().get(typeParameterName);
+ if (!typeParameterValue.equals(parameterValue)) {
+ return false;
+ }
+ }
+ if (novalue != null && novalue && link.getValue() != null) {
+ return false;
+ }
+ if (arguments != null && !arguments.equals(link.getArguments())) {
+ return false;
+ }
+ if (valueMatcher != null && !valueMatcher.matches(link.getValue())) {
+ return false;
+ }
+
+ // follow link if criteria require it
+ RestfulResponse<JsonRepresentation> jsonResp = null;
+ if (statusCode != null || selfHref != null) {
+ if (client == null) {
+ return false;
+ }
+ try {
+ jsonResp = client.followT(link);
+ } catch (final Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ // assertions based on provided criteria
+ if (statusCode != null) {
+ if (jsonResp.getStatus() != statusCode) {
+ return false;
+ }
+ }
+ if (selfHref != null) {
+ JsonRepresentation entity;
+ try {
+ entity = jsonResp.getEntity();
+ } catch (Exception e) {
+ return false;
+ }
+ if(entity == null) {
+ return false;
+ }
+ LinkRepresentation selfLink = entity.getLink("links[rel=self]");
+ if(selfLink == null) {
+ return false;
+ }
+ if (!selfLink.getHref().equals(selfHref)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+ };
+ }
+
+
+ }
+
+ public static EntryMatcherBuilder entry(final String key) {
+ return new EntryMatcherBuilder(key);
+ }
+
+ public static class EntryMatcherBuilder extends AbstractMatcherBuilder<JsonRepresentation> {
+
+ private final String key;
+ private String value;
+
+ private EntryMatcherBuilder(final String key) {
+ this.key = key;
+ }
+
+ public EntryMatcherBuilder value(final String value) {
+ this.value = value;
+ return this;
+ }
+
+ @Override
+ public Matcher<JsonRepresentation> build() {
+ return new TypeSafeMatcher<JsonRepresentation>() {
+
+ @Override
+ public void describeTo(final Description description) {
+ description.appendText("map with entry with key: " + key);
+ if (value != null) {
+ description.appendText(", and value: " + value);
+ }
+ }
+
+ @Override
+ public boolean matchesSafely(final JsonRepresentation item) {
+ if (!item.isMap()) {
+ return false;
+ }
+ final String val = item.getString(key);
+ if (val == null) {
+ return false;
+ }
+ if (value != null && !value.equals(val)) {
+ return false;
+ }
+ return true;
+ }
+ };
+ }
+
+ }
+
+ public static Matcher<MediaType> hasType(final String type) {
+ return new TypeSafeMatcher<MediaType>() {
+
+ @Override
+ public void describeTo(final Description description) {
+ description.appendText("has type " + type);
+ }
+
+ @Override
+ public boolean matchesSafely(final MediaType item) {
+ return Objects.equal(type, item.getType());
+ }
+ };
+ }
+
+ public static Matcher<MediaType> hasSubType(final String subtype) {
+ return new TypeSafeMatcher<MediaType>() {
+
+ @Override
+ public void describeTo(final Description description) {
+ description.appendText("has subtype " + subtype);
+ }
+
+ @Override
+ public boolean matchesSafely(final MediaType item) {
+ return Objects.equal(subtype, item.getSubtype());
+ }
+ };
+ }
+
+ public static Matcher<MediaType> hasParameter(final String parameterName, final String parameterValue) {
+ return new TypeSafeMatcher<MediaType>() {
+
+ @Override
+ public void describeTo(final Description description) {
+ description.appendText(String.format("has parameter '%s' with value '%s'", parameterName, parameterValue));
+ }
+
+ @Override
+ public boolean matchesSafely(final MediaType item) {
+ final String paramValue = item.getParameters().get(parameterName);
+ return Objects.equal(paramValue, parameterValue);
+ }
+ };
+ }
+
+ public static Matcher<CacheControl> hasMaxAge(final int maxAge) {
+ return new TypeSafeMatcher<CacheControl>() {
+
+ @Override
+ public void describeTo(final Description description) {
+ description.appendText("has max age of " + maxAge + " secs");
+ }
+
+ @Override
+ public boolean matchesSafely(final CacheControl item) {
+ return maxAge == item.getMaxAge();
+ }
+ };
+ }
+
+ public static Matcher<? super JsonRepresentation> mapHas(final String key) {
+ return new TypeSafeMatcher<JsonRepresentation>() {
+
+ @Override
+ public void describeTo(Description description) {
+ description.appendText("is a map with key '" + key + "'");
+ }
+
+ @Override
+ protected boolean matchesSafely(JsonRepresentation item) {
+ return item.mapHas(key);
+ }
+ };
+ }
+
+ public static Matcher<? super MediaType> hasProfile(final String expectedMediaTypeAndProfileStr) {
+ final MediaType expectedMediaType = Header.CONTENT_TYPE.parse(expectedMediaTypeAndProfileStr);
+ final String expectedProfileIfAny = expectedMediaType.getParameters().get("profile");
+ return new TypeSafeMatcher<MediaType>() {
+
+ @Override
+ public void describeTo(Description description) {
+ description.appendText("is a media type 'application/json' with a profile parameter of '" + expectedMediaTypeAndProfileStr + '"');
+ }
+
+ @Override
+ protected boolean matchesSafely(MediaType item) {
+
+ if (!item.isCompatible(expectedMediaType)) {
+ return false;
+ }
+ String actualProfileIfAny = item.getParameters().get("profile");
+ return Objects.equal(expectedProfileIfAny, actualProfileIfAny);
+ }
+ };
+ }
+
+ public static Matcher<? super RestfulResponse<?>> hasStatus(final HttpStatusCode statusCode) {
+ return new TypeSafeMatcher<RestfulResponse<?>>() {
+
+ @Override
+ public void describeTo(Description description) {
+ description.appendText("has status code of " + statusCode);
+ }
+
+ @Override
+ protected boolean matchesSafely(RestfulResponse<?> item) {
+ return item.getStatus() == statusCode;
+ }
+ };
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/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
index 6fb5f43..8568b23 100644
--- 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
@@ -18,10 +18,10 @@
*/
package org.apache.isis.viewer.restfulobjects.tck.domainservice.root;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.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;
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/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
index 460d57d..4ea2892 100644
--- 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
@@ -18,10 +18,10 @@
*/
package org.apache.isis.viewer.restfulobjects.tck.domainservice.root;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
+import static org.apache.isis.viewer.restfulobjects.tck.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;
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/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
index f4d886b..9fec3c4 100644
--- 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
@@ -18,10 +18,10 @@
*/
package org.apache.isis.viewer.restfulobjects.tck.domainservice.root;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.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;
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/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
index a853226..238e04c 100644
--- 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
@@ -18,7 +18,7 @@
*/
package org.apache.isis.viewer.restfulobjects.tck.domainservice.serviceId;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+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;
@@ -47,7 +47,7 @@ import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRe
import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
import org.apache.isis.viewer.restfulobjects.tck.Util;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.*;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.*;
public class DomainServiceTest_req_queryarg_xrofollowlinks {
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/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
index 95fe1cd..f90a799 100644
--- 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
@@ -19,10 +19,10 @@
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.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.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;
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/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
new file mode 100644
index 0000000..1470fb4
--- /dev/null
+++ 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
@@ -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.domainservice.serviceId.action.invoke;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.Response;
+
+import org.apache.isis.viewer.restfulobjects.applib.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.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.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
+ 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
+ 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/646a07ce/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
new file mode 100644
index 0000000..a766d4e
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_req_safe_refarg_bad.java
@@ -0,0 +1,157 @@
+/*
+ * 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.isLink;
+import static org.hamcrest.CoreMatchers.*;
+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.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.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.errors.ErrorRepresentation;
+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 static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.*;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+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_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", nonExistentEntityLink);
+ args.mapPut("from", 0);
+ args.mapPut("to", 1);
+
+ RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ // then the response is an error
+ assertThat(restfulResponse, hasStatus(HttpStatusCode.VALIDATION_FAILED));
+
+ assertThat(restfulResponse.getHeader(Header.WARNING), is("199 Argument 'searchFor' href does not reference a known entity"));
+
+ // hmmm... what is the media type, though? the spec doesn't say. just assuming generic for now.
+ assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(MediaType.APPLICATION_JSON));
+
+ RestfulResponse<JsonRepresentation> restfulResponseOfError = restfulResponse.wraps(JsonRepresentation.class);
+ JsonRepresentation repr = restfulResponseOfError.getEntity();
+
+
+
+
+ }
+
+ @Ignore("still to update according to above test...")
+ @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", firstEntityLink);
+ args.mapPut("from", 0);
+ args.mapPut("to", 3);
+ Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "contains", UrlEncodingUtils.urlEncode(args));
+ RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ // then
+ final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
+ JsonRepresentation resultRepr = actionResultRepr.getResult();
+
+ assertThat(actionResultRepr.getResultType(), is(ResultType.SCALAR_VALUE));
+ ScalarValueRepresentation scalarValueRepr = resultRepr.as(ScalarValueRepresentation.class);
+
+ assertThat(scalarValueRepr.getValue().asBoolean(), is(true));
+ }
+
+
+
+ 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", from);
+ args.mapPut("to", 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/646a07ce/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
new file mode 100644
index 0000000..c9dad04
--- /dev/null
+++ 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
@@ -0,0 +1,177 @@
+/*
+ * 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.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.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.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.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.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_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", firstEntityLink);
+ args.mapPut("from", 0);
+ args.mapPut("to", 3);
+
+ RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ // then the response is a scalar value of 'true'
+ 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(true));
+
+
+ // and when query the 'contains' action for a different range which does not
+ // contain the entity
+ args.mapPut("searchFor", firstEntityLink);
+ args.mapPut("from", 3);
+ args.mapPut("to", 5);
+
+ restfulResponse = client.followT(invokeLink, args);
+
+ // then the response is a scalar value of 'false'
+ actionResultRepr = restfulResponse.getEntity();
+ resultRepr = actionResultRepr.getResult();
+
+ scalarValueRepr = resultRepr.as(ScalarValueRepresentation.class);
+ assertThat(scalarValueRepr.getValue().asBoolean(), is(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", firstEntityLink);
+ args.mapPut("from", 0);
+ args.mapPut("to", 3);
+ Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "contains", UrlEncodingUtils.urlEncode(args));
+ RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ // then
+ final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
+ JsonRepresentation resultRepr = actionResultRepr.getResult();
+
+ assertThat(actionResultRepr.getResultType(), is(ResultType.SCALAR_VALUE));
+ ScalarValueRepresentation scalarValueRepr = resultRepr.as(ScalarValueRepresentation.class);
+
+ assertThat(scalarValueRepr.getValue().asBoolean(), is(true));
+ }
+
+
+
+ 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", from);
+ args.mapPut("to", 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/646a07ce/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
new file mode 100644
index 0000000..1e8d02b
--- /dev/null
+++ 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
@@ -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.domainservice.serviceId.action.invoke;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.Response;
+
+import org.apache.isis.viewer.restfulobjects.applib.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.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.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", 1);
+ args.mapPut("to", 3);
+
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ // then
+ 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));
+ }
+
+
+ @Test
+ public void usingResourceProxy() throws Exception {
+
+ // given, when
+ JsonRepresentation args = JsonRepresentation.newMap();
+ args.mapPut("from", 1);
+ args.mapPut("to", 3);
+ Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "subList", UrlEncodingUtils.urlEncode(args));
+ RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ // then
+ 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/646a07ce/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_safe_noarg_list.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_safe_noarg_list.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_safe_noarg_list.java
deleted file mode 100644
index ff07257..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_safe_noarg_list.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.domainservice.serviceId.action.invoke;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.Response;
-
-import org.apache.isis.viewer.restfulobjects.applib.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.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.hamcrest.Matchers;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class DomainServiceTest_safe_noarg_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 invokeQueryOnly_noArg_usingClientFollow_returning_list() 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
- 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 invokeQueryOnly_noArg_usingResourceProxy_returning_list() throws Exception {
-
- // given, when
- Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "list", null);
- RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
-
- // then
- 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/646a07ce/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_safe_simplearg_list.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_safe_simplearg_list.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_safe_simplearg_list.java
deleted file mode 100644
index 2de1f28..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_safe_simplearg_list.java
+++ /dev/null
@@ -1,123 +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.RepresentationMatchers.isLink;
-import static org.hamcrest.CoreMatchers.*;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.Response;
-
-import org.apache.isis.viewer.restfulobjects.applib.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.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.RepresentationMatchers;
-import org.apache.isis.viewer.restfulobjects.tck.Util;
-import org.hamcrest.Matchers;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class DomainServiceTest_safe_simplearg_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 invokeQueryOnly_noArg_usingClientFollow_returning_list() 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, RepresentationMatchers.mapHas("from"));
- assertThat(args, RepresentationMatchers.mapHas("to"));
-
- // when
- args.mapPut("from", 1);
- args.mapPut("to", 3);
-
- final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
-
- // then
- 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));
- }
-
-
- @Ignore("up to here...")
- @Test
- public void invokeQueryOnly_noArg_usingResourceProxy_returning_list() throws Exception {
-
- // given, when
- JsonRepresentation args = JsonRepresentation.newMap();
- args.mapPut("from", 1);
- args.mapPut("to", 3);
- String xIsisQueryString = UrlEncodingUtils.urlEncode(args);
-
- Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "subList", xIsisQueryString);
- RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
-
- // then
- 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/646a07ce/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
index 6431cc7..758eb9a 100644
--- 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
@@ -18,8 +18,8 @@
*/
package org.apache.isis.viewer.restfulobjects.tck.homepage.root;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+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;
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/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
index 22eefc4..80386c1 100644
--- 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
@@ -18,10 +18,10 @@
*/
package org.apache.isis.viewer.restfulobjects.tck.homepage.root;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
+import static org.apache.isis.viewer.restfulobjects.tck.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;
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/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
index f8600c3..9152369 100644
--- 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
@@ -18,10 +18,10 @@
*/
package org.apache.isis.viewer.restfulobjects.tck.homepage.root;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.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;
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/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
index 33fbf4e..b6894d7 100644
--- 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
@@ -18,15 +18,15 @@
*/
package org.apache.isis.viewer.restfulobjects.tck.user.root;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isFollowableLinkToSelf;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.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;
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/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
index a637373..416acc9 100644
--- 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
@@ -18,10 +18,10 @@
*/
package org.apache.isis.viewer.restfulobjects.tck.user.root;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.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;
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/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
index d49fa79..df98730 100644
--- 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
@@ -18,10 +18,10 @@
*/
package org.apache.isis.viewer.restfulobjects.tck.version;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
+import static org.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;
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/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
index 54bf7fe..c44e65d 100644
--- 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
@@ -18,10 +18,10 @@
*/
package org.apache.isis.viewer.restfulobjects.tck.version;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.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;
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/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
index 16a71ba..75b1360 100644
--- 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
@@ -19,8 +19,8 @@
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.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
+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;