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:20 UTC
[01/50] [abbrv] git commit: ISIS-233: more on RO spec
Updated Branches:
refs/heads/master 0ef9dd81e -> f0526cdfe
ISIS-233: more on RO spec
... working on the version resource.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/438b4501
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/438b4501
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/438b4501
Branch: refs/heads/master
Commit: 438b4501484bf2f819aa834fe9c68245c46c9630
Parents: 073bd1b
Author: Dan Haywood <da...@apache.org>
Authored: Wed Feb 20 08:08:21 2013 +0000
Committer: Dan Haywood <da...@apache.org>
Committed: Sat Apr 27 18:57:22 2013 +0100
----------------------------------------------------------------------
.../viewer/restfulobjects/applib/util/Parser.java | 2 +-
.../applib/version/VersionRepresentation.java | 6 +
...RepresentationTypeTest_getMediaType_lookup.java | 2 +-
.../restfulobjects/applib/util/ParserTest.java | 1 +
.../applib/util/PathNodeTest_equalsHashcode.java | 26 +--
.../server/RestfulObjectsApplication.java | 2 +-
.../server/resources/VersionReprRenderer.java | 27 ++--
...ceContextTest_ensureCompatibleAcceptHeader.java | 33 +++-
component/viewer/restfulobjects/tck/pom.xml | 5 +
.../isis/viewer/restfulobjects/tck/Dummy.java | 6 +
.../user/UserResourceTest_get_accept.java | 2 -
.../UserResourceTest_templated_representation.java | 13 --
.../version/VersionResourceTest_accept.java | 80 --------
.../version/VersionResourceTest_get_accept.java | 111 +++++++++++
...rsionResourceTest_representationAndHeaders.java | 150 ---------------
...rsionResourceTest_templated_representation.java | 125 ++++++++++++
...sionResourceTest_templated_responseHeaders.java | 82 ++++++++
17 files changed, 387 insertions(+), 286 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/438b4501/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/Parser.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/Parser.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/Parser.java
index 99503ad..706de82 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/Parser.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/Parser.java
@@ -236,7 +236,7 @@ public abstract class Parser<T> {
if (str == null) {
return Collections.emptyList();
}
- return PathNode.split(str);
+ return Lists.newArrayList(Splitter.on(",").split(str));
}
@Override
http://git-wip-us.apache.org/repos/asf/isis/blob/438b4501/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/version/VersionRepresentation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/version/VersionRepresentation.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/version/VersionRepresentation.java
index 350abf3..a0f4792 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/version/VersionRepresentation.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/version/VersionRepresentation.java
@@ -19,6 +19,8 @@
package org.apache.isis.viewer.restfulobjects.applib.version;
import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainRepresentation;
import org.codehaus.jackson.JsonNode;
@@ -28,6 +30,10 @@ public class VersionRepresentation extends DomainRepresentation {
super(jsonNode);
}
+ public LinkRepresentation getUp() {
+ return getLinkWithRel(Rel.UP);
+ }
+
public JsonRepresentation getOptionalCapabilities() {
return getMap("optionalCapabilities");
}
http://git-wip-us.apache.org/repos/asf/isis/blob/438b4501/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getMediaType_lookup.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getMediaType_lookup.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getMediaType_lookup.java
index bec0243..ae9aa2a 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getMediaType_lookup.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getMediaType_lookup.java
@@ -51,7 +51,7 @@ public class RepresentationTypeTest_getMediaType_lookup {
@Test
public void getMediaTypeProfile() {
- assertThat(RepresentationType.VERSION.getMediaTypeProfile(), is("urn:org.restfulobjects/version"));
+ assertThat(RepresentationType.VERSION.getMediaTypeProfile(), is("urn:org.restfulobjects:repr-types/version"));
assertThat(RepresentationType.GENERIC.getMediaTypeProfile(), is(nullValue()));
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/438b4501/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/ParserTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/ParserTest.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/ParserTest.java
index 38bd616..56766c1 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/ParserTest.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/ParserTest.java
@@ -33,6 +33,7 @@ import org.apache.isis.core.commons.matchers.IsisMatchers;
import org.apache.isis.viewer.restfulobjects.applib.RestfulMediaType;
import org.junit.Test;
+import com.google.common.collect.Lists;
import com.google.common.net.MediaType;
public class ParserTest {
http://git-wip-us.apache.org/repos/asf/isis/blob/438b4501/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/PathNodeTest_equalsHashcode.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/PathNodeTest_equalsHashcode.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/PathNodeTest_equalsHashcode.java
index 9af1f28..b181a76 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/PathNodeTest_equalsHashcode.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/util/PathNodeTest_equalsHashcode.java
@@ -33,20 +33,6 @@ public class PathNodeTest_equalsHashcode {
}
@Test
- public void oneCriterium() throws Exception {
- final PathNode node = PathNode.parse("a[b=c]");
- final PathNode node2 = PathNode.parse("a");
- assertFalse(node.equals(node2));
- }
-
- @Test
- public void moreThanOneCriterium() throws Exception {
- final PathNode node = PathNode.parse("a[b=c d=e]");
- final PathNode node2 = PathNode.parse("a");
- assertFalse(node.equals(node2));
- }
-
- @Test
public void sameCriterium() throws Exception {
final PathNode node = PathNode.parse("a[b=c]");
final PathNode node2 = PathNode.parse("a[b=c]");
@@ -68,9 +54,17 @@ public class PathNodeTest_equalsHashcode {
}
@Test
- public void notEqualCriterium() throws Exception {
+ public void criteriumIgnored() throws Exception {
final PathNode node = PathNode.parse("a[b=c]");
final PathNode node2 = PathNode.parse("a[b=d]");
- assertFalse(node.equals(node2));
+ assertEquals(node, node2);
+ }
+
+ @Test
+ public void criteriumIgnoredHereAlso() throws Exception {
+ final PathNode node = PathNode.parse("a[b=c d=e]");
+ final PathNode node2 = PathNode.parse("a");
+ assertEquals(node, node2);
}
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/438b4501/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplication.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplication.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplication.java
index 8cbbda1..2724886 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplication.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplication.java
@@ -27,7 +27,7 @@ import org.apache.isis.viewer.restfulobjects.server.resources.VersionResourceSer
public class RestfulObjectsApplication extends AbstractJaxRsApplication {
- public static final String SPEC_VERSION = "0.52";
+ public static final String SPEC_VERSION = "1.0.0";
public RestfulObjectsApplication() {
addClass(HomePageResourceServerside.class);
http://git-wip-us.apache.org/repos/asf/isis/blob/438b4501/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/VersionReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/VersionReprRenderer.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/VersionReprRenderer.java
index 2849e9b..f917698 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/VersionReprRenderer.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/VersionReprRenderer.java
@@ -18,7 +18,9 @@
*/
package org.apache.isis.viewer.restfulobjects.server.resources;
+import java.net.URL;
import java.nio.charset.Charset;
+import java.util.Properties;
import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
import org.apache.isis.viewer.restfulobjects.applib.Rel;
@@ -32,7 +34,7 @@ import com.google.common.io.Resources;
public class VersionReprRenderer extends ReprRendererAbstract<VersionReprRenderer, Void> {
- private static final String META_INF_POM_PROPERTIES = "/META-INF/maven/org.apache.isis.viewer/restfulobjects-viewer/pom.properties";
+ private static final String META_INF_POM_PROPERTIES = "/META-INF/maven/org.apache.isis.viewer/isis-viewer-restfulobjects-server/pom.properties";
VersionReprRenderer(final RendererContext resourceContext, final LinkFollowSpecs linkFollower, final JsonRepresentation representation) {
super(resourceContext, linkFollower, RepresentationType.VERSION, representation);
@@ -47,7 +49,8 @@ public class VersionReprRenderer extends ReprRendererAbstract<VersionReprRendere
public JsonRepresentation render() {
if (includesSelf) {
- withLink(Rel.SELF, "version/");
+ withLink(Rel.SELF, "version");
+ withLink(Rel.UP, "");
}
representation.mapPut("specVersion", RestfulObjectsApplication.SPEC_VERSION);
@@ -61,7 +64,10 @@ public class VersionReprRenderer extends ReprRendererAbstract<VersionReprRendere
private static String versionFromManifest() {
try {
- return Resources.toString(Resources.getResource(META_INF_POM_PROPERTIES), Charset.defaultCharset());
+ URL resource = Resources.getResource(META_INF_POM_PROPERTIES);
+ Properties p = new Properties();
+ p.load(Resources.newReaderSupplier(resource, Charset.defaultCharset()).getInput());
+ return p.getProperty("version");
} catch (final Exception ex) {
return "UNKNOWN";
}
@@ -70,16 +76,11 @@ public class VersionReprRenderer extends ReprRendererAbstract<VersionReprRendere
private void putOptionalCapabilities() {
final JsonRepresentation optionalCapabilities = JsonRepresentation.newMap();
- optionalCapabilities.mapPut("concurrencyChecking", "no");
- optionalCapabilities.mapPut("transientObjects", "yes");
- optionalCapabilities.mapPut("deleteObjects", "no");
- optionalCapabilities.mapPut("simpleArguments", "no");
- optionalCapabilities.mapPut("partialArguments", "no");
- optionalCapabilities.mapPut("followLinks", "yes");
- optionalCapabilities.mapPut("validateOnly", "no");
- optionalCapabilities.mapPut("pagination", "no");
- optionalCapabilities.mapPut("sorting", "no");
- optionalCapabilities.mapPut("domainModel", "rich");
+ optionalCapabilities.mapPut("blobsClobs", "yes");
+ optionalCapabilities.mapPut("deleteObjects", "yes");
+ optionalCapabilities.mapPut("domainModel", "formal");
+ optionalCapabilities.mapPut("validateOnly", "yes");
+ optionalCapabilities.mapPut("protoPersistentObjects", "yes");
representation.mapPut("optionalCapabilities", optionalCapabilities);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/438b4501/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/ResourceContextTest_ensureCompatibleAcceptHeader.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/ResourceContextTest_ensureCompatibleAcceptHeader.java b/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/ResourceContextTest_ensureCompatibleAcceptHeader.java
index ba8e248..cd27f5a 100644
--- a/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/ResourceContextTest_ensureCompatibleAcceptHeader.java
+++ b/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/ResourceContextTest_ensureCompatibleAcceptHeader.java
@@ -18,6 +18,9 @@
*/
package org.apache.isis.viewer.restfulobjects.server;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
import java.util.Arrays;
import java.util.List;
@@ -26,7 +29,7 @@ import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.rendering.ReprRendererException;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
import org.jmock.Expectations;
import org.jmock.Mockery;
import org.jmock.integration.junit4.JUnit4Mockery;
@@ -84,32 +87,44 @@ public class ResourceContextTest_ensureCompatibleAcceptHeader {
instantiateResourceContext(representationType);
}
- @Test(expected = ReprRendererException.class)
+ @Test
public void nonMatching() throws Exception {
final RepresentationType representationType = RepresentationType.HOME_PAGE;
givenHttpHeadersGetAcceptableMediaTypesReturns(Arrays.<MediaType> asList(MediaType.APPLICATION_ATOM_XML_TYPE));
- instantiateResourceContext(representationType);
+ try {
+ instantiateResourceContext(representationType);
+ } catch(RestfulObjectsApplicationException ex ) {
+ assertThat(ex.getHttpStatusCode(), is(HttpStatusCode.NOT_ACCEPTABLE));
+ }
}
- @Test(expected = RestfulObjectsApplicationException.class)
+ @Test
public void nonMatchingProfile() throws Exception {
final RepresentationType representationType = RepresentationType.HOME_PAGE;
givenHttpHeadersGetAcceptableMediaTypesReturns(Arrays.<MediaType> asList(RepresentationType.USER.getMediaType()));
- instantiateResourceContext(representationType);
+ try {
+ instantiateResourceContext(representationType);
+ } catch(RestfulObjectsApplicationException ex ) {
+ assertThat(ex.getHttpStatusCode(), is(HttpStatusCode.NOT_ACCEPTABLE));
+ }
}
- @Test(expected = RestfulObjectsApplicationException.class)
+ @Test
public void nonMatchingProfile_ignoreGeneric() throws Exception {
final RepresentationType representationType = RepresentationType.HOME_PAGE;
givenHttpHeadersGetAcceptableMediaTypesReturns(Arrays.<MediaType> asList(RepresentationType.USER.getMediaType(), MediaType.APPLICATION_JSON_TYPE));
- instantiateResourceContext(representationType);
+ try {
+ instantiateResourceContext(representationType);
+ } catch(RestfulObjectsApplicationException ex ) {
+ assertThat(ex.getHttpStatusCode(), is(HttpStatusCode.NOT_ACCEPTABLE));
+ }
}
- @Test(expected = ReprRendererException.class)
- public void emptyList() throws Exception {
+ @Test
+ public void emptyList_isOK() throws Exception {
final RepresentationType representationType = RepresentationType.HOME_PAGE;
givenHttpHeadersGetAcceptableMediaTypesReturns(Arrays.<MediaType> asList());
http://git-wip-us.apache.org/repos/asf/isis/blob/438b4501/component/viewer/restfulobjects/tck/pom.xml
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/pom.xml b/component/viewer/restfulobjects/tck/pom.xml
index 2a8f76a..9d162d2 100644
--- a/component/viewer/restfulobjects/tck/pom.xml
+++ b/component/viewer/restfulobjects/tck/pom.xml
@@ -123,5 +123,10 @@
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib-nodep</artifactId>
+ </dependency>
+
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/438b4501/component/viewer/restfulobjects/tck/src/main/java/org/apache/isis/viewer/restfulobjects/tck/Dummy.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/main/java/org/apache/isis/viewer/restfulobjects/tck/Dummy.java b/component/viewer/restfulobjects/tck/src/main/java/org/apache/isis/viewer/restfulobjects/tck/Dummy.java
new file mode 100644
index 0000000..7c27933
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/main/java/org/apache/isis/viewer/restfulobjects/tck/Dummy.java
@@ -0,0 +1,6 @@
+package org.apache.isis.viewer.restfulobjects.tck;
+
+
+public class Dummy {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/438b4501/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_get_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_get_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_get_accept.java
index 7b3677d..4246313 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_get_accept.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_get_accept.java
@@ -104,6 +104,4 @@ public class UserResourceTest_get_accept {
// then
assertThat(restfulResp.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
}
-
-
}
http://git-wip-us.apache.org/repos/asf/isis/blob/438b4501/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_templated_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_templated_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_templated_representation.java
index de494de..da95307 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_templated_representation.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_templated_representation.java
@@ -19,12 +19,7 @@
package org.apache.isis.viewer.restfulobjects.tck.resources.user;
import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isFollowableLinkToSelf;
import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
import static org.hamcrest.CoreMatchers.endsWith;
@@ -33,10 +28,6 @@ import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
-import java.io.IOException;
-
-import javax.ws.rs.core.CacheControl;
-import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status.Family;
@@ -45,14 +36,10 @@ import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.Header;
import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
import org.apache.isis.viewer.restfulobjects.applib.user.UserRepresentation;
import org.apache.isis.viewer.restfulobjects.applib.user.UserResource;
import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/isis/blob/438b4501/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_accept.java
deleted file mode 100644
index 10d5b4c..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_accept.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.restfulobjects.tck.resources.version;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.MediaType;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.webserver.WebServer;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.version.VersionRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-
-public class VersionResourceTest_accept {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- @Before
- public void setUp() throws Exception {
- final WebServer webServer = webServerRule.getWebServer();
- client = new RestfulClient(webServer.getBase());
- }
-
- @Test
- public void applicationJson() throws Exception {
-
- final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, "version").withHeader(RestfulRequest.Header.ACCEPT, MediaType.APPLICATION_JSON_TYPE);
- final RestfulResponse<VersionRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- }
-
- @Test
- public void applicationJson_profileVersion() throws Exception {
-
- final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, "version").withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.VERSION.getMediaType());
- final RestfulResponse<VersionRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- }
-
- @Test
- public void applicationJson_invalid() throws Exception {
-
- final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, "/").withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.USER.getMediaType());
- final RestfulResponse<VersionRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/438b4501/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_get_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_get_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_get_accept.java
new file mode 100644
index 0000000..25347ee
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_get_accept.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.resources.version;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.MediaType;
+
+import org.jboss.resteasy.client.ClientRequest;
+import org.jboss.resteasy.client.ClientResponse;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.user.UserRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.version.VersionRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+public class VersionResourceTest_get_accept {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+ }
+
+ @Test
+ public void applicationJson_noProfile_returns200() throws Exception {
+
+ final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, "version").withHeader(RestfulRequest.Header.ACCEPT, MediaType.APPLICATION_JSON_TYPE);
+ final RestfulResponse<VersionRepresentation> restfulResponse = request.executeT();
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+ assertThat(restfulResponse.getHeader(RestfulResponse.Header.CONTENT_TYPE), is(RepresentationType.VERSION.getMediaType()));
+ }
+
+
+ @Test
+ public void applicationJson_profileVersion_returns200() throws Exception {
+
+ final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, "version").withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.VERSION.getMediaType());
+ final RestfulResponse<VersionRepresentation> restfulResponse = request.executeT();
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+ }
+
+ @Test
+ public void missingHeader_returns200() throws Exception {
+ // given
+ final RestfulRequest restfulReq = client.createRequest(RestfulHttpMethod.GET, "version");
+
+ // when
+ final RestfulResponse<VersionRepresentation> restfulResp = restfulReq.executeT();
+
+ // then
+ assertThat(restfulResp.getStatus(), is(HttpStatusCode.OK));
+ }
+
+ @Test
+ public void applicationJson_profileIncorrect_returns406() throws Exception {
+
+ final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, "version").withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.USER.getMediaType());
+ final RestfulResponse<VersionRepresentation> restfulResponse = request.executeT();
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
+ }
+
+ @Test
+ public void incorrectMediaType_returnsNotAcceptable() throws Exception {
+
+ // given
+ final ClientRequest clientRequest = client.getClientRequestFactory().createRelativeRequest("version");
+ clientRequest.accept(MediaType.APPLICATION_ATOM_XML_TYPE);
+
+ // when
+ final ClientResponse<?> resp = clientRequest.get();
+ final RestfulResponse<JsonRepresentation> restfulResp = RestfulResponse.of(resp);
+
+ // then
+ assertThat(restfulResp.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/438b4501/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_representationAndHeaders.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_representationAndHeaders.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_representationAndHeaders.java
deleted file mode 100644
index fe6ce0b..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_representationAndHeaders.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.restfulobjects.tck.resources.version;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isFollowableLinkToSelf;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.CacheControl;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status.Family;
-
-import org.apache.isis.core.webserver.WebServer;
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.Header;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.version.VersionRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.version.VersionResource;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class VersionResourceTest_representationAndHeaders {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
- private VersionResource resource;
-
- @Before
- public void setUp() throws Exception {
- final WebServer webServer = webServerRule.getWebServer();
- client = new RestfulClient(webServer.getBase());
-
- resource = client.getVersionResource();
- }
-
- @Test
- public void representation() throws Exception {
-
- // given
- final Response servicesResp = resource.version();
-
- // when
- final RestfulResponse<VersionRepresentation> restfulResponse = RestfulResponse.ofT(servicesResp);
- assertThat(restfulResponse.getStatus().getFamily(), is(Family.SUCCESSFUL));
-
- // then
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
-
- final VersionRepresentation repr = restfulResponse.getEntity();
- assertThat(repr, is(not(nullValue())));
- assertThat(repr, isMap());
-
- assertThat(repr.getSelf(), isLink().httpMethod(RestfulHttpMethod.GET));
-
- assertThat(repr.getString("specVersion"), is("0.52"));
- assertThat(repr.getString("implVersion"), is(not(nullValue())));
-
- final JsonRepresentation optionalCapbilitiesRepr = repr.getOptionalCapabilities();
- assertThat(optionalCapbilitiesRepr, isMap());
-
- assertThat(optionalCapbilitiesRepr.getString("concurrencyChecking"), is("no"));
- assertThat(optionalCapbilitiesRepr.getString("transientObjects"), is("yes"));
- assertThat(optionalCapbilitiesRepr.getString("deleteObjects"), is("no"));
- assertThat(optionalCapbilitiesRepr.getString("simpleArguments"), is("no"));
- assertThat(optionalCapbilitiesRepr.getString("partialArguments"), is("no"));
- assertThat(optionalCapbilitiesRepr.getString("followLinks"), is("yes"));
- assertThat(optionalCapbilitiesRepr.getString("validateOnly"), is("no"));
- assertThat(optionalCapbilitiesRepr.getString("pagination"), is("no"));
- assertThat(optionalCapbilitiesRepr.getString("sorting"), is("no"));
- assertThat(optionalCapbilitiesRepr.getString("domainModel"), is("rich"));
-
- assertThat(repr.getLinks(), isArray());
- assertThat(repr.getExtensions(), is(not(nullValue())));
- }
-
- @Test
- public void headers() throws Exception {
- // given
- final Response resp = resource.version();
-
- // when
- final RestfulResponse<VersionRepresentation> restfulResponse = RestfulResponse.ofT(resp);
-
- // then
- final MediaType contentType = restfulResponse.getHeader(Header.CONTENT_TYPE);
- assertThat(contentType, hasType("application"));
- assertThat(contentType, hasSubType("json"));
- assertThat(contentType, hasParameter("profile", "urn:org.restfulobjects:repr-types/version"));
- assertThat(contentType, is(RepresentationType.VERSION.getMediaType()));
-
- // then
- final CacheControl cacheControl = restfulResponse.getHeader(Header.CACHE_CONTROL);
- assertThat(cacheControl, hasMaxAge(24 * 60 * 60));
- assertThat(cacheControl.getMaxAge(), is(24 * 60 * 60));
- }
-
- @Test
- public void selfIsFollowable() throws Exception {
- // given
- final VersionRepresentation repr = givenRepresentation();
-
- // when, then
- assertThat(repr, isFollowableLinkToSelf(client));
- }
-
- private VersionRepresentation givenRepresentation() throws JsonParseException, JsonMappingException, IOException {
- final RestfulResponse<VersionRepresentation> jsonResp = RestfulResponse.ofT(resource.version());
- return jsonResp.getEntity();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/438b4501/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_templated_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_templated_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_templated_representation.java
new file mode 100644
index 0000000..cd91d7a
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_templated_representation.java
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.resources.version;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isFollowableLinkToSelf;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.hamcrest.CoreMatchers.endsWith;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.CacheControl;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status.Family;
+
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.Header;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.version.VersionRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.version.VersionResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class VersionResourceTest_templated_representation {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+ private VersionResource resource;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+
+ resource = client.getVersionResource();
+ }
+
+ @Test
+ public void representation() throws Exception {
+
+ // given
+ final Response servicesResp = resource.version();
+
+ // when
+ final RestfulResponse<VersionRepresentation> restfulResponse = RestfulResponse.ofT(servicesResp);
+ assertThat(restfulResponse.getStatus().getFamily(), is(Family.SUCCESSFUL));
+
+ // then
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+
+ final VersionRepresentation repr = restfulResponse.getEntity();
+ assertThat(repr, is(not(nullValue())));
+ assertThat(repr, isMap());
+
+ assertThat(repr.getSelf(), isLink(client)
+ .rel(Rel.SELF)
+ .href(endsWith(":39393/version"))
+ .httpMethod(RestfulHttpMethod.GET)
+ .type(RepresentationType.VERSION.getMediaType())
+ .returning(HttpStatusCode.OK)
+ );
+ assertThat(repr.getUp(), isLink(client)
+ .rel(Rel.UP)
+ .href(endsWith(":39393/"))
+ .httpMethod(RestfulHttpMethod.GET)
+ .type(RepresentationType.HOME_PAGE.getMediaType())
+ .returning(HttpStatusCode.OK)
+ );
+
+ assertThat(repr.getString("specVersion"), is("1.0.0"));
+ assertThat(repr.getString("implVersion"), is(not(nullValue())));
+ //assertThat(repr.getString("implVersion"), is(not("UNKNOWN")));
+
+ final JsonRepresentation optionalCapbilitiesRepr = repr.getOptionalCapabilities();
+ assertThat(optionalCapbilitiesRepr, isMap());
+
+ assertThat(optionalCapbilitiesRepr.getString("blobsClobs"), is("yes"));
+ assertThat(optionalCapbilitiesRepr.getString("deleteObjects"), is("yes"));
+ assertThat(optionalCapbilitiesRepr.getString("domainModel"), is("formal"));
+ assertThat(optionalCapbilitiesRepr.getString("validateOnly"), is("yes"));
+ assertThat(optionalCapbilitiesRepr.getString("protoPersistentObjects"), is("yes"));
+
+ assertThat(repr.getLinks(), isArray());
+ assertThat(repr.getExtensions(), is(not(nullValue())));
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/438b4501/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_templated_responseHeaders.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_templated_responseHeaders.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_templated_responseHeaders.java
new file mode 100644
index 0000000..e39644e
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_templated_responseHeaders.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.resources.version;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.CacheControl;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.Header;
+import org.apache.isis.viewer.restfulobjects.applib.version.VersionRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.version.VersionResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class VersionResourceTest_templated_responseHeaders {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+ private VersionResource resource;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+
+ resource = client.getVersionResource();
+ }
+
+
+ @Test
+ public void headers() throws Exception {
+ // given
+ final Response resp = resource.version();
+
+ // when
+ final RestfulResponse<VersionRepresentation> restfulResponse = RestfulResponse.ofT(resp);
+
+ // then
+ final MediaType contentType = restfulResponse.getHeader(Header.CONTENT_TYPE);
+ assertThat(contentType, hasType("application"));
+ assertThat(contentType, hasSubType("json"));
+ assertThat(contentType, hasParameter("profile", "urn:org.restfulobjects:repr-types/version"));
+ assertThat(contentType, is(RepresentationType.VERSION.getMediaType()));
+
+ // then
+ final CacheControl cacheControl = restfulResponse.getHeader(Header.CACHE_CONTROL);
+ assertThat(cacheControl, hasMaxAge(24 * 60 * 60));
+ assertThat(cacheControl.getMaxAge(), is(24 * 60 * 60));
+ }
+
+}
[44/50] [abbrv] git commit: ISIS-233: more RO tests
Posted by da...@apache.org.
ISIS-233: more RO tests
focusing on the domain object representation
render URLs without the version info of the OID
recombining certain happy case tests
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/119d8a8c
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/119d8a8c
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/119d8a8c
Branch: refs/heads/master
Commit: 119d8a8c44b81e149ac93cb9a725fc39e00cce34
Parents: 82c7af4
Author: Dan Haywood <da...@apache.org>
Authored: Thu Apr 25 06:55:59 2013 +0100
Committer: Dan Haywood <da...@apache.org>
Committed: Sat Apr 27 19:01:40 2013 +0100
----------------------------------------------------------------------
.../restfulobjects/applib/JsonRepresentation.java | 66 ++++++++
.../domainobjects/DomainObjectReprRenderer.java | 21 +++
.../rendering/domainobjects/JsonValueEncoder.java | 103 +++++++++++--
.../domainobjects/ObjectPropertyReprRenderer.java | 12 +--
.../restfulobjects/rendering/util/OidUtils.java | 2 +-
.../oid/Get_thenRepresentation_ok_TOFIX.java | 68 +++++---
.../invoke/Get_thenResponseCode_200_ok_TODO.java | 14 --
...ntType_andContentLength_andRespCode_200_ok.java | 115 +++++++++++++
...nseHeaders_ContentType_andContentLength_ok.java | 112 -------------
...tType_andContentLength__andRespCode_200_ok.java | 127 +++++++++++++++
...nseHeaders_ContentType_andContentLength_ok.java | 125 --------------
.../tck/dom/scalars/PrimitiveValuedEntity.java | 9 +-
12 files changed, 472 insertions(+), 302 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/119d8a8c/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java
index ac23b28..f7b20ca 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java
@@ -400,6 +400,72 @@ public class JsonRepresentation {
}
// ///////////////////////////////////////////////////////////////////////
+ // isNumber
+ // ///////////////////////////////////////////////////////////////////////
+
+ public boolean isNumber(final String path) {
+ return isNumber(getNode(path));
+ }
+
+ public boolean isNumber() {
+ return isNumber(asJsonNode());
+ }
+
+ private boolean isNumber(final JsonNode node) {
+ return !representsNull(node) && node.isValueNode() && node.isNumber();
+ }
+
+ // ///////////////////////////////////////////////////////////////////////
+ // getShort, asShort
+ // ///////////////////////////////////////////////////////////////////////
+
+ public Short getShort(final String path) {
+ final JsonNode node = getNode(path);
+ return getShort(path, node);
+ }
+
+ public Short asShort() {
+ return getShort(null, asJsonNode());
+ }
+
+ private Short getShort(final String path, final JsonNode node) {
+ if (representsNull(node)) {
+ return null;
+ }
+ checkValue(path, node, "an short");
+ if (!node.isNumber()) {
+ // there is no node.isShort()
+ throw new IllegalArgumentException(formatExMsg(path, "is not a number"));
+ }
+ return node.getNumberValue().shortValue();
+ }
+
+ // ///////////////////////////////////////////////////////////////////////
+ // getByte, asByte
+ // ///////////////////////////////////////////////////////////////////////
+
+ public Byte getByte(final String path) {
+ final JsonNode node = getNode(path);
+ return getByte(path, node);
+ }
+
+ public Byte asByte() {
+ return getByte(null, asJsonNode());
+ }
+
+ private Byte getByte(final String path, final JsonNode node) {
+ if (representsNull(node)) {
+ return null;
+ }
+ checkValue(path, node, "an byte");
+ if (!node.isNumber()) {
+ // there is no node.isByte()
+ throw new IllegalArgumentException(formatExMsg(path, "is not a number"));
+ }
+ return node.getNumberValue().byteValue();
+ }
+
+ // ///////////////////////////////////////////////////////////////////////
// isLong, getLong, asLong
// ///////////////////////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/isis/blob/119d8a8c/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java
index da3fa24..6b70656 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java
@@ -18,6 +18,8 @@ package org.apache.isis.viewer.restfulobjects.rendering.domainobjects;
import java.util.List;
+import org.codehaus.jackson.node.NullNode;
+
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
import org.apache.isis.core.metamodel.consent.Consent;
@@ -326,6 +328,25 @@ public class DomainObjectReprRenderer extends ReprRendererAbstract<DomainObjectR
//
// ///////////////////////////////////////////////////////////////////
+ public static void appendValueAndFormatOrRef(final RendererContext resourceContext, final ObjectAdapter objectAdapter, final ObjectSpecification objectSpec, JsonRepresentation repr) {
+
+ final ValueFacet valueFacet = objectSpec.getFacet(ValueFacet.class);
+ if (valueFacet != null) {
+ JsonValueEncoder.appendValueAndFormat(objectSpec, objectAdapter, repr);
+ return;
+ }
+
+ if(objectAdapter == null) {
+ repr.mapPut("value", NullNode.getInstance());
+ } else {
+ final TitleFacet titleFacet = objectSpec.getFacet(TitleFacet.class);
+ final String title = titleFacet.title(objectAdapter, resourceContext.getLocalization());
+ JsonRepresentation ref = DomainObjectReprRenderer.newLinkToBuilder(resourceContext, Rel.VALUE, objectAdapter).withTitle(title).build();
+ repr.mapPut("value", ref);
+ }
+
+ }
+
public static Object valueOrRef(final RendererContext resourceContext, final ObjectAdapter objectAdapter, final ObjectSpecification objectSpec) {
final ValueFacet valueFacet = objectSpec.getFacet(ValueFacet.class);
if (valueFacet != null) {
http://git-wip-us.apache.org/repos/asf/isis/blob/119d8a8c/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/JsonValueEncoder.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/JsonValueEncoder.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/JsonValueEncoder.java
index 1165c40..0989147 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/JsonValueEncoder.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/JsonValueEncoder.java
@@ -21,6 +21,8 @@ package org.apache.isis.viewer.restfulobjects.rendering.domainobjects;
import java.math.BigDecimal;
import java.math.BigInteger;
+import org.codehaus.jackson.node.NullNode;
+
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.metamodel.facets.object.encodeable.EncodableFacet;
import org.apache.isis.core.metamodel.spec.ObjectSpecification;
@@ -178,7 +180,71 @@ public final class JsonValueEncoder {
throw new IllegalArgumentException(reason);
}
- Object asObject(final ObjectAdapter objectAdapter) {
+ static void appendValueAndFormat(ObjectSpecification objectSpec, ObjectAdapter objectAdapter, JsonRepresentation repr) {
+
+ // special case handling for JSON built-ins
+ // (at least so far as json.org defines them).
+ Object value;
+ String format = null; // as defined by RO spec
+ String xIsisFormat = null; // isis-specific support
+ if (isBoolean(objectSpec)) {
+ value = asValueElseNull(objectAdapter);
+ xIsisFormat = "boolean";
+ } else if (isByte(objectSpec)) {
+ value = asValueElseNull(objectAdapter);
+ xIsisFormat = "byte";
+ } else if (isChar(objectSpec)) {
+ value = asValueElseNull(objectAdapter);
+ xIsisFormat = "char";
+ } else if (isShort(objectSpec)) {
+ value = asValueElseNull(objectAdapter);
+ xIsisFormat = "short";
+ } else if (isInteger(objectSpec)) {
+ value = asValueElseNull(objectAdapter);
+ format = "int";
+ xIsisFormat = "int";
+ } else if (isLong(objectSpec)) {
+ value = asValueElseNull(objectAdapter);
+ format = "int";
+ xIsisFormat = "long";
+ } else if (isBigInteger(objectSpec)) {
+ value = asValueElseNull(objectAdapter);
+ format = "int";
+ xIsisFormat = "biginteger";
+ } else if (isFloat(objectSpec)) {
+ value = asValueElseNull(objectAdapter);
+ format = "decimal";
+ xIsisFormat = "float";
+ } else if (isDouble(objectSpec)) {
+ value = asValueElseNull(objectAdapter);
+ format = "decimal";
+ xIsisFormat = "double";
+ } else if (isBigDecimal(objectSpec)) {
+ value = asValueElseNull(objectAdapter);
+ format = "decimal";
+ xIsisFormat = "bigdecimal";
+ } else {
+ final EncodableFacet encodableFacet = objectSpec.getFacet(EncodableFacet.class);
+ if (encodableFacet == null) {
+ throw new IllegalArgumentException("objectSpec expected to have EncodableFacet");
+ }
+ value = objectAdapter != null? encodableFacet.toEncodedString(objectAdapter): NullNode.getInstance();
+ }
+
+ repr.mapPut("value", value);
+ if(format != null) {
+ repr.mapPut("format", format);
+ }
+ if(xIsisFormat != null) {
+ repr.mapPut("x-isis-format", xIsisFormat);
+ }
+ }
+
+ private static Object asValueElseNull(ObjectAdapter objectAdapter) {
+ return objectAdapter != null? objectAdapter.getObject(): NullNode.getInstance();
+ }
+
+ static Object asObject(final ObjectAdapter objectAdapter) {
if (objectAdapter == null) {
throw new IllegalArgumentException("objectAdapter cannot be null");
}
@@ -198,31 +264,47 @@ public final class JsonValueEncoder {
return encodableFacet.toEncodedString(objectAdapter);
}
- private boolean isBoolean(final ObjectSpecification objectSpec) {
+ private static boolean isBoolean(final ObjectSpecification objectSpec) {
return hasCorrespondingClass(objectSpec, boolean.class, Boolean.class);
}
- private boolean isInteger(final ObjectSpecification objectSpec) {
- return hasCorrespondingClass(objectSpec, int.class, Integer.class);
+ private static boolean isByte(final ObjectSpecification objectSpec) {
+ return hasCorrespondingClass(objectSpec, byte.class, Byte.class);
+ }
+
+ private static boolean isChar(final ObjectSpecification objectSpec) {
+ return hasCorrespondingClass(objectSpec, char.class, Character.class);
+ }
+
+ private static boolean isShort(final ObjectSpecification objectSpec) {
+ return hasCorrespondingClass(objectSpec, short.class, Short.class);
}
- private boolean isLong(final ObjectSpecification objectSpec) {
+ private static boolean isInteger(final ObjectSpecification objectSpec) {
+ return hasCorrespondingClass(objectSpec, int.class, Integer.class);
+ }
+
+ private static boolean isLong(final ObjectSpecification objectSpec) {
return hasCorrespondingClass(objectSpec, long.class, Long.class);
}
- private boolean isBigInteger(final ObjectSpecification objectSpec) {
+ private static boolean isBigInteger(final ObjectSpecification objectSpec) {
return hasCorrespondingClass(objectSpec, BigInteger.class);
}
+
+ private static boolean isFloat(final ObjectSpecification objectSpec) {
+ return hasCorrespondingClass(objectSpec, float.class, Float.class);
+ }
- private boolean isDouble(final ObjectSpecification objectSpec) {
+ private static boolean isDouble(final ObjectSpecification objectSpec) {
return hasCorrespondingClass(objectSpec, double.class, Double.class);
}
-
- private boolean isBigDecimal(final ObjectSpecification objectSpec) {
+
+ private static boolean isBigDecimal(final ObjectSpecification objectSpec) {
return hasCorrespondingClass(objectSpec, BigDecimal.class);
}
- private boolean hasCorrespondingClass(final ObjectSpecification objectSpec, final Class<?>... candidates) {
+ private static boolean hasCorrespondingClass(final ObjectSpecification objectSpec, final Class<?>... candidates) {
final Class<?> specClass = objectSpec.getCorrespondingClass();
for (final Class<?> candidate : candidates) {
if (specClass == candidate) {
@@ -238,4 +320,5 @@ public final class JsonValueEncoder {
throw new IllegalArgumentException(reason);
}
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/119d8a8c/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectPropertyReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectPropertyReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectPropertyReprRenderer.java
index f04d0ab..5ceebe6 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectPropertyReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectPropertyReprRenderer.java
@@ -61,18 +61,8 @@ public class ObjectPropertyReprRenderer extends AbstractObjectMemberReprRenderer
// ///////////////////////////////////////////////////
private void addValue() {
- representation.mapPut("value", valueOrRefRepr());
- }
-
- private Object valueOrRefRepr() {
final ObjectAdapter valueAdapter = objectMember.get(objectAdapter);
- if (valueAdapter == null) {
- return NullNode.getInstance();
- }
- // REVIEW: previously was using the spec of the member, but think instead it should be the spec of the adapter itself
- // final ObjectSpecification valueSpec = objectMember.getSpecification();
- ObjectSpecification valueSpec = valueAdapter.getSpecification();
- return DomainObjectReprRenderer.valueOrRef(rendererContext, valueAdapter, valueSpec);
+ DomainObjectReprRenderer.appendValueAndFormatOrRef(rendererContext, valueAdapter, valueAdapter.getSpecification(), representation);
}
// ///////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/isis/blob/119d8a8c/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/util/OidUtils.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/util/OidUtils.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/util/OidUtils.java
index 04144a0..823da16 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/util/OidUtils.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/util/OidUtils.java
@@ -51,7 +51,7 @@ public final class OidUtils {
if(!(oid instanceof RootOid)) {
throw new IllegalArgumentException("objectAdapter must be a root adapter");
}
- return oid != null ? oid.enString(getOidMarshaller()) : null;
+ return oid != null ? oid.enStringNoVersion(getOidMarshaller()) : null;
}
private static OidMarshaller getOidMarshaller() {
http://git-wip-us.apache.org/repos/asf/isis/blob/119d8a8c/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
index 253fde7..4e5248f 100644
--- 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
@@ -20,7 +20,9 @@ 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.hasProfile;
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;
@@ -47,11 +49,16 @@ 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.RestfulMediaType;
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.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.DomainObjectMemberRepresentation;
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;
@@ -73,41 +80,56 @@ public class Get_thenRepresentation_ok_TOFIX {
client = new RestfulClient(webServer.getBase());
}
- @Ignore("to fix")
@Test
- public void returnsDomainObjectRepresentation() throws Exception {
+ public void withPrimitiveProperties() 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));
+ final Response jaxrsResponse = domainObjectResource.object("PRMV","29");
+ final RestfulResponse<DomainObjectRepresentation> restfulResponse = RestfulResponse.ofT(jaxrsResponse);
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
// then
- final DomainObjectRepresentation domainObjectRepr = domainObjectJsonResp.getEntity();
- assertThat(domainObjectRepr, is(not(nullValue())));
- }
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+ assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(RestfulMediaType.APPLICATION_JSON_OBJECT));
+ assertThat(restfulResponse.getHeader(Header.CONTENT_LENGTH), is(6226));
- @Ignore("to fix")
- @Test
- public void domainObjectRepresentationForPersistentObject_hasSelfAndOid() throws Exception {
+ final DomainObjectRepresentation domainObjectRepr = restfulResponse.getEntity();
+ assertThat(domainObjectRepr, is(not(nullValue())));
- // given, when
- final DomainObjectRepresentation domainObjectRepr = givenDomainObjectRepresentationFor("OID","32");
+ // and then has title
+ assertThat(domainObjectRepr.getTitle(), is("Primitive Valued Entity #0")); // running in-memory
+
+ // and then extensions
+ assertThat(domainObjectRepr.getExtensions().getString("oid"), is("PRMV:29"));
+ assertThat(domainObjectRepr.getExtensions().getBoolean("isService"), is(false));
+ assertThat(domainObjectRepr.getExtensions().getBoolean("isPersistent"), is(true));
- // then
+ // and then has links
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()));
+ assertThat(self, isLink()
+ .rel(Rel.SELF)
+ .href(matches(".+\\/objects\\/PRMV\\/29"))
+ .httpMethod(RestfulHttpMethod.GET)
+ .type(RepresentationType.DOMAIN_OBJECT.getMediaType()));
+ assertThat(domainObjectRepr.getLinkWithRel(Rel.DESCRIBEDBY),
+ isLink()
+ .href(matches(".+\\/domain-types\\/PRMV"))
+ .httpMethod(RestfulHttpMethod.GET)
+ .type(RepresentationType.DOMAIN_TYPE.getMediaType()));
+ assertThat(domainObjectRepr.getLinkWithRel(Rel.MODIFY),
+ isLink()
+ .href(matches(".+\\/objects\\/PRMV\\/29"))
+ .httpMethod(RestfulHttpMethod.PUT)
+ .type(RepresentationType.DOMAIN_OBJECT.getMediaType()));
+
+ // and then members
+ DomainObjectMemberRepresentation property = domainObjectRepr.getProperty("byteProperty");
+ assertThat(property.getMemberType(), is("property"));
+ Byte byteValue = property.getRepresentation("value").as(ScalarValueRepresentation.class).asByte();
+ assertThat(byteValue, is((byte)0));
}
@Ignore("to fix")
http://git-wip-us.apache.org/repos/asf/isis/blob/119d8a8c/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
deleted file mode 100644
index b42bef2..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_thenResponseCode_200_ok_TODO.java
+++ /dev/null
@@ -1,14 +0,0 @@
-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/119d8a8c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenRepr_andRespHeaders_ContentType_andContentLength_andRespCode_200_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenRepr_andRespHeaders_ContentType_andContentLength_andRespCode_200_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenRepr_andRespHeaders_ContentType_andContentLength_andRespCode_200_ok.java
new file mode 100644
index 0000000..2ead161
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenRepr_andRespHeaders_ContentType_andContentLength_andRespCode_200_ok.java
@@ -0,0 +1,115 @@
+/*
+ * 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.*;
+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.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.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_thenRepr_andRespHeaders_ContentType_andContentLength_andRespCode_200_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);
+ }
+
+ @Test
+ public void usingResourceProxy() throws Exception {
+
+ // given, when
+ Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "list", null);
+ RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ then(restfulResponse);
+ }
+
+ private static void then(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+ assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(RestfulMediaType.APPLICATION_JSON_ACTION_RESULT));
+ assertThat(restfulResponse.getHeader(Header.CONTENT_LENGTH), is(2090));
+
+ 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/119d8a8c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenRepresentation_ok_andResponseHeaders_ContentType_andContentLength_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_andResponseHeaders_ContentType_andContentLength_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenRepresentation_ok_andResponseHeaders_ContentType_andContentLength_ok.java
deleted file mode 100644
index 5ac99c4..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenRepresentation_ok_andResponseHeaders_ContentType_andContentLength_ok.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.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_andResponseHeaders_ContentType_andContentLength_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);
- }
-
- @Test
- public void usingResourceProxy() throws Exception {
-
- // given, when
- Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "list", null);
- RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
-
- 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));
- assertThat(restfulResponse.getHeader(Header.CONTENT_LENGTH), is(2245));
-
- 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/119d8a8c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_isNotNull_thenRepr_ok_andRespHeaders_ContentType_andContentLength__andRespCode_200_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_isNotNull_thenRepr_ok_andRespHeaders_ContentType_andContentLength__andRespCode_200_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_isNotNull_thenRepr_ok_andRespHeaders_ContentType_andContentLength__andRespCode_200_ok.java
new file mode 100644
index 0000000..a7b1856
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_isNotNull_thenRepr_ok_andRespHeaders_ContentType_andContentLength__andRespCode_200_ok.java
@@ -0,0 +1,127 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
+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.hamcrest.Description;
+import org.hamcrest.Matcher;
+import org.hamcrest.TypeSafeMatcher;
+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.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.DomainObjectRepresentation;
+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_whenObject_isNotNull_thenRepr_ok_andRespHeaders_ContentType_andContentLength__andRespCode_200_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", "findById");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+ final JsonRepresentation args =invokeLink.getArguments();
+
+ // when
+ args.mapPut("id.value", 1);
+
+ // when
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ // then
+ then(restfulResponse);
+ }
+
+
+ @Test
+ public void usingResourceProxy() throws Exception {
+
+ // given, when
+
+ JsonRepresentation args = JsonRepresentation.newMap();
+ args.mapPut("id.value", 1);
+
+ Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "findById", UrlEncodingUtils.urlEncode(args));
+ RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ then(restfulResponse);
+ }
+
+ private static void then(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+ assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(RestfulMediaType.APPLICATION_JSON_ACTION_RESULT));
+ assertThat(restfulResponse.getHeader(Header.CONTENT_LENGTH), is(3248));
+
+ final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
+
+ assertThat(actionResultRepr.getResultType(), is(ResultType.DOMAIN_OBJECT));
+ final DomainObjectRepresentation objRepr = actionResultRepr.getResult().as(DomainObjectRepresentation.class);
+
+ assertThat(objRepr.getMembers(), is(not(nullValue())));
+ assertThat(objRepr.getMembers().size(), is(greaterThan(0)));
+
+ assertThat(objRepr.getTitle(), is(not(nullValue())));
+
+ assertThat(objRepr.getLinks(), is(not(nullValue())));
+ assertThat(objRepr.getMembers().size(), is(greaterThan(0)));
+
+ assertThat(objRepr.getExtensions(), is(not(nullValue())));
+ }
+
+ private static Matcher<Integer> greaterThan(final int i) {
+ return new TypeSafeMatcher<Integer>() {
+
+ @Override
+ public void describeTo(Description description) {
+ description.appendText("greater than " + i);
+ }
+
+ @Override
+ protected boolean matchesSafely(Integer item) {
+ return item > i;
+ }
+ };
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/119d8a8c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_isNotNull_thenRepresentation_ok_andResponseHeaders_ContentType_andContentLength_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_isNotNull_thenRepresentation_ok_andResponseHeaders_ContentType_andContentLength_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_isNotNull_thenRepresentation_ok_andResponseHeaders_ContentType_andContentLength_ok.java
deleted file mode 100644
index 92d5e58..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_isNotNull_thenRepresentation_ok_andResponseHeaders_ContentType_andContentLength_ok.java
+++ /dev/null
@@ -1,125 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
-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.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.hamcrest.CoreMatchers;
-import org.hamcrest.Description;
-import org.hamcrest.Matcher;
-import org.hamcrest.TypeSafeMatcher;
-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.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.DomainObjectRepresentation;
-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_whenObject_isNotNull_thenRepresentation_ok_andResponseHeaders_ContentType_andContentLength_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", "findById");
- final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
-
- final LinkRepresentation invokeLink = actionRepr.getInvoke();
- final JsonRepresentation args =invokeLink.getArguments();
-
- // when
- args.mapPut("id.value", 1);
-
- // when
- final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
-
- // then
- then(restfulResponse);
- }
-
-
- @Test
- public void usingResourceProxy() throws Exception {
-
- // given, when
-
- JsonRepresentation args = JsonRepresentation.newMap();
- args.mapPut("id.value", 1);
-
- Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "findById", UrlEncodingUtils.urlEncode(args));
- RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
-
- 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));
- assertThat(restfulResponse.getHeader(Header.CONTENT_LENGTH), is(3335));
-
- final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
-
- assertThat(actionResultRepr.getResultType(), is(ResultType.DOMAIN_OBJECT));
- final DomainObjectRepresentation objRepr = actionResultRepr.getResult().as(DomainObjectRepresentation.class);
-
- assertThat(objRepr.getMembers(), is(not(nullValue())));
- assertThat(objRepr.getMembers().size(), is(greaterThan(0)));
-
- assertThat(objRepr.getTitle(), is(not(nullValue())));
-
- assertThat(objRepr.getLinks(), is(not(nullValue())));
- assertThat(objRepr.getMembers().size(), is(greaterThan(0)));
-
- assertThat(objRepr.getExtensions(), is(not(nullValue())));
- }
-
- private static Matcher<Integer> greaterThan(final int i) {
- return new TypeSafeMatcher<Integer>() {
-
- @Override
- public void describeTo(Description description) {
- description.appendText("greater than " + i);
- }
-
- @Override
- protected boolean matchesSafely(Integer item) {
- return item > i;
- }
- };
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/119d8a8c/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/scalars/PrimitiveValuedEntity.java
----------------------------------------------------------------------
diff --git a/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/scalars/PrimitiveValuedEntity.java b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/scalars/PrimitiveValuedEntity.java
index c8c738e..2b0da2d 100644
--- a/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/scalars/PrimitiveValuedEntity.java
+++ b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/scalars/PrimitiveValuedEntity.java
@@ -22,6 +22,7 @@ package org.apache.isis.core.tck.dom.scalars;
import org.apache.isis.applib.AbstractDomainObject;
import org.apache.isis.applib.annotation.MemberOrder;
import org.apache.isis.applib.annotation.ObjectType;
+import org.apache.isis.applib.annotation.Title;
@javax.jdo.annotations.PersistenceCapable
@javax.jdo.annotations.Discriminator("PRMV")
@@ -31,9 +32,11 @@ import org.apache.isis.applib.annotation.ObjectType;
@ObjectType("PRMV")
public class PrimitiveValuedEntity extends AbstractDomainObject {
+
// {{ Id (Integer)
private Integer id;
+ @Title(prepend="Primitive Valued Entity #")
@javax.jdo.annotations.PrimaryKey // must be on the getter.
public Integer getId() {
return id;
@@ -44,12 +47,6 @@ public class PrimitiveValuedEntity extends AbstractDomainObject {
}
// }}
- // {{ Title
- public String title() {
- return null;
- }
-
- // }}
// {{ BooleanProperty
private boolean booleanProperty;
[27/50] [abbrv] ISIS-233: invoking action with missing args or
surplus args
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/fe016432/component/viewer/wicket/src/docbkx/guide/isis-wicket-viewer.md
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/src/docbkx/guide/isis-wicket-viewer.md b/component/viewer/wicket/src/docbkx/guide/isis-wicket-viewer.md
new file mode 100644
index 0000000..98210f8
--- /dev/null
+++ b/component/viewer/wicket/src/docbkx/guide/isis-wicket-viewer.md
@@ -0,0 +1,2958 @@
+Preface
+=======
+
+The *Apache Isis Wicket Viewer* provides a customizable web-based viewer
+for *Apache Isis* implemented using the [Apache
+Wicket](http://wicket.apache.org) framework. This user guide is written
+for developers looking to write *Apache Isis* applications and deploy
+them using the *Wicket Viewer*. It assumes familiarity with writing
+*Isis* applications, but that is all that is needed to get an
+application up-and-running with the generic OOUI.
+
+Familiarity with *Apache Wicket* is useful to understand how the wicket
+viewer fits together, but is essential unless you want to start
+customizing the UI. If you're interested in learning more about *Wicket*
+itself, then [Wicket In Action](http://www.manning.com/dashorst/)
+(Martijn Dashort & Eelco Hillenius) is definitely worth reading.
+
+Introduction
+============
+
+> This introductory chapter describes the objective of the *Wicket
+> Viewer*, and the target audience for this guide.
+
+Introducing the Apache Isis Wicket Viewer
+-----------------------------------------
+
+The *Wicket Viewer* provides a generic OOUI web-based viewer for *Apache
+Isis* domain models, using [Apache Wicket](http://wicket.apache.org) as
+the underlying web framework.
+
+What this means for you, the developer, is that you can build a web
+application solely by developing the domain model as pojos. The *Wicket
+Viewer* will then render your domain objects in a web UI using ready
+provided *Wicket* Components.
+
+This generic UI provides a lot of functionality out-of-the-box:
+
+- Each domain entity is rendered as a form, with the appropriate
+ individual component type for its values. This entity form also
+ allows editable references to other objects, too.
+
+- Moreover, any collections of a domain entity (eg Order /
+ OrderDetail) are also automatically rendered as a list, a table, or
+ in any other appropriate representation. Both the scalar and
+ collection references let the end-user easily "walk the graph"
+ around your domain model.
+
+- Finally, the vuewer also renders actions (commands/behaviors) for
+ your domain objects, and lets these actions to be invoked. This is
+ what makes *Apache Isis*-based applications that much more than
+ simple CRUD applications.
+
+You can see examples of the UI in ?.
+
+Over and above this generic interface, you are then free to customize
+this interface in various ways. Your customizations can be general (eg
+providing a way to render a collection of Locatable objects in a
+google-maps mashup) or targetted (eg a particular way to render a
+ShoppingCartWizard). Generally these customizations take the form of
+bespoke *Wicket* Components, though simple customizations can be
+performed just by modifying the CSS. Again you can see some examples of
+these customizations in ?.
+
+*Apache Isis* webapps that use the *Wicket Viewer* are bootstrapped in
+the same as vanilla *Wicket* applications, with the *Wicket Viewer*
+providing an implementation of *Wicket*'s `WebApplication` class that
+additionally bootstraps the *Apache Isis* runtime. Authentication is
+performed using *Apache Isis*' own security mechanism (which itself is
+pluggable).
+
+The Wicket Viewer compared to other Wicket RAD Frameworks
+---------------------------------------------------------
+
+### Differences in Capability
+
+There are several frameworks that aim either to provide a back-end to
+*Wicket* and/or that aim to eliminate some of the boilerplate; notable
+examples are [Wicketopia](http://wicketopia.sourceforge.net), [Wicket
+RAD](http://sites.google.com/site/wicketrad) and
+[DataBinder](http://databinder.net/wicket/show/overview). There are also
+precanned archetypes, such as jWeekEnd's
+[LegUp](http://jweekend.co.uk/dev/LegUp) archetypes and
+[IoLite](http://wicketstuff.org/confluence/display/STUFFWIKI/Wicket-Iolite),
+that do some of the wiring for back-end technologies like
+[Spring](http://springframework.org) and
+[Hibernate](http://hibernate.org). So, how does *Wicket Viewer* for
+*Apache Isis* compare to them?
+
+Well, compared to *Wicketopia* for example, *Wicket Viewer* shares the
+following ideas:
+
+- both frameworks support pluggable editors for Javabean properties
+
+- both frameworks allow the metamodel to be enhanced declaratively
+ using annotations (eg @Length); these are picked up by the editors
+
+- both frameworks support (or aspire to support) the metamodel being
+ built from various sources, including for example *Hibernate* or
+ JSR-303 annotations etc. In the case of the *Wicket Viewer* this is
+ done by using *Apache Isis*' own metamodel.
+
+But there are some differences too; through *Wicket Viewer*'s use of the
+*Apache Isis* it:
+
+- allows the metamodel to be enhanced imperatively as well as
+ declaratively; naming conventions are used to associate supporting
+ methods with the properties
+
+- supports user-defined value types (using *Apache Isis*' @Value
+ annotation); important for domain-driven applications
+
+- supports three level of business rule (both declaratively and
+ imperatively): is the entity class member visible, is it usable, is
+ the value proposed valid. For most other frameworks, only the last
+ of these (validation of proposed values) is typically supported
+
+- supports properties which are references to other entities, not just
+ simple value types. In particular, the *Wicket Viewer*'s property
+ editor for references allows instances to be found by invoking
+ repositories in-situ
+
+- renders entity collections as well as entity properties
+
+- renders entity actions (commands), allowing more than simple CRUD
+ behavior to be exposed. Indeed, it's possible for the domain entity
+ to be immutable except through the invocation of actions
+
+The flip side of the *Wicket Viewer*'s more extensive metamodel support
+is that it uses *Apache Isis*' own metamodel API. In contrast,
+*Wicketopia* (only supporting properties and not collections or actions)
+can get by using java.bean.PropertyDescriptor from the JDK.
+
+Compared to frameworks and archetypes that use *Hibernate* for the
+backend, the *Wicket Viewer* (again by leveraging the rest of the
+*Apache Isis* framework) is more general here too. So, it has a Session
+concept that is analogous to a *Hibernate* session (and if using the
+*JPA ObjectStore* as a backend, the *Apache Isis*' Session just wraps
+the JPA provider's PersistenceContext *e*'s). But it also supports other
+back-end persistence stores too. Indeed, *Apache Isis*' default to
+support rapid development we usually use an in-memory object store.
+
+The *Wicket Viewer* can also handle non-persisted objects as well as
+persisted objects; with every managed object is stored in an identity
+map. This support for non-persisted objects is important because it is
+central to supporting specialized use cases, including managing
+workflows for entering data, and dashboards for analyzing data.
+
+A few other points worthy of mention:
+
+- The *Wicket Viewer* will automatically serialize both persisted and
+ non-persisted objects, irrespective of whether the pojo itself is
+ serializable. This is important if deploying on a cluster.
+
+- Through the *Apache Isis* core framework, every managed object also
+ automatically has any domain service dependencies automatically
+ injected into it),
+
+- Again, courtesy of *Apache Isis* core, every persisted object has a
+ unique, immutable and serializable object Id (OID). This can be a
+ very useful resource when integrating with external services such as
+ REST and ESBs.
+
+- *Apache Isis* core also provides automatic dirty tracking, and
+ optimistic locking.
+
+Downsides? Currently *Apache Isis* does not support some of the
+Enterprise Java APIs such as JTA, so interactions with domain services
+that ultimately delegate to transaction stores (such as JMS) cannot be
+enlisted in the same transaction as the persistence store. And,
+obviously, it introduces a dependency on the *Apache Isis* framework
+over and above technologies such as the JPA provider implementation.
+
+### Differences in Philosophy
+
+Aside from differences in capability, there's also a difference in
+philosophy.
+
+Frameworks such as *Wicketopia* make it easy to render a form to edit
+the properties of an entity, but the application developer remains in
+control of the rest of the application service layer, and in wiring the
+various pages together.
+
+With the *Wicket Viewer*, though, it is the framework that is in control
+of this layer too, because the links between pages are ultimately
+rendered by the property editor Components provided by the viewer, and -
+in rendering the links representing references - controls . What that
+also means is that every page rendered by the *Wicket Viewer* is always
+of either an object (typical case), or an action parameter dialog, or of
+a collection (the result of invoking an action).
+
+Within this constraint, there is a lot of flexibility, though, because
+every element of the page can be customized. Internally the *Wicket
+Viewer* uses the chain of responsibility pattern to determine how which
+Component type to use to render a page element. This works at a
+fine-grained level (eg a date editor) and also at a larger-scale, (eg
+rendering a collection of Locatable entities on a google maps). See ?
+for more on this.
+
+### Part of the *Apache Isis* framework
+
+The *Wicket Viewer* is only one of a number of viewers available for
+*Apache Isis*. What that means is that you can take your same domain
+objects model and deploy them in other architectures. For example, the
+DnD viewer is a rich, desktop GUI that employs a drag-n-drop metaphor
+(hence its name). It can be run as a standalone single-user application
+or in client/server mode. Even if you don't deploy this viewer in
+production, the way that it displays domain objects makes for a very
+good development tool: something akin to a UML design tool, only
+animated.
+
+*Apache Isis* also supports a number of different ways to test your
+application. Domain objects written to the *Apache Isis* programming
+model are just pojos, and so can easily be unit tested using frameworks
+such as [JUnit](http://junit.org) and [JMock](http://jmock.org). As a
+step up from that, *Apache Isis* provides its own integrations with
+JUnit, providing a "headless" programming model that wraps your domain
+objects in proxies. This allows unit testing as if through the lens of a
+GUI; trying to invoke an action that is disabled will throw an
+exception.
+
+Moving up to story testing/BDD, *Apache Isis* integrates with
+[Concordion](http://concordion.org). The business analyst specifies the
+behavior of the system in HTML, and then the developer wire up this
+specification to the domain model using a set of fixtures that interact
+with the domain objects following the same rules as the viewers. This
+allows application-level testing without the hassle of using a GUI
+testing framework such as *Selenium*.
+
+One final point: *Apache Isis* has a strong separation between its
+programming model and the framework that understands that programming
+model. So, your domain objects depend only on the *Apache Isis* applib
+(which defines annotations such as @RegEx), not the framework itself.
+This allows you to take your domain objects and deploy them on other
+frameworks later, if need be. The *Wicket Viewer* maintains this strong
+separation, defining its own applib for annotations and features unique
+to the *Wicket Viewer*.
+
+The *Wicket Viewer* compared to other *Apache Isis* viewers
+-----------------------------------------------------------
+
+Because the *Wicket Viewer* renders your domain model within a webapp,
+it is to some extent similar to the HTML viewer that is provided
+out-of-the-box by *Apache Isis* itself. However, unlike the HTML viewer,
+the *Wicket Viewer* is highly customizable. The *Wicket Viewer* itself
+essentially consists of a set of [Wicket](http://wicket.apache.org)
+Components that are used to render domain objects, individual member
+elements of domain objects, and indeed collections of domain objects.
+The components provided are sufficient to render any *Apache Isis*
+domain model. However, any developer with experience of *Wicket* can
+easily write their own components and register them with the *Wicket
+Viewer*. In this way, custom renderings of domain objects can be
+achieved.
+
+Typical Flow for Developing a Wicket Objects Application
+--------------------------------------------------------
+
+There are, of course, lots of ways to skin any given cat, but here's how
+you might go about developing an *Apache Isis* application to be
+deployed using the *Wicket Viewer*:
+
+- use the *Apache Isis* application archetype to create an outline
+ domain model, running against the in-memory object store. The
+ structure of a *Apache Isis* application is reviewed in ?.
+
+- (optionally) use the DnD viewer to define some of the basic domain
+ services and entities. Or, you might want to skip this step and
+ develop solely using Wicket.
+
+- run your application under *Wicket*, either using a built-in Jetty
+ web server (see ?) or as a regular webapp (see ?).
+
+- customize the look-n-feel to use your preferred fonts and logos by
+ updating the CSS (see ?). You can also use CSS to fine-tune the
+ layout for selected objects or object members (see ?).
+
+- continue to develop your domain application, identifying properties,
+ collections and defining behavior through actions. Also, define
+ fixtures to represent pre-canned scenarios to explore with your
+ domain expert. Check out the core *Apache Isis* documentation for
+ more on developing domain objects.
+
+- fine tune the set of Components used to render your entities. The
+ *Wicket Viewer* provides built-in Components to render every element
+ of your domain objects, and in some cases provides more than one
+ Component. When the *Wicket Viewer* provides a number of alternate
+ views like this, you might prefer only one. Or, you might use an
+ existing Component and adapt it into your own Component. In either
+ case, you'll need to fine-tune the set of ComponentFactorys (see ?).
+
+- implement custom representations of some entities (or collections of
+ entities), where it makes sense. For example, you might want to
+ display objects that have a location in a google maps mashup, or
+ objects that have a date/time in a calendar. Ultimately these custom
+ representations are also just ComponentFactorys. A number of
+ Components (including one for google maps and one for charting) are
+ described in ?; use these directly or use them as inspiration for
+ your own.
+
+- support specialized use cases, if you have any. That is, rather than
+ require the end-user to interact directly with persisted entities,
+ introduce transient process objects to manage workflow and bulk
+ input, or write transient report objects to provide dashboards
+
+- as you continue to develop your application, you may need to
+ integrate with external services. For example, you might want to
+ send out an email, or invoke a web service exposed by some other
+ system in your enterprise. Define an interface for these domain
+ services, and register their implementation in the *Apache Isis*
+ configuration file. See the main *Apache Isis* documentation for
+ more details on this.
+
+- ultimately your application will be ready to deploy. Before you do,
+ though, remember that you'll need to sort out persistence and
+ security (see ?)
+
+Enough verbiage. The next chapter is a run through of a simple
+application, screenshot by screenshot, so you can quickly assess whether
+the *Wicket Viewer* fits your needs.
+
+Application Walkthrough
+=======================
+
+> This chapter is a collection of screenshots to give you an idea of
+> what the
+> Wicket Viewer
+> can do.
+
+Most of the screenshots in this chapter require no specific GUI code; in
+fact the first six sections require no specialized code other than the
+domain objects. The GUI that you see is generated by the *Wicket Viewer*
+at runtime, directly from the domain model. You can find all the code
+for the domain objects in ?.
+
+Logging on, and the Application Services Menu
+---------------------------------------------
+
+The *Wicket Viewer* integrates with *Apache Isis* authentication
+mechanism (which is itself pluggable); so we start off with a login
+screen:
+
+![](images/010-login.png)
+
+The initial home page shows a welcome message and more importantly a
+menu bar for each of the registered services defined in the domain
+application. These application services are the start points for the
+user, allowing them to find existing objects and to create new ones. For
+example the `Employees` menu item corresponds to the EmployeeRepository
+class.
+
+![](images/020-services-bar.png)
+
+From the menu bar we can get to the menu items for each service. So, for
+example, the `Employees` domain service provides two actions,
+`All Employees` and `Find
+ Employees`. These are generated automatically from corresponding
+methods - allEmployees() and findEmployees() - in the EmployeeRepository
+service.
+
+![](images/030-services-action.png)
+
+Viewing Entities and Collections of Entities
+--------------------------------------------
+
+Because the `All Employees` action takes no arguments, invoking it just
+returns its results. In this case the action returns a collection (of
+Employees), and so the viewer renders the collection as a table. If the
+action had returned a single object, then that would have been rendered
+instead.
+
+![](images/040-action-result.png)
+
+Clicking on one of the links takes us to a page rendering that object,
+in this case an Employee. There is a form for the entity's properties on
+the left, and summary details on the right. In this particular case the
+entity has no collections; we'll see one that does shortly.
+
+![](images/050-entity-form.png)
+
+In the summary section we an image, a title and the entity actions. All
+these are rendered directly from a metamodel built by inspecting the
+entity's class. Just as we can invoke actions on the services, we can
+also invoke actions on the entities; for example, to view this
+Employee's Claims with the `Claims For,,,` action.
+
+![](images/060-entity-actions.png)
+
+As before, this action returns a collection (of Claims) and so is
+rendered as a table.
+
+![](images/070-entity-action-results.png)
+
+Clicking on a link to a Claim again renders the entity. This is rendered
+in a similar manner to the Employee entity seen earlier. However, the
+Claim entity also has a collection (of ClaimItems), so these are also
+rendered.
+
+![](images/080-entity-form-and-collections.png)
+
+Editing Objects
+---------------
+
+In *Apache Isis* applications, we modify objects either by invoking
+actions on them or by editing them directly. Which properties are
+editable is determined by the entity itself, with the *Wicket Viewer*
+providing an appropriate editor for each property type. In the following
+screenshot we see the Claim entity being edited.
+
+![](images/090-entity-editing-scalars.png)
+
+As well as supporting the editing of properties with value types
+(boolean, String, Date etc), the viewer also allows properties
+representing references to other entities to be edited. For example,
+each Claim has an `approver` (of type Approver, and implemented by
+Employee). Thus, the viewer gives us the ability to find an Employee
+from the `Employees` repository:
+
+![](images/100-entity-editing-references.png)
+
+Leaving us with the `approver` reference set up:
+
+![](images/110-entity-editing-references-result.png)
+
+Invoking Actions
+----------------
+
+Being able to edit entities makes it easy to build CRUD-style
+(create/read/update/delete) applications. The *Wicket Viewer* also
+allows arbitrary actions to be performed on entities. In the screenshot
+below, we see the `Add Item` action (corresponding to addItem() method
+on the Claim class) being called:
+
+![](images/120-entity-action.png)
+
+Because this action takes parameters, the viewer renders a dialog form
+for the user to complete. Just as with the entity editor, we can specify
+parameters of any type, including references to other entities if we
+wish). In this particular case the parameter types are just numbers and
+strings:
+
+![](images/130-entity-action-parameters.png)
+
+When the action is complete, the entity is modified, by adding a new
+ClaimItem into the Claim's `items` collection.
+
+![](images/140-entity-modified.png)
+
+Admittedly, this `Add Item` action just a CRUD-style action. But the
+business logic in the action could be arbitrarily complex. The other
+action in Claim is `Submit`, which could perform lots of business
+processing:
+
+![](images/150-entity-action-more-complex.png)
+
+This action also takes an argument, being a reference to an Approver:
+
+![](images/160-entity-action-reference-parameters.png)
+
+When the action is performed, the object's state is updated, along with
+any other processing. For example, a message could have been sent via an
+enterprise service bus to the processing department. Note the title of
+the Claim entity has also been updated:
+
+![](images/170-entity-title-updated.png)
+
+Business Rules
+--------------
+
+In addition to actions, we can also capture business rules by means of
+validation. For example, a Claim, once submitted, cannot be submitted
+again. With the *Wicket Viewer*, this is shown by a tooltip:
+
+![](images/180-entity-validation.png)
+
+*Apache Isis* supports three different types of validation: whether the
+class member (property, collection or action) is visible; whether it is
+usable, and, whether the proposed value or arguments are valid. Or, more
+pithily, "can you see it, can you use it, can you do it". The viewer
+surfaces all of these different validation rules in the GUI.
+
+View Components
+---------------
+
+The pages rendered by the *Wicket Viewer* are built from multiple
+*Apache Wicket* Components. For example, the application service menu
+bar has its own Component:
+
+![](images/200-view-components-application-service.png)
+
+Likewise, there's a Component to render an entire entity:
+
+![](images/205-view-components-entity-simple.png)
+
+And there's a Component to display the properties of an entity:
+
+![](images/210-view-components-entity-properties.png)
+
+And in turn there's a Component for every entity property:
+
+![](images/220-view-components-entity-property.png)
+
+There are Components such as these for every class member, including
+collections, actions and, indeed, action parameters. In fact, you can
+think of the *Wicket Viewer* as basically a collection of pre-canned
+Components that know how to render the *Apache Isis* metamodel.
+
+Note, by the way, the CSS classes. Each HTML element can be targetted
+either by its type (a string scalar), or by its class member (the
+Claim's `description` property), or both. The viewer therefore makes it
+easy to contribute custom CSS that applies to every page.
+
+Alternate Views
+---------------
+
+As we've seen already, there's a Component to render an entire entity.
+In fact, it's possible to provide more than one Component to do this. We
+could also view the entity in a tabbed view:
+
+![](images/230-multiple-views-for-entities.png)
+
+When there is more than one Component capable of rendering the object,
+the viewer allows the view to be selected:
+
+![](images/230-multiple-views-for-entities.png)
+
+This works for collections too; using the selector we can view a
+collection of Employees in a variety of ways:
+
+![](images/240-multiple-views-for-collections.png)
+
+Selecting the `icons` view shows the collection of Employees as icons:
+
+![](images/270-customize-ui-icons.png)
+
+So far all the screenshots we've seen have been generated from a basic
+domain application, with no custom GUI coding (see ?). But the *Wicket
+Viewer* is also extensible. So, we can write custom views/components,
+provide a corresponding ComponentFactory and then plug them into the
+*Wicket Viewer*'s registry of ComponentFactorys. For example, if we make
+Employee implement a view-specific Locatable interface, then we can
+render them on a google-maps mashup:
+
+![](images/280-customize-ui-maps-mashup.png)
+
+The selector, by the way, is actually implemented as yet another
+view/component, capable of rendering the entity or collection. It
+queries the ComponentFactory registry to determine how many other
+ComponentFactorys there are capable of rendering the entity or
+collection; if more than one then it provides a drop-down and then
+delegates to the other Components to do the work.
+
+Specialized Use Cases
+---------------------
+
+Being able to easily render entities and collection of entities without
+any custom UI coding is great for being able to develop an understanding
+of the problem domain. However, it doesn't always make sense to let the
+user interact directly with the domain objects. For example, if the
+domain objects are very fine-grained such that clicking into them would
+be tedious for the user to do, it makes sense to introduce another
+object that collect the required data and walk the graph of domain
+objects on the users behalf. Or, more straight forwardly, the use case
+might be particularly complex or subtle, and we want to provide the user
+with additional guidance.
+
+The *Wicket Viewer* therefore lets us work with objects designed to
+guide the user through the use case. Because they represent a particular
+solution to help the user achieve their objective, you can think of them
+as being part of the solution space (whereas regular domain objects
+belong to the problem space). Another name also given for objects of
+this type is "process objects"; they take the user through a particular
+process.
+
+For example, we might have a wizard that takes the user through the
+process of making a new Claim:
+
+![](images/300-process-objects.png)
+
+The object this action returns is not a Claim, instead it is a
+ClaimWizard. Unlike Claim, this is not persisted; its state is bound to
+a particular users' session. The design of the ClaimWizard is like any
+other wizard, taking the user through a number of pages; first an
+introductory page:
+
+![](images/310-wizard-intro-page.png)
+
+After that we are taken through pages for each of the properties; For
+example the next page prompts for the Claim's `claimant`:
+
+![](images/320-wizard-claimant-page.png)
+
+The Claim's `approver` and `description` properties likewise have the
+own pages, for example:
+
+![](images/330-wizard-approver-page.png)
+
+The final page allows the user to review details, then confirm:
+
+![](images/340-wizard-finish-page.png)
+
+On finish, the ClaimWizard will create and persists the Claim.
+
+Process objects like wizards are primarily concerned with inputting
+data. We can also have objects that are tailored towards the output of
+data, eg for reporting. For example, we could have a (non-persisted)
+ClaimSummary object that sums up Claim amounts by Claimant:
+
+![](images/400-analyze-claim-summary.png)
+
+We can then combine this with custom views, eg to represent a collection
+of such ClaimExpenseSummarys as a pie chart:
+
+![](images/410-analyze-summary-piechart.png)
+
+There's some guidance on writing application code to deal with such
+specialized use cases in ?.
+
+Running the Application
+=======================
+
+> This chapter describes how to take an *Apache Isis* application and
+> get it running using the *Wicket Viewer*, with the non-customized,
+> generic OOUI.
+
+Applications deployed to run with the *Wicket Viewer* are, ultimately
+just *Wicket* webapps that happen to boot up *Apache Isis*. As such,
+they are bootstrapped with a `web.xml` that is structured the same as
+any other *Wicket* application.
+
+This chapter describes how to run up such a webapp starting with a
+regular *Apache Isis* application.
+
+Structure of an Apache Isis Application
+---------------------------------------
+
+We recommend that you use *Apache Isis*' Maven application archetype to
+set up your application. Doing so will result in a multi-module project
+that contains the following modules:
+
+- `app`
+
+ Main (parent) module, whose `pom.xml` references the submodules
+
+- `app/dom`
+
+ Domain object model, plus interfaces for services, repositories and
+ factories
+
+- app/domsvc
+
+ Implementation of domain services (not repositories/factories)
+
+- `app/objectstore-default`
+
+ Implementation of repositories/factories for the default object
+ store
+
+- `app/fixture`
+
+ Fixtures, used to seed (in-memory) object store when running in
+ exploration/prototype mode
+
+- `app/commandline`
+
+ Bootstrap for running from the command line (typically, the DnD
+ viewer or HTML viewer)
+
+- `app/viewer-wicket`
+
+ The application set up to be run using wicket, and packaged up as a
+ webapp.
+
+You will see that the archetypes creates a number of other
+`app/viewer-xxx` and `app/objectstore-xxx` modules. You can delete those
+modules that aren't relevant to your final deployment (probably the
+`app/viewer-xxx` modules and most of the `app/objectstore-xxx` modules,
+or you can just ignore them. If you do delete any modules, remember to
+remove their reference from the parent `app/pom.xml` file'a \<modules\>
+section).
+
+### The viewer-wicket module's web.xml
+
+The `viewer-wicket` module aready contains a `web.xml` file to define
+the web app, in the `src/main/webapp` directory. The contents of this is
+largely boilerplate, and will be very familiar if you already know the
+*Apache Wicket* framework:
+
+ <?xml version="1.0" encoding="ISO-8859-1"?>
+ <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
+
+ <display-name>claims</display-name>
+ <filter>
+ <filter-name>wicket.app</filter-name>
+ <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
+ <init-param>
+ <param-name>applicationClassName</param-name>
+ <param-value>org.apache.isis.viewer.wicket.viewer.IsisWicketApplication</param-value>
+ </init-param>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>wicket.app</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ </web-app>
+
+The IsisWicketApplication is a subclass of *Wicket*'s own WebApplication
+that bootstraps *Apache Isis*, handles authentication and sets up
+sessions and transactions.
+
+### Deployment Mode
+
+*Apache Wicket* webapps can be run in one of two "configuration type"s,
+either in the `development` configuration type or in the `deployment`
+configuration type. In Wicket, the configuration type can be specified
+as either:
+
+1. A system property: `-D
+ wicket.configuration`
+
+2. as a servlet specific `<init-param>`
+
+3. as a context specific `<context-param>`
+
+Setting this value changes various properties, such as whether templates
+are reloaded. Wicket's Application\#configure() method is the place to
+look for all the differences.
+
+For its part, *Apache Isis* defines various "deployment mode"s. For
+example, `exploration` and `prototype` mode are both intended for
+single-user development, with the former requiring no login and also
+including any actions annotated as `@Exploration`. For multi-user
+(production) use, *Apache Isis* provides the `server` deployment mode,
+associating a separate *Apache Isis* runtime (IsisContext) to each
+thread (ie bound to a `ThreadLocal`).
+
+The *Wicket Viewer* maps *Wicket*'s `development` configuration type to
+*Apache Isis*' `prototype` deployment mode. However, the `server`
+deployment mode provided by *Apache Isis* is not quite appropriate for a
+*Wicket* webapp, because there could be multiple concurrent requests for
+a given user (originating from the same browser/user agent). The *Wicket
+Viewer* therefore defines a custom deployment mode which binds the
+*Apache Isis* runtime to the *Wicket* session (see the
+IsisContextForWicket class if you're interested in such things).
+
+What all this means is that selecting between *Apache Isis* deployment
+modes is done just by specifying the *Apache Wicket* configuration type.
+If you're already familiar with Wicket there's therefore nothing new to
+learn: just configure the webapp to run in either `development` or
+`deployment` mode.
+
+### Security
+
+Since both of the deployment modes supported by *Wicket Objects* require
+a login, it means we need to set up security. The IsisWicketApplication
+class provided by the *Wicket Viewer* subclasses from *Wicket*'s own
+AuthenticatedWebApplication, and serves up a sign-in page. To ensure
+that this sign-in page appears, every web page served up by the *Wicket
+Viewer* is annotated with
+`@AuthorizeInstantiation("org.apache.isis.viewer.wicket.roles.USER")`,
+which requires that every login has a role called
+`org.apache.isis.viewer.wicket.roles.USER`.
+
+*Apache Isis* deployment modes provide a couple of ways of avoiding
+login during development. For example, in `exploration` mode the viewers
+automatically login, while in `exploration` mode and `prototype` mode
+specifying a `LogonFixture` will means an automatic logon using the
+details provided within that fixture. The *Wicket Viewer* does not
+support `exploration` mode, however, and does not currently support
+LogonFixture. What that means is that it's always necessary to login.
+
+The *Wicket Viewer* delegates to *Apache Isis* to authentication.
+*Apache Isis*' default authentication mechanism is a no-op and requires
+no configuration. If you decide to a different authentication mechanism
+(eg file-based security, org.apache.isis.alternatives.security:file, or
+LDAP-based security, org.apache.isis.alternatives.security:ldap) then
+refer to the appropriate documentation for that module.
+
+The *Wicket Viewer* simply always places each login into the
+`org.apache.isis.viewer.wicket.roles.USER` role, to ensure that once the
+sign-in page is navigated past, that the user can access each web page.
+
+One consequence of this design is that the roles cannot currently be
+used by the *Apache Isis* domain objects nor the authorization
+mechanism; every user is simply in the USER role. This will be addressed
+in the future.
+
+Running as a WAR
+----------------
+
+The most straightforward approach for running a *Wicket
+Viewer*application is to build a WAR archive from the `viewer-wicket`
+module. Most IDEs will then allow this WAR to be deployed on an external
+servlet container, for debugging. For example, in Eclipse this is done
+by Run As \> Server:
+
+![](images/RunAsServer.png)
+
+and then select the external servlet container to deploy against:
+
+![](images/RunAsServer-dialog.png)
+
+If deploying this way, then the web browser URL may be slightly
+different. For example with Eclipse the URL to specify is
+<http://localhost:8080/webappname>.
+
+Running using *Isis*' WebServer class
+-------------------------------------
+
+As an alternative to deploying as a webapp, you can use Isis' WebServer
+class. This class has its own main() to bootstraps Jetty and configures
+a webapp from the `web.xml` file. If using Eclipse, for example, then yo
+can create a `.launch` configuration to run your application using
+WebServer.
+
+### Adding Dependency to Bootstrap
+
+The only thing you need to do is to edit the `viewer-wicket` module's
+`pom.xml`; add/comment in:
+
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>webserver</artifactId>
+ </dependency>
+
+### Running the Application
+
+Running the application is just a matter of running the
+org.apache.isis.WebServer. For example, in Eclipse the following launch
+configuration should suffice:
+
+![](images/WebServer-launch.png)
+
+Running this will boot strap a Jetty webserver:
+
+![](images/WebServer-running.png)
+
+You can then log on using <http://localhost:8080>:
+
+![](images/WicketObjects-logon-page.png)
+
+Customizing the Startup
+-----------------------
+
+Most of the remaining chapters address various means by which the UI
+generated by the *Wicket Viewer* can be customized. Before we go any
+further, though, we should mention that the viewer uses dependency
+injection provided by [Guice](http://google-guice.googlecode.com). It
+comes with default bindings, so customizing the *Wicket Viewer* requires
+overriding these default bindings.
+
+Note: this usage of Guice is likely to be replaced by JSR-299 based
+dependency mechanism.
+
+Specifically, in IsisWicketApplication, there's a method
+newIsisWicketModule():
+
+ public class IsisWicketApplication extends AuthenticatedWebApplication {
+ ...
+ protected Module newIsisWicketModule() {
+ return new IsisWicketModule();
+ }
+ }
+
+This method can be overridden in your own subclass of
+IsisWicketApplication, providing a new implementation of *Guice*'s
+Module interface. Typically you'll just want to override one or two of
+the bindings, so you should use the Modules helper class:
+
+ public class MyApplication extends IsisWicketApplication {
+ ...
+ protected Module newIsisWicketModule() {
+ return Modules.override(super.newIsisWicketModule()).with(
+ new AbstractModule() {
+ @Override
+ protected void configure() {
+ // override bindings here
+ }
+ }
+ );
+ }
+ }
+
+To pick up your subclass of IsisWicketApplication, just update the
+`web.xml` file.
+
+Customizing CSS
+===============
+
+> This chapter describes how to customize the UI generated by the
+> *Wicket Viewer* by providing application-specific CSS.
+
+CSS is used heavily by the *Wicket Viewer*, with the HTML of each
+Component using CSS classes for the styling. But you can override the
+default styling by supplying an application-level CSS file.
+
+By default this file should be called `application.css` and should
+reside within `WEB-INF` directory.
+
+There are two levels at which we can override the default styling,
+either generically or specific to a particular domain. Let's look at
+both.
+
+Generic CSS
+-----------
+
+The name of each class indicates the nature of what is being rendered,
+and each Component provides some default styling so that the
+out-of-the-box UI is usable. For example, an entity icon, title and
+actions are rendered as:
+
+![](images/EntitySummary.png)
+
+The icon and title for this are rendered as:
+
+ <div class="entitySummary">
+ <img src="?wicket:interface=:4:entity:entity:entitySummary:entityImage:1:IResourceListener::"
+ class="entityImage" wicket:id="entityImage">
+ <label class="entityTitle" wicket:id="entityTitle">Fred Smith</label>
+ ...
+ </div>
+
+So, to change the font, you could use:
+
+ div.entitySummary > label.entityTitle {
+ color: maroon;
+ font-size: xx-large;
+ font-weight: bolder;
+ }
+
+This would render the entity icon and title as:
+
+![](images/EntitySummary-Css.png)
+
+In this way you can develop a look-n-feel for the application (or
+perhaps your organization).
+
+Specific CSS
+------------
+
+As well as targetting HTML elements generically, individual class
+members can also be targetted for a particular domain model.
+
+For example, the properties of a Claim object might be rendered as:
+
+![](images/Claim-properties.png)
+
+The HTML for the description property is:
+
+ <div class="Claim-description" wicket:id="scalar">
+ <wicket:panel>
+ <div class="string scalarPanel">
+ <label wicket:id="scalarIfRegular" for="scalarValue3d">
+ <span class="scalarName" wicket:id="scalarName">description</span>
+ <span class="scalarValue">
+ <input type="text" title="" size="25" disabled="disabled"
+ value="Meeting at clients" wicket:id="scalarValue"
+ id="scalarValue3d"
+ name="properties:1:scalar:scalarIfRegular:scalarValue">
+ </span>
+ </label>
+ <span wicket:id="feedback">
+ <wicket:panel>
+ </wicket:panel>
+ </span>
+ </div>
+ </wicket:panel>
+ </div>
+
+To change the label of this specific element, we could use:
+
+ .Claim-description .scalarName {
+ color: maroon;
+ font-weight: bolder;
+ }
+
+which would give us:
+
+![](images/Claim-properties-CSS.png)
+
+This is a slightly trite example, but demonstrates the point.
+
+Changing the location/name of the application CSS file
+------------------------------------------------------
+
+As already mentioned, the default for the application CSS file is in
+`WEB-INF/application.css`. If for any reason you want to change this,
+you can do so by subclassing IsisWicketApplication and overriding the
+newIsisWicketModule() method.
+
+For example, to use `css/myapp.css` (under `WEB-INF`) you would write:
+
+ public class MyApplication extends IsisWicketApplication {
+ ...
+ protected Module newIsisWicketModule() {
+ return Modules.override(super.newIsisWicketModule()).with(
+ new AbstractModule() {
+ @Override
+ protected void configure() {
+ bindConstant().annotatedWith(ApplicationCssUrl.class).to("css/myapp.css");
+ }
+ }
+ );
+ }
+ }
+
+Your custom application should then be registered in `web.xml`, as
+described in ?.
+
+Using the Wicket Viewer AppLib
+==============================
+
+> This chapter explains how to use certain viewer-specific features in
+> your domain application.
+
+Many *Isis* components have their own application library, the *Wicket
+Viewer* included. This allows you to specify additional viewer-specific
+semantics within your domain model; the viewer can then render them
+appropriately.
+
+Configuring the Project Modules
+-------------------------------
+
+In order to use the viewer-specific features, the `dom` module must
+reference the applib, and the `viewer-wicket` module must be configured
+appropriately.
+
+### Referencing the AppLib
+
+In the dom project, add in a `<dependency>` to the *Wicket Viewer*
+applib:
+
+ <dependencies>
+ ...
+
+ <!-- Wicket Viewer -->
+ <dependency>
+ <groupId>org.apache.isis.viewer.wicket</groupId>
+ <artifactId>applib</artifactId>
+ </dependency>
+
+ ...
+ </dependencies>
+
+This will allow you to use the *Wicket Viewer*'s annotations etc. in
+your domain objects.
+
+### Configuring the *Wicket Viewer* Facets
+
+In addition, you must also configure your application so that the *Isis*
+metamodel contains the information to be picked up by the *Wicket
+Viewer*.
+
+In the `viewer-wicket` module, add the following to `isis.properties`:
+
+ isis.reflector.facets.include=\
+ org.apache.isis.viewer.wicket.metamodel.wizardpagedesc.WizardPageDescriptionAnnotationFacetFactory\
+ ,org.apache.isis.viewer.wicket.metamodel.cssclass.CssClassAnnotationFacetFactory
+
+This basically instructs *Apache Isis* to capture additional information
+(facets) in its metamodel. Now let's look at what these facets are used
+for.
+
+@CssClass
+---------
+
+The @CssClass annotation allows you to specify an additional CSS class
+(or classes) applied on any object type, property, collection or action.
+This CSS will be added verbatim to any CSS classes that are normally
+applied by the *Wicket Viewer* itself.
+
+\*\*\* TODO: complete.
+
+There is further discussion on
+
+@WizardPageDescription
+----------------------
+
+It's common for wizards to have a description explaining what the user
+is expected to do. This can be modeled as a String property annotated
+with @WizardPageDescription, for example:
+
+ @NotPersistable
+ public class ClaimWizard extends AbstractDomainObject {
+
+ ...
+
+ @WizardPageDescription
+ @MemberOrder(sequence = "1")
+ public String getPageDescription() { ... }
+
+ ...
+ }
+
+Adding this annotation causes the *Wicket Viewer* to select a different
+Component to be used to render this property; specifically, one that
+renders the value as a large label. You can see the result of this
+annotation in below (the label above the claimant).
+
+![](images/320-wizard-claimant-page.png)
+
+Note that this annotation only affects the description; the three
+buttons shown in the above screenshot are as a result of the wizard
+being implemented as a custom component. For more on that topic, see ?.
+
+Customizing the Component Set
+=============================
+
+> This chapter describes the how to customize the UI by modifying the
+> set of components used to render objects, properties, collections or
+> actions.
+
+The *Wicket Viewer* offers several ways in which the UI rendered can be
+customized, from simply tweaking the CSS (see ?) through to the use of
+custom components for mashups and wizards. This chapter explains how to
+use pre-existing custom components; ? explains how to write your own
+components, and lists some components that have already been developed.
+
+There are more details provided in each of the sections that follow.
+
+Component Factories
+-------------------
+
+### ComponentFactory interface
+
+At its heart the *Wicket Viewer* consists of a set of *Wicket*
+`Component`s and corresponding IModel\<?\>s that are used to render
+entities, collections of elements and indeed individual members of
+elements. Each Components is created by a corresponding
+ComponentFactory, with the factory to use discovered using a
+chain-of-responsibility pattern.
+
+The Components created by the *Wicket Viewer* vary in size from
+rendering an entire collection of entities all the way down to a single
+property of an entity. You can find the full set of built-in Components
+by searching for implementations of ComponentFactory:
+
+![](images/ComponentFactory-hierarchy.png)
+
+For example, the CollectionContentsAsAjaxTableFactory class is used to
+render a collection of entities (eg returned from an action invocation)
+as, erm, an ajax table;
+
+ public class CollectionContentsAsAjaxTableFactory extends ComponentFactoryAbstract {
+ private static final long serialVersionUID = 1L;
+ private static final String NAME = "styled";
+
+ public CollectionContentsAsAjaxTableFactory() {
+ super(ComponentType.COLLECTION_OF_ENTITIES, NAME);
+ }
+
+ @Override
+ public boolean appliesTo(IModel<?> model) {
+ return model instanceof EntityCollectionModel;
+ }
+
+ public Component createComponent(String id, IModel<?> model) {
+ EntityCollectionModel collectionModel = (EntityCollectionModel) model;
+ return new CollectionContentsAsAjaxTable(id, collectionModel);
+ }
+ }
+
+The selection of the ComponentFactory is based on two criteria: the
+ComponentType, and the IModel\<?\>. Broadly speaking the ComponentType
+standardizes the `wicket:id` used in the HTML fragment (so
+`<div wicket:id="collectionContents"/>` would map onto the
+ComponentType.COLLECTION\_CONTENTS, while the IModel\<?\> is the
+corresponding information used for the rendering of that component. But
+there's a semi-formal relationship between these two concepts; the
+ComponentType effectively acting as a power-type for the subclass of
+IModel\<?\> that is supplied.
+
+The superclass ComponentFactoryAbstract takes responsibility for
+checking that the ComponentType matches the `wicket:id`, while
+delegating the checking of the IModel to its subtype:
+
+ public abstract class ComponentFactoryAbstract implements ComponentFactory ... {
+ ...
+ public final boolean appliesTo(ComponentType componentType, IModel<?> model) {
+ return componentType == getComponentType() && appliesTo(model);
+ }
+
+ protected abstract boolean appliesTo(IModel<?> model);
+ ...
+ }
+
+The subclass then refines this check by overriding appliesTo() to also
+check the model; returning true indicates that the ComponentFactory is
+able to render that model, after which the createComponent() method is
+then called to actually create the instance. So in
+CollectionContentsAsAjaxTableFactory, its implementation simply checks
+if the supplied model is an EntityCollectionModel. More
+sophisticated/less generic ComponentFactory might also make additional
+checks; you can find some examples of these in ?.
+
+### Registering ComponentFactorys using META-INF Services
+
+The easiest way to register new ComponentFactorys is using the JDK's own
+ServiceLoader capability.
+
+All that is needed is for your ComponentFactory to be registered in a
+file on the classpath call
+`META-INF/services/org.apache.isis.viewer.wicket.ui.ComponentFactory`.
+The contents of this file should be the fully qualified class name of
+your ComponentFactory implementation. And that's it! Registering the
+ComponentFactory is done automatically just by virtue of updating the
+classpath. You'll find that the custom components described in ? all use
+this technique.
+
+Note that this technique does not allow you to remove existing
+ComponentFactorys, only add new ones. So if you do want to exclude any
+of the built-in ComponentFactorys, then you will still need to use the
+ComponentFactoryList method.
+
+> **Note**
+>
+> This capability is provided by the ComponentFactoryRegistry component,
+> which is also bound in the IsisWicketModule. If you wanted to, you
+> could replace this higher-level registry component with your own
+> implementation. There's probably very little need to do this though,
+> given that you can just as easily customize using ComponentFactoryList
+> or `META-INF` services.
+
+### Registering ComponentFactorys using a custom ComponentFactoryList
+
+The set of ComponentFactorys that are provided with the *Wicket Viewer*
+are specified by the ComponentFactoryList interface.
+
+If you only want to add new factories, we recommend using the technique
+described in ?. But if you want to remove support for any of the default
+factories, or perhaps change the order in which factories are
+registered, you'll need to do use write and the bind in your own
+implementation of ComponentFactoryList.
+
+To write your implementation of ComponentFactoryList, start with the
+default implementation, ComponentFactoryListDefault. You'll see that it
+is written so that it can be easily subclassed and overridden on an
+as-needed basis. Worst case scenario, you can copy-and-paste code as
+necessary.
+
+Then, you need to override the binding in newIsisWicketModule(), eg:
+
+ public class MyApplication extends IsisWicketApplication {
+ ...
+ protected Module newIsisWicketModule() {
+ return Modules.override(super.newIsisWicketModule()).with(
+ new AbstractModule() {
+ @Override
+ protected void configure() {
+ bind(ComponentFactoryList.class).to(MyComponentFactoryList.class);
+ }
+ }
+ );
+ }
+ }
+
+You should also ensure that your MyComponentFactoryList is annotated
+with @Singleton.
+
+And, do remember to update `web.xml` to reference your subclass of
+IsisWicketApplication.
+
+Advanced Customization
+----------------------
+
+This section covers a couple of more advanced customization topics.
+
+### Page Registry
+
+While the content of any given web page rendered by the *Wicket Viewer*
+is made up of multiple Components, there are in fact only a small number
+of WebPages:
+
+- WelcomePage displays the initial home page with a welcome message
+
+- EntityPage displays a single entity
+
+- ActionPage displays an action dialog or the results of invoking an
+ action.
+
+Each of these has a corresponding HTML page which defines the content of
+that page. In many cases the look-n-feel of these pages can be adjusted
+simply using CSS, as described in ?. If necessary though an entirely
+different page layout can be specified, for example to put the menubar
+on the left rather than at the top.
+
+The easiest approach to define a new page is to subclass PageAbstract
+superclass and then provide a different implementation of PageRegistry.
+As for ComponentFactorys, this is done by providing a new
+implementation, and then overriding a binding in newIsisWicketModule().
+
+The default pages are specified by PageClassListDefault:
+
+ public class PageClassListDefault implements PageClassList {
+
+ @Override
+ pulic void registerPages(PageRegistrySpi pageRegistry) {
+ pageRegistry.registerPage(PageType.SIGN_IN, WicketSignInPage.class);
+ pageRegistry.registerPage(PageType.SIGN_OUT, WicketSignOutPage.class);
+ pageRegistry.registerPage(PageType.ENTITY, EntityPage.class);
+ pageRegistry.registerPage(PageType.HOME, HomePage.class);
+ pageRegistry.registerPage(PageType.ACTION, ActionPage.class);
+ }
+ }
+
+You can easily copy-n-paste this to create your own implementation. Note
+though that there must be a registered page for every PageType instance,
+otherwise the *Wicket Viewer* will fail fast on boot time.
+
+Overriding the binding is done in the usual way:
+
+ public class MyApplication extends IsisWicketApplication {
+ ...
+ protected Module newIsisWicketModule() {
+ return Modules.override(super.newIsisWicketModule()).with(
+ new AbstractModule() {
+ @Override
+ protected void configure() {
+ bind(PageClassList.class).to(MyPageClassList.class);
+ }
+ }
+ );
+ }
+ }
+
+Don't forget to update the web.xml to specify your subclass of
+IsisWicketApplication.
+
+> **Note**
+>
+> If all you want is to provide a custom rendering of a particular
+> interface or class, then you should instead write and register a
+> ComponentFactory, with a ComponentType.ENTITY and filtering the
+> EntityModel. The custom components described in ? do this, as does the
+> component registered in the test application to render a wizard (see
+> ?).
+
+### Subclassing IsisWicketApplication
+
+As we've seen, you can also customize *Wicket Objects* in various ways
+by subclassing the IsisWicketApplication bootstrap. The most common
+reason for doing so is to override the default implementation of
+ComponentFactoryList.
+
+This design follows the general style of *Wicket*; in fact, you'll see
+that IsisWicketApplication itself overrides a number of other methods
+(such as newRequestCycle() and newConverterLocator()), in order to hook
+*Apache Isis* into the rest of Wicket.
+
+In general it's unlikely that you'll need to alter the behavior of these
+hook methods; but it's useful to know that *Wicket Objects* doesn't
+particularly interfere with the way in which you may be used to
+customizing regular *Wicket* applications.
+
+Writing Custom Components
+=========================
+
+> This chapter provides some further guidance on objects designed to
+> support specialized use cases.
+
+Back in the application walkthrough (see ?) we saw that the *Wicket
+Viewer* has support for non-persisted objects that are designed to
+support specialized use cases. Whereas regular persisted domain objects
+can be thought of as part of the problem space, such non-persisted
+objects can be thought of as being part of the solution space because
+they offer a particular solution to a particular user objective. We call
+these objects *process objects* because objects they help a user perform
+a particular process.
+
+This chapter provides some general guidance on writing such process
+objects, and outlines the support that exists in *Wicket Objects* for
+writing custom components for such objects.
+
+Custom Components for Process Objects
+-------------------------------------
+
+Because process objects are there to guide the user, they often go
+hand-in-hand with custom components so that they can be rendered in a
+particular way.
+
+For example, in the application walkthrough we saw that a ClaimWizard
+process object is rendered with its previous(), next() and finish()
+actions as regular buttons:
+
+![](images/320-wizard-claimant-page.png)
+
+Similarly, the ClaimExpenseSummary object (or rather, a collection of
+them) hooks into the capabilities of the googlecharts component
+(discussed in ?):
+
+![](images/410-analyze-summary-piechart.png)
+
+You can use any of the *Wicket Viewer*'s built-in Components that are
+used to build the generic views for your own custom views; search down
+the ComponentFactory inheritance hierarchy and there's a good chance
+you'll find something of use. For example, you can easily add components
+to represent properties in a wizard (the custom Component for
+ClaimWizard does precisely this; you can inspect the code in ?).
+
+The *Wicket Viewer* also has a small number of Components intended for
+writing custom views.
+
+### ProcessObjectPanelAbstract
+
+The ProcessObjectPanelAbstract is intended to be used as the superclass
+for any panel-like Component that will render a process object. Its
+model is intended to be an EntityModel, which wraps the process object.
+
+This adapter class contains a number of convenience methods to help
+build panels:
+
+- addProperties(Form\<?\> form, String id)
+
+ This adds the currently visible properties from the process object
+ to the provided form
+
+- isValid(Form\<?\> form)
+
+ This validates the process object, where the form holds the
+ properties
+
+- executeNoArgAction(String actionId)
+
+ Executes the indicated action on the process object (expected to
+ take no-arguments).
+
+Although minimal, these methods are sufficient to build a basic wizard.
+The executeNoArgAction() method, for example, allows `Previous`, `Next`
+and `Finish` buttons to be added.
+
+### Help Wanted!
+
+As you can see, the level of support provided by the *Wicket Viewer* for
+custom views is, admittedly, quite limited. There's nothing to prevent
+you from writing your own, of course, but to do so you'll need to use
+with the *Apache Isis* metamodel APIs.
+
+We hope to extend the components available as *Wicket Objects* continues
+to be developed. But in the meantime, if you build a Component that you
+think would be generally useful, please consider contributing it back to
+this project for the benefit of others.
+
+Use a Page enum for Wizards
+---------------------------
+
+Here's just a bit of good old-fashioned advice; consider using an enum
+to track the state of your wizards.
+
+For example, the ClaimWizard in the example app has the following enum
+defined:
+
+ @NotPersistable
+ public class ClaimWizard extends AbstractDomainObject {
+
+ public enum Page {
+ INTRO("This wizard will take you through the process of creating a claim"),
+ CLAIMANT("Enter the claimant that is making this claim"),
+ APPROVER("By default, the claimant's own approver will approve this claim. " +
+ "Update here if another approver will approve this claim."),
+ DESCRIPTION("Update the description if required."),
+ SUMMARY("Confirm all details, or go back and amend if needed");
+
+ private String description;
+ private Page(String description) {
+ this.description = description;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public boolean hasPrevious() {
+ return ordinal() > 0;
+ }
+ public Page previous() {
+ if (hasPrevious()) {
+ return values()[ordinal() - 1];
+ } else {
+ return this;
+ }
+ }
+
+ public boolean hasNext() {
+ return ordinal() < values().length - 1;
+ }
+ public Page next() {
+ if (hasNext()) {
+ return values()[ordinal() + 1];
+ } else {
+ return this;
+ }
+ }
+
+ @Ignore
+ public boolean is(Page... pages) {
+ for (Page page : pages) {
+ if (page == this) {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
+ ...
+ }
+
+This not only defines the descriptions of each Page, it also includes
+some logic for the previous() and next() actions to delegate to:
+
+ @NotPersistable
+ public class ClaimWizard extends AbstractDomainObject {
+
+ // {{ Page
+ private Page page;
+ @Hidden
+ public Page getPage() { ... }
+ public void setPage(final Page page) { ... }
+ // }}
+
+
+ // {{ Page Description
+ @WizardPageDescription
+ @MemberOrder(sequence = "1")
+ public String getPageDescription() { ... }
+
+ // {{ previous
+ @MemberOrder(sequence = "1")
+ public void previous() {
+ setPage(getPage().previous());
+ }
+ public String disablePrevious() {
+ return coalesce(noPreviousPage(), confirmIfOnSummaryPage());
+ }
+ private String noPreviousPage() {
+ return !getPage().hasPrevious() ? "no previous page" : null;
+ }
+ // }}
+
+ // {{ next
+ @MemberOrder(sequence = "2")
+ public void next() {
+ setPage(getPage().next());
+ }
+ public String disableNext() {
+ return coalesce(noNextPage(), confirmIfOnSummaryPage());
+ }
+ private String noNextPage() {
+ return !getPage().hasNext() ? "no next page" : null;
+ }
+ // }}
+
+ ...
+ }
+
+Custom Components in isis-contrib
+=================================
+
+> This chapter describes a number of custom components for the *Wicket
+> Viewer*. Some of these integrate third party components and/or
+> experimental.
+
+As was described in ?, the *Wicket Viewer* is designed to be extensible,
+allowing you to plug in more sophisticated renderings of the domain
+objects that make up your application. This chapter describes a number
+of custom components that demonstrate this capability, most of which are
+basically wrappers around functionality within the *Wicket*'s companion
+[WicketStuff](http://wicketstuff.org) project.
+
+The components here are probably best considered as examples rather than
+formally part of the *Wicket Viewer*, if only because we want the
+*Wicket Viewer* to depend just on core *Wicket*, not *WicketStuff*. But
+what you will find is that all the components here follow a similar
+layout, so you can easily adapt copy them into your own projects and
+adapt them as you feel fit.
+
+About the Components
+--------------------
+
+The source for these components is available at \*\*\*.
+
+### Common Layout
+
+Most of the components define their own interfaces or annotations; these
+are then implemented or annotated on the domain classes so that the
+component knows whether it applies or not (see discussion on
+ComponentFactory, in ?).
+
+To minimize the coupling between the domain objects and the component
+implementation, we separate out the interfaces/annotations into an
+applib.
+
+![](images/views-common-layout.png)
+
+The naming convention for these modules is:
+
+- `org.starobjects.wicket:view-xxx` for the parent module for view
+ 'xxx'
+
+- `org.starobjects.wicket:view-xxx-applib` for the applib submodule
+
+- `org.starobjects.wicket:view-xxx-view` for the view submodule (that
+ contains the actual ComponentFactory and Component implementations)
+
+### Adding Dependency Management for Custom Views
+
+In the parent project's `pom.xml`, specify the modules of the custom
+views that you want to use, along with the version:
+
+ <dependencyManagement>
+ <dependencies>
+ ...
+
+ <!-- Wicket Viewer view extensions -->
+ <dependency>
+ <groupId>org.apache.isis.viewer.wicket</groupId>
+ <artifactId>view-gmap2-applib</artifactId>
+ <version>${wicketobjects.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.viewer.wicket</groupId>
+ <artifactId>view-gmap2-view</artifactId>
+ <version>${wicketobjects.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.viewer.wicket</groupId>
+ <artifactId>view-googlecharts-applib</artifactId>
+ <version>${wicketobjects.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.viewer.wicket</groupId>
+ <artifactId>view-googlecharts-view</artifactId>
+ <version>${wicketobjects.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.viewer.wicket</groupId>
+ <artifactId>view-calendarviews-applib</artifactId>
+ <version>${wicketobjects.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.viewer.wicket</groupId>
+ <artifactId>view-calendarviews-view</artifactId>
+ <version>${wicketobjects.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.viewer.wicket</groupId>
+ <artifactId>view-cooldatasoftmenu-view</artifactId>
+ <version>${wicketobjects.version}</version>
+ </dependency>
+
+ ...
+ <dependencies>
+ </dependencyManagement>
+
+### Adding the Custom View's AppLibs as Dependencies
+
+\*\*\* Again, if you intend to use any of the custom components (see ?),
+then also add in dependencies to their respective applibs (if they have
+one):
+
+ <dependencies>
+ ...
+
+ <!-- Wicket Viewer view extensions -->
+ <dependency>
+ <groupId>org.starobjects.wicket</groupId>
+ <artifactId>view-calendarviews-applib</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.starobjects.wicket</groupId>
+ <artifactId>view-gmap2-applib</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.starobjects.wicket</groupId>
+ <artifactId>view-googlecharts-applib</artifactId>
+ </dependency>
+
+ ...
+ </dependencies>
+
+### Update Classpath
+
+The classpath for both the `dom` submodule and the `commandline` /
+`webapp` submodule each need to be updated (see ? for an overview of the
+typical structure of an *Apache Isis* application):
+
+- the `dom` submodule should be updated to reference the
+ view-xxx-applib submodule for each custom component
+
+- the `commandline` / `webapp` module should be updated to reference
+ the `view-xxx-view` submodule for each custom component
+
+Gmap2
+-----
+
+The gmap2 component renders a collection of objects in a Google map:
+
+![](images/280-customize-ui-maps-mashup.png)
+
+All that is required is for the object to implement Locatable interface,
+which in turn returns a Location value object:
+
+ package org.apache.isis.viewer.wicket.view.gmap2.applib;
+
+ public interface Locatable {
+ Location getLocation();
+ }
+
+If deploying on localhost, no API key is required. However, internet
+deployments do require an key, which should be specified as an
+init-parameter for the *Wicket* filter in `web.xml`:
+
+ <?xml version="1.0" encoding="ISO-8859-1"?>
+ <web-app ... >
+
+ ...
+
+ <filter>
+ <filter-name>wicket.app</filter-name>
+ <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
+ <init-param>
+ <param-name>applicationClassName</param-name>
+ <param-value>org.apache.isis.viewer.wicket.viewer.app.IsisWicketApplication</param-value>
+ </init-param>
+ <init-param>
+ <param-name>GOOGLE_MAPS_API_KEY</param-name>
+ <param-value>(key here)</param-value>
+ </init-param>
+ </filter>
+
+ </web-app>
+
+Google Charts
+-------------
+
+The googlechart component provides basic charting capabilities. It
+currently supports a single chart type; to render a collection as a pie
+chart:
+
+![](images/410-analyze-summary-piechart.png)
+
+All that is required is for the object to implement the (horribly named)
+PieChartable:
+
+ package org.apache.isis.viewer.wicket.view.googlecharts.applib;
+
+ public interface PieChartable {
+
+ double getPieChartValue();
+ String getPieChartLabel();
+ }
+
+The label is used to point to each sector on the pie chart, the value
+determines the size of each sector relative to the other sectors.
+
+CoolDataSoft Application Services Menu
+--------------------------------------
+
+The CoolDataSoft application services menu provides a different
+look-n-feel for the application services menu, using Ajax instead of
+CSS:
+
+![](images/cooldatasoft-appmenu.png)
+
+The implementation is based upon code lifted from the
+[wicket-menu](http://code.google.com/p/wicket-menu/) project, hosted on
+code.google.com. Please note that this code is GPLv3 and so cannot be
+used freely in commercial applications.
+
+Deployment Topics
+=================
+
+> This chapter touches on various topics that should be addressed prior
+> to deployment.
+
+Before you can deploy your application into production there are a
+number of things to be addressed. Most significantly of these is
+persistence, but security is another important topic.
+
+Because the *Wicket Viewer* runs on top of *Apache Isis*, many of the
+deployment tasks are based on the way in which *Apache Isis* tackles
+them.
+
+This chapter briefly outlines the main tasks from a *Wicket Objects*
+perspective. You might, though, want to dig out my book, [Domain Driven
+Design using Naked Objects](http://pragprog.com/titles/dhnako), for more
+in-depth coverage of the *Apache Isis* side-of-things (it covers *Apache
+Isis*' predecessor, *Naked Objects*, but is still broadly applicable).
+
+Running in a WebApp
+-------------------
+
+When developing *Apache Isis* applications you can run from either the
+`commandline` project or from the `webapp` project (see ?). If you've
+been using the former, then you'll need to switch to running from the
+latter so that your application can be built as a WAR for deployment.
+Take care to ensure that:
+
+- the classpath dependencies are the same (so that any custom
+ components you're using or have written are picked up)
+
+- that the `isis.properties` config file is the same
+
+Persistence
+-----------
+
+If you've been using the in-memory object store for development,
+obviously you'll need to switch to a persistent object store before you
+deploy.
+
+Going into the details of that is outside the scope of this guide, but
+it's worth noting that you have a number of options:
+
+- the simplest persistence mechanism (albeit still only really for
+ prototyping) is to use the XML object store. You can specify this in
+ `isis.properties`:
+
+ isis.persistor=xml
+ isis.xmlos.dir=/tmp/xml
+
+- more likely though you'll want to use a relational database. One
+ option is [JPA Objects](http://jpaobjects.sourceforge.net), another
+ sister project to *Apache Isis* (like *Wicket Objects* itself, in
+ fact). There's reasonable coverage in the
+ [DDDuNO](http://pragprog.com/titles/dhnako) book.
+
+- *Apache Isis* also has (will have) a JDBC-based object store, SQL
+ Object Store
+
+- If relational databases aren't your thing, *Apache Isis* also has
+ (will have) a BerkeleyDB Object Store
+
+Security
+--------
+
+By default, *Wicket Objects* is configured to use *Apache Isis*' default
+authentication and authorization. This are both file-based, with a
+simple passwords file to define users, and a similar file to define
+authorization. *Apache Isis* does though provide an implementation for
+both that use LDAP. This is discussed in the other *Apache Isis*
+documentation and in Dan Haywood's book. Alternatively, you could always
+write your own implementations to hook into your own security
+infrastructure.
+
+See also ?.
+
+Wicket DEPLOYMENT mode
+----------------------
+
+Finally, you'll also want to switch into Wicket deployment mode (ie for
+production). This is done in the normal way, by modifying *web.xml*:
+
+ <?xml version="1.0" encoding="ISO-8859-1"?>
+ <web-app ... >
+
+ ...
+
+ <filter>
+ <filter-name>wicket.app</filter-name>
+ <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
+ <init-param>
+ <param-name>applicationClassName</param-name>
+ <param-value>org.apache.isis.viewer.wicket.viewer.app.IsisWicketApplication</param-value>
+ </init-param>
+ <init-param>
+ <param-name>configuration</param-name>
+ <param-value>deployment</param-value>
+ </init-param>
+ </filter>
+
+ </web-app>
+
+Doing this also disables *Apache Isis* "exploration" actions (any action
+annotated with @Exploration will no longer be visible).
+
+Example Application
+===================
+
+> This appendix contains (almost) all the code that makes up the example
+> application shown in the screenshots in ?. The purpose in including
+> these listings is just to give you an idea of what it takes to write a
+> *Wicket Objects* application; this isn't a full tutorial on what it
+> all means.
+
+If you're interested in trying out the application, you'll find it at
+<https://wicketobjects.svn.sourceforge.net/svnroot/wicketobjects/trunk/testapp/claims>.
+
+Domain Application (Problem Space / Persisted Objects)
+------------------------------------------------------
+
+Most of the application shown in the screenshots (see ?) requires only
+the domain model. This is made up of three main entities, Employee,
+Claim and ClaimItem. The dependency between employee and claims package
+is acyclic; every Claim has a Claimant and an Approver, and Employee
+implements both the Approver and Claimant interfaces.
+
+### claims package
+
+#### Claim
+
+The Claim class is by far the largest domain class. Below is a listing
+of all the methods; the body of the getters and setters and some of the
+validation methods have been omitted.
+
+ package org.apache.isis.examples.claims.dom.claim;
+
+ import java.util.ArrayList;
+ import java.util.List;
+
+ import org.apache.isis.applib.AbstractDomainObject;
+ import org.apache.isis.applib.annotation.Disabled;
+ import org.apache.isis.applib.annotation.Ignore;
+ import org.apache.isis.applib.annotation.MaxLength;
+ import org.apache.isis.applib.annotation.MemberOrder;
+ import org.apache.isis.applib.annotation.Named;
+ import org.apache.isis.applib.annotation.Optional;
+ import org.apache.isis.applib.value.Date;
+ import org.apache.isis.applib.value.Money;
+ import org.apache.isis.viewer.wicket.applib.CalendarEvent;
+ import org.apache.isis.viewer.wicket.applib.Calendarable;
+
+ public class Claim extends AbstractDomainObject implements Calendarable {
+
+ // {{ Title
+ public String title() {
+ return getStatus() + " - " + getDate();
+ }
+ // }}
+
+ // {{ Lifecycle
+ public void created() {
+ status = "New";
+ date = new Date();
+ }
+ // }}
+
+ // {{ Rush
+ private boolean rush;
+ @MemberOrder(sequence = "1.2")
+ public boolean getRush() { ... }
+ public void setRush(final boolean flag) { ... }
+ // }}
+
+ // {{ Description
+ private String description;
+ @MemberOrder(sequence = "1")
+ public String getDescription() { ... }
+ public void setDescription(String description) { ... }
+ public String validateDescription(final String description) { ... }
+ // }}
+
+ // {{ Date
+ private Date date;
+ @MemberOrder(sequence = "2")
+ public Date getDate() { ... }
+ public void setDate(Date date) { ... }
+ public String disableDate() { ... }
+ // }}
+
+ // {{ Status
+ private String status;
+ @Disabled
+ @MemberOrder(sequence = "3")
+ @MaxLength(5)
+ public String getStatus() { ... }
+ public void setStatus(String status) { ... }
+ // }}
+
+ // {{ Claimant
+ private Claimant claimant;
+ @Disabled
+ @MemberOrder(sequence = "4")
+ public Claimant getClaimant() { ... }
+ public void setClaimant(Claimant claimant) { ... }
+ // }}
+
+ // {{ Approver
+ private Approver approver;
+ @MemberOrder(sequence = "5")
+ @Optional
+ public Approver getApprover() { ... }
+ public void setApprover(Approver approver) { ... }
+ public String disableApprover() { ... }
+ public String validateApprover(final Approver approver) {
+ if (approver == null)
+ return null;
+ return approver == getClaimant() ? "Can't approve own claims" : null;
+ }
+ // }}
+
+ // {{ Items
+ private List<ClaimItem> items = new ArrayList<ClaimItem>();
+ @MemberOrder(sequence = "6")
+ public List<ClaimItem> getItems() { ... }
+ public void addToItems(ClaimItem item) { ... }
+ // }}
+
+ // {{ action: Submit
+ public void submit(Approver approver) { ... }
+ public String disableSubmit() {
+ return getStatus().equals("New") ? null
+ : "Claim has already been submitted";
+ }
+ public Object default0Submit() {
+ return getClaimant().getApprover();
+ }
+ // }}
+
+ // {{ action: addItem
+ public void addItem(@Named("Days since") int days,
+ @Named("Amount") double amount,
+ @Named("Description") String description) {
+ ClaimItem claimItem = newTransientInstance(ClaimItem.class);
+ Date date = new Date();
+ date = date.add(0, 0, days);
+ claimItem.setDateIncurred(date);
+ claimItem.setDescription(description);
+ claimItem.setAmount(new Money(amount, "USD"));
+ persist(claimItem);
+ addToItems(claimItem);
+ }
+ public String disableAddItem() { ... }
+ return "Submitted".equals(getStatus()) ? "Already submitted" : null;
+ }
+ // }}
+
+ // object-level validation
+ public String validate() { ... }
+ }
+
+Some points worth noting:
+
+- Although Claim is inheriting from *Apache Isis*'
+ AbstractDomainObject class, this isn't mandatory.
+
+- Claim has reference properties of type Claimant and Approver. As
+ we'll see below these are interfaces. References to both interface
+ and classes is supported in *Apache Isis*.
+
+- The Claim uses a Money class, a value type provided by *Apache
+ Isis*. It's also possible to write ones own value types (or indeed
+ use third-party value types such as JodaTime).
+
+#### ClaimItem
+
+A Claim has a collection of ClaimItems. A ClaimItem is somewhat simpler
+than Claim, and doesn't have any particular behavior itself:
+
+ package org.apache.isis.examples.claims.dom.claim;
+
+ import org.apache.isis.applib.AbstractDomainObject;
+ import org.apache.isis.applib.annotation.MemberOrder;
+ import org.apache.isis.applib.value.Date;
+ import org.apache.isis.applib.value.Money;
+
+ public class ClaimItem extends AbstractDomainObject {
+
+ // {{ Title
+ public String title() {
+ return getDescription();
+ }
+ // }}
+
+ // {{ DateIncurred
+ private Date dateIncurred;
+ @MemberOrder(sequence = "1")
+ public Date getDateIncurred() { ... }
+ public void setDateIncurred(Date dateIncurred) { ... }
+ // }}
+
+ // {{ Description
+ private String description;
+ @MemberOrder(sequence = "2")
+ public String getDescription() { ... }
+ public void setDescription(String description) { ... }
+ // }}
+
+ // {{ Amount
+ private Money amount;
+ @MemberOrder(sequence = "3")
+ public Money getAmount() { ... }
+ public void setAmount(Money price) { ... }
+ // }}
+ }
+
+#### Approver and Claimant
+
+The Approver and Claimant interfaces decouple Claim from any classes
+outside the claims package. The Approver interface is, in fact, empty:
+
+ package org.apache.isis.examples.claims.dom.claim;
+
+ public interface Approver {
+
+ }
+
+There's not a lot more to Claimant:
+
+ package org.apache.isis.examples.claims.dom.claim;
+
+ public interface Claimant {
+
+ Approver getApprover();
+
+ String title();
+ }
+
+#### ClaimRepository
+
+The ClaimRepository interface is one of the two domain services (as
+appearing in the menu bar), and is defined as:
+
+ package org.apache.isis.examples.claims.dom.claim;
+
+ import java.util.List;
+
+ import org.apache.isis.applib.annotation.Named;
+ import org.apache.isis.applib.value.Date;
+
+ @Named("Claims")
+ public interface ClaimRepository {
+
+ public List<Claim> allClaims();
+
+ public List<Claim> findClaims(@Named("Description") String description);
+
+ public List<Claim> claimsFor(Claimant claimant);
+
+ public List<Claim> claimsSince(Claimant claimant, Date since);
+
+ public ClaimWizard newClaim(Claimant claimant);
+
+ public List<ClaimantExpenseSummary> analyseClaimantExpenses();
+ }
+
+### employee package
+
+The employee package depends on the claim package in that the Employee
+class implements the Claimant and Approver interfaces. Among other
+things, this allows the actions of the ClaimRepository to be
+"contributed" to the Employee class (appear in a "claims" submenu for
+each Employee).
+
+#### Employee
+
+The Employee class is the other main class in this app:
+
+ package org.apache.isis.examples.claims.dom.employee;
+
+ import org.apache.isis.applib.AbstractDomainObject;
+ import org.apache.isis.applib.annotation.Disabled;
+ import org.apache.isis.applib.annotation.MemberOrder;
+ import org.apache.isis.examples.claims.dom.claim.Approver;
+ import org.apache.isis.examples.claims.dom.claim.Claimant;
+ import org.apache.isis.viewer.wicket.applib.Locatable;
+ import org.apache.isis.viewer.wicket.applib.Location;
+
+ public class Employee extends AbstractDomainObject implements Claimant,
+ Approver, Locatable {
+
+ // {{ Title
+ public String title() {
+ return getName();
+ }
+
+ // }}
+
+ // {{ Icon
+ public String iconName() {
+ return getName().replaceAll(" ", "");
+ }
+ // }}
+
+ // {{ Name
+ private String name;
+ @MemberOrder(sequence = "1")
+ public String getName() { ... }
+ public void setName(String lastName) { ... }
+ // }}
+
+ // {{ Approver
+ private Approver approver;
+ @MemberOrder(sequence = "2")
+ public Approver getApprover() { ... }
+ public void setApprover(Approver approver) { ... }
+ // }}
+
+ // {{ Location
+ private Location location;
+ @Disabled
+ @MemberOrder(sequence = "1")
+ public Location getLocation() { ... }
+ public void setLocation(final Location location) { ... }
+ // }}
+ }
+
+A couple points worth noting:
+
+- The Employee class has an iconName() method. This is used to render
+ Employees with a customized image for each instance.
+
+- Employee also implements Locatable. This is used to render the
+ Employee in the gmap2 (google maps mashup) view (see ?).
+
+#### EmployeeRepository
+
+The EmployeeRepository interface defines the other domain service (on
+the services menu):
+
+ package org.apache.isis.examples.claims.dom.employee;
+
+ import java.util.List;
+
+ import org.apache.isis.applib.annotation.Named;
+
+ @Named("Employees")
+ public interface EmployeeRepository {
+
+ public List<Employee> allEmployees();
+ public List<Employee> findEmployees(@Named("Name") String name);
+ }
+
+Specialized Use Cases
+---------------------
+
+Domain objects to support specialized use cases (solution space objects)
+are not persisted; instead their state is serialized into the *Wicket*
+page components.
+
+### ClaimWizard
+
+The ClaimWizard uses an internal `page` field (of type Page enum) to
+determine which page the user is on; from this we determine which
+properties should be visible, and whether the `previous()`, `next()` and
+`finish()` actions are available.
+
+ package org.apache.isis.examples.claims.dom.claim;
+
+ import java.util.Calendar;
+ import java.util.List;
+
+ import org.apache.isis.applib.AbstractDomainObject;
+ import org.apache.isis.applib.annotation.Disabled;
+ import org.apache.isis.applib.annotation.Hidden;
+ import org.apache.isis.applib.annotation.Ignore;
+ import org.apache.isis.applib.annotation.MemberOrder;
+ import org.apache.isis.applib.annotation.NotPersistable;
+ import org.apache.isis.applib.annotation.TypicalLength;
+ import org.apache.isis.applib.clock.Clock;
+ import org.apache.isis.examples.claims.dom.employee.EmployeeRepository;
+ import org.apache.isis.viewer.wicket.applib.WizardPageDescription;
+
+ @NotPersistable
+ public class ClaimWizard extends AbstractDomainObject {
+
+ public enum Page {
+ INTRO("This wizard will take you through the process of creating a claim"),
+ CLAIMANT("Enter the claimant that is making this claim"),
+ APPROVER("By default, the claimant's own approver will approve this claim. " +
+ "Update here if another approver will approve this claim."),
+ DESCRIPTION("Update the description if required."),
+ SUMMARY("Confirm all details, or go back and amend if needed");
+
+ private String description;
+ private Page(String description) {
+ this.description = description;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public boolean hasPrevious() {
+ return ordinal() > 0;
+ }
+ public Page previous() {
+ if (hasPrevious()) {
+ return values()[ordinal() - 1];
+ } else {
+ return this;
+ }
+ }
+
+ public boolean hasNext() {
+ return ordinal() < values().length - 1;
+ }
+ public Page next() {
+ if (hasNext()) {
+ return values()[ordinal() + 1];
+ } else {
+ return this;
+ }
+ }
+
+ @Ignore
+ public boolean is(Page... pages) {
+ for (Page page : pages) {
+ if (page == this) {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
+ // {{ Lifecycle
+ public void created() {
+ setPage(Page.INTRO);
+ setDescription("Expenses for week #" + weekNum());
+ }
+ private int weekNum() {
+ return getTimeAsCalendar().get(Calendar.WEEK_OF_YEAR);
+ }
+ protected Calendar getTimeAsCalendar() {
+ return Clock.getTimeAsCalendar();
+ }
+ // }}
+
+ // {{ Page
+ private Page page;
+ @Hidden
+ public Page getPage() { ... }
+ public void setPage(final Page page) { ... }
+ // }}
+
+ // {{ Page Description
+ @WizardPageDescription
+ @TypicalLength(60)
+ @MemberOrder(sequence = "1")
+ public String getPageDescription() {
+ return getPage().getDescription();
+ }
+ // }}
+
+ // {{ Claimant
+ private Claimant claimant;
+
<TRUNCATED>
[39/50] [abbrv] ISIS-233: more stub test cases.
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenRefArg_whnArgIsHrefAndLinksToEntityOfWrongType_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenRefArg_whnArgIsHrefAndLinksToEntityOfWrongType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenRefArg_whnArgIsHrefAndLinksToEntityOfWrongType_ok_TODO.java
new file mode 100644
index 0000000..b8b0415
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenRefArg_whnArgIsHrefAndLinksToEntityOfWrongType_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_givenRefArg_whnArgIsHrefAndLinksToEntityOfWrongType_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/cf0bc337/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
deleted file mode 100644
index 933af1a..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenValidatableArg_whenQueryArgXroValidateOnly_andArgFails_TODO.java
+++ /dev/null
@@ -1,20 +0,0 @@
-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/cf0bc337/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
deleted file mode 100644
index f33ed5d..0000000
--- 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
+++ /dev/null
@@ -1,20 +0,0 @@
-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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenArgIsValid_and_thenQueryArg_XroValidateOnly_2xx_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenArgIsValid_and_thenQueryArg_XroValidateOnly_2xx_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenArgIsValid_and_thenQueryArg_XroValidateOnly_2xx_TODO.java
new file mode 100644
index 0000000..176d22f
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenArgIsValid_and_thenQueryArg_XroValidateOnly_2xx_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_whenArgIsValid_and_thenQueryArg_XroValidateOnly_2xx_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenInvalidArg_andQueryArg_XroValidateOnly_then_4xx_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenInvalidArg_andQueryArg_XroValidateOnly_then_4xx_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenInvalidArg_andQueryArg_XroValidateOnly_then_4xx_TODO.java
new file mode 100644
index 0000000..6abcaa9
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenInvalidArg_andQueryArg_XroValidateOnly_then_4xx_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_whenInvalidArg_andQueryArg_XroValidateOnly_then_4xx_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenResponseHeaders_ContentLength_ok_TODO.java
new file mode 100644
index 0000000..1f4d3a9
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenResponseHeaders_ContentLength_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_whenList_thenResponseHeaders_ContentLength_ok_TODO {
+
+ @Ignore
+ @Test
+ public void todo() throws Exception {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenResponseHeaders_ContentType_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenResponseHeaders_ContentType_ok_TODO.java
new file mode 100644
index 0000000..2f2153d
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenResponseHeaders_ContentType_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_whenList_thenResponseHeaders_ContentType_ok_TODO {
+
+ @Ignore
+ @Test
+ public void todo() throws Exception {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_thenResponseHeaders_ContentLength_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_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_thenResponseHeaders_ContentLength_ok_TODO.java
new file mode 100644
index 0000000..bb10774
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_thenResponseHeaders_ContentLength_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_thenResponseHeaders_ContentLength_ok_TODO {
+
+ @Ignore
+ @Test
+ public void todo() throws Exception {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_thenResponseHeaders_ContentType_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_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_thenResponseHeaders_ContentType_ok_TODO.java
new file mode 100644
index 0000000..18ead99
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_thenResponseHeaders_ContentType_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_thenResponseHeaders_ContentType_ok_TODO {
+
+ @Ignore
+ @Test
+ public void todo() throws Exception {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/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/invoke/Get_whenQueryArg_xRoFollowLinks_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenQueryArg_xRoFollowLinks_ok_TODO.java
new file mode 100644
index 0000000..4511b0b
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenQueryArg_xRoFollowLinks_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Get_whenQueryArg_xRoFollowLinks_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/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/invoke/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java
new file mode 100644
index 0000000..e9ac65f
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenRequestHeaders_Accept_isInvalid_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Get_whenRequestHeaders_Accept_isInvalid_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/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/invoke/Get_whenRequestHeaders_Accept_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenRequestHeaders_Accept_ok_TODO.java
new file mode 100644
index 0000000..e20c0b2
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenRequestHeaders_Accept_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Get_whenRequestHeaders_Accept_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenScalar_thenResponseHeaders_ContentLength_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_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenScalar_thenResponseHeaders_ContentLength_ok_TODO.java
new file mode 100644
index 0000000..04e261c
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenScalar_thenResponseHeaders_ContentLength_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_thenResponseHeaders_ContentLength_ok_TODO {
+
+ @Ignore
+ @Test
+ public void todo() throws Exception {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenScalar_thenResponseHeaders_ContentType_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_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenScalar_thenResponseHeaders_ContentType_ok_TODO.java
new file mode 100644
index 0000000..cafafa2
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenScalar_thenResponseHeaders_ContentType_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_thenResponseHeaders_ContentType_ok_TODO {
+
+ @Ignore
+ @Test
+ public void todo() throws Exception {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenVoid_thenResponseHeaders_ContentLength_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_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenVoid_thenResponseHeaders_ContentLength_ok_TODO.java
new file mode 100644
index 0000000..d63e7d7
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenVoid_thenResponseHeaders_ContentLength_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_thenResponseHeaders_ContentLength_ok_TODO {
+
+ @Ignore
+ @Test
+ public void todo() throws Exception {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenVoid_thenResponseHeaders_ContentType_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_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenVoid_thenResponseHeaders_ContentType_ok_TODO.java
new file mode 100644
index 0000000..dd394f6
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenVoid_thenResponseHeaders_ContentType_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_thenResponseHeaders_ContentType_ok_TODO {
+
+ @Ignore
+ @Test
+ public void todo() throws Exception {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Delete_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Delete_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Delete_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..c4b0a0a
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Delete_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainservice.root;
+
+public class Delete_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_thenResponseHeaders_ContentLength_ok_TODO.java
new file mode 100644
index 0000000..2f50bfa
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_thenResponseHeaders_ContentLength_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainservice.root;
+
+public class Get_thenResponseHeaders_ContentLength_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/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
deleted file mode 100644
index 27972c8..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_whenCallWithWrongHttpMethod_bad_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.domainservice.root;
-
-public class Get_whenCallWithWrongHttpMethod_bad_TODO {
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_whenQueryArg_xRoDomainModel_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_whenQueryArg_xRoDomainModel_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_whenQueryArg_xRoDomainModel_ok_TODO.java
new file mode 100644
index 0000000..181e95f
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Get_whenQueryArg_xRoDomainModel_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainservice.root;
+
+public class Get_whenQueryArg_xRoDomainModel_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Post_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Post_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Post_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..d885a1b
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Post_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainservice.root;
+
+public class Post_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Put_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Put_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Put_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..58dc69e
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Put_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainservice.root;
+
+public class Put_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/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
deleted file mode 100644
index 22e464e..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_ResponseHeaders_CacheControl_ok.java
+++ /dev/null
@@ -1,63 +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.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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_givenHiddenMembers_thenRepresentation_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_givenHiddenMembers_thenRepresentation_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_givenHiddenMembers_thenRepresentation_ok_TODO.java
new file mode 100644
index 0000000..66324df
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_givenHiddenMembers_thenRepresentation_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainservice.serviceId;
+
+public class Get_givenHiddenMembers_thenRepresentation_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_thenResponseHeaders_CacheControl_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_thenResponseHeaders_CacheControl_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_thenResponseHeaders_CacheControl_ok.java
new file mode 100644
index 0000000..41e868c
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_thenResponseHeaders_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_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.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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_thenResponseHeaders_ContentLength_ok_TODO.java
new file mode 100644
index 0000000..d270c52
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_thenResponseHeaders_ContentLength_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainservice.serviceId;
+
+public class Get_thenResponseHeaders_ContentLength_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/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
deleted file mode 100644
index bfc6fc7..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_thenResponseHeaders_Etag_ok.java
+++ /dev/null
@@ -1,65 +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.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/cf0bc337/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..5b44c0c
--- /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/cf0bc337/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
deleted file mode 100644
index 7b8d2bb..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenCallWithWrongHttpMethod_bad_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenDoesntExistId_thenResponseCode_404.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenDoesntExistId_thenResponseCode_404.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenDoesntExistId_thenResponseCode_404.java
new file mode 100644
index 0000000..c93f28a
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenDoesntExistId_thenResponseCode_404.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_whenDoesntExistId_thenResponseCode_404 {
+
+ @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/cf0bc337/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
deleted file mode 100644
index 620fcf3..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenNotFound_bad.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 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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenQueryArg_xRoFollowLinks_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenQueryArg_xRoFollowLinks_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenQueryArg_xRoFollowLinks_ok.java
new file mode 100644
index 0000000..a22dfc2
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenQueryArg_xRoFollowLinks_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_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/cf0bc337/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
deleted file mode 100644
index cbea601..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Get_whenQueryArg_xRoFollowLinks_thenRepresentation_ok.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 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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_thenResponseCode_200_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_thenResponseCode_200_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_thenResponseCode_200_TODO.java
new file mode 100644
index 0000000..7faae78
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_thenResponseCode_200_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.homepage.root;
+
+public class Get_thenResponseCode_200_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_thenResponseHeaders_ContentLength_ok_TODO.java
new file mode 100644
index 0000000..80fa947
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_thenResponseHeaders_ContentLength_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.homepage.root;
+
+public class Get_thenResponseHeaders_ContentLength_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_whenQueryArg_xRoDomainModel_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_whenQueryArg_xRoDomainModel_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_whenQueryArg_xRoDomainModel_ok_TODO.java
new file mode 100644
index 0000000..83265f4
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_whenQueryArg_xRoDomainModel_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.homepage.root;
+
+public class Get_whenQueryArg_xRoDomainModel_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_whenQueryArg_xRoFollowLinks_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_whenQueryArg_xRoFollowLinks_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_whenQueryArg_xRoFollowLinks_ok.java
new file mode 100644
index 0000000..bb5d46b
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_whenQueryArg_xRoFollowLinks_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_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/cf0bc337/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
deleted file mode 100644
index 92b1593..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_whenQueryArg_xRoFollowLinks_thenRepresentation_ok.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 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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_whenRequestHeaders_Accept_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_whenRequestHeaders_Accept_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_whenRequestHeaders_Accept_ok_TODO.java
new file mode 100644
index 0000000..308c426
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/Get_whenRequestHeaders_Accept_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.homepage.root;
+
+public class Get_whenRequestHeaders_Accept_ok_TODO {
+
+}
[02/50] [abbrv] ISIS-233: more on user, version, services list
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_get_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_get_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_get_accept.java
deleted file mode 100644
index 25347ee..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_get_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.resources.version;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jboss.resteasy.client.ClientRequest;
-import org.jboss.resteasy.client.ClientResponse;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.webserver.WebServer;
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.user.UserRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.version.VersionRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-
-public class VersionResourceTest_get_accept {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
- }
-
- @Test
- public void applicationJson_noProfile_returns200() throws Exception {
-
- final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, "version").withHeader(RestfulRequest.Header.ACCEPT, MediaType.APPLICATION_JSON_TYPE);
- final RestfulResponse<VersionRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- assertThat(restfulResponse.getHeader(RestfulResponse.Header.CONTENT_TYPE), is(RepresentationType.VERSION.getMediaType()));
- }
-
-
- @Test
- public void applicationJson_profileVersion_returns200() throws Exception {
-
- final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, "version").withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.VERSION.getMediaType());
- final RestfulResponse<VersionRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- }
-
- @Test
- public void missingHeader_returns200() throws Exception {
- // given
- final RestfulRequest restfulReq = client.createRequest(RestfulHttpMethod.GET, "version");
-
- // when
- final RestfulResponse<VersionRepresentation> restfulResp = restfulReq.executeT();
-
- // then
- assertThat(restfulResp.getStatus(), is(HttpStatusCode.OK));
- }
-
- @Test
- public void applicationJson_profileIncorrect_returns406() throws Exception {
-
- final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, "version").withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.USER.getMediaType());
- final RestfulResponse<VersionRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
- }
-
- @Test
- public void incorrectMediaType_returnsNotAcceptable() throws Exception {
-
- // given
- final ClientRequest clientRequest = client.getClientRequestFactory().createRelativeRequest("version");
- clientRequest.accept(MediaType.APPLICATION_ATOM_XML_TYPE);
-
- // when
- final ClientResponse<?> resp = clientRequest.get();
- final RestfulResponse<JsonRepresentation> restfulResp = RestfulResponse.of(resp);
-
- // then
- assertThat(restfulResp.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_representation.java
new file mode 100644
index 0000000..01eff58
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_representation.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.resources.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.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 VersionResourceTest_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/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_responseHeaders.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_responseHeaders.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_responseHeaders.java
new file mode 100644
index 0000000..1e29d59
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_responseHeaders.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.resources.version;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.CacheControl;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.Header;
+import org.apache.isis.viewer.restfulobjects.applib.version.VersionRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.version.VersionResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class VersionResourceTest_responseHeaders {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+ private VersionResource resource;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+
+ resource = client.getVersionResource();
+ }
+
+
+ @Test
+ public void 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/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_templated_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_templated_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_templated_representation.java
deleted file mode 100644
index cd91d7a..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_templated_representation.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.resources.version;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isFollowableLinkToSelf;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
-import static org.hamcrest.CoreMatchers.endsWith;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.CacheControl;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status.Family;
-
-import org.apache.isis.core.webserver.WebServer;
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.Rel;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.Header;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.version.VersionRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.version.VersionResource;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class VersionResourceTest_templated_representation {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
- private VersionResource resource;
-
- @Before
- public void setUp() throws Exception {
- final WebServer webServer = webServerRule.getWebServer();
- client = new RestfulClient(webServer.getBase());
-
- resource = client.getVersionResource();
- }
-
- @Test
- public void representation() throws Exception {
-
- // given
- final Response servicesResp = resource.version();
-
- // when
- final RestfulResponse<VersionRepresentation> restfulResponse = RestfulResponse.ofT(servicesResp);
- assertThat(restfulResponse.getStatus().getFamily(), is(Family.SUCCESSFUL));
-
- // then
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
-
- final VersionRepresentation repr = restfulResponse.getEntity();
- assertThat(repr, is(not(nullValue())));
- assertThat(repr, isMap());
-
- assertThat(repr.getSelf(), isLink(client)
- .rel(Rel.SELF)
- .href(endsWith(":39393/version"))
- .httpMethod(RestfulHttpMethod.GET)
- .type(RepresentationType.VERSION.getMediaType())
- .returning(HttpStatusCode.OK)
- );
- assertThat(repr.getUp(), isLink(client)
- .rel(Rel.UP)
- .href(endsWith(":39393/"))
- .httpMethod(RestfulHttpMethod.GET)
- .type(RepresentationType.HOME_PAGE.getMediaType())
- .returning(HttpStatusCode.OK)
- );
-
- assertThat(repr.getString("specVersion"), is("1.0.0"));
- assertThat(repr.getString("implVersion"), is(not(nullValue())));
- //assertThat(repr.getString("implVersion"), is(not("UNKNOWN")));
-
- final JsonRepresentation optionalCapbilitiesRepr = repr.getOptionalCapabilities();
- assertThat(optionalCapbilitiesRepr, isMap());
-
- assertThat(optionalCapbilitiesRepr.getString("blobsClobs"), is("yes"));
- assertThat(optionalCapbilitiesRepr.getString("deleteObjects"), is("yes"));
- assertThat(optionalCapbilitiesRepr.getString("domainModel"), is("formal"));
- assertThat(optionalCapbilitiesRepr.getString("validateOnly"), is("yes"));
- assertThat(optionalCapbilitiesRepr.getString("protoPersistentObjects"), is("yes"));
-
- assertThat(repr.getLinks(), isArray());
- assertThat(repr.getExtensions(), is(not(nullValue())));
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_templated_responseHeaders.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_templated_responseHeaders.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_templated_responseHeaders.java
deleted file mode 100644
index e39644e..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_templated_responseHeaders.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.resources.version;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.CacheControl;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.apache.isis.core.webserver.WebServer;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.Header;
-import org.apache.isis.viewer.restfulobjects.applib.version.VersionRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.version.VersionResource;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class VersionResourceTest_templated_responseHeaders {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
- private VersionResource resource;
-
- @Before
- public void setUp() throws Exception {
- final WebServer webServer = webServerRule.getWebServer();
- client = new RestfulClient(webServer.getBase());
-
- resource = client.getVersionResource();
- }
-
-
- @Test
- public void headers() throws Exception {
- // given
- final Response resp = resource.version();
-
- // when
- final RestfulResponse<VersionRepresentation> restfulResponse = RestfulResponse.ofT(resp);
-
- // then
- final MediaType contentType = restfulResponse.getHeader(Header.CONTENT_TYPE);
- assertThat(contentType, hasType("application"));
- assertThat(contentType, hasSubType("json"));
- assertThat(contentType, hasParameter("profile", "urn:org.restfulobjects:repr-types/version"));
- assertThat(contentType, is(RepresentationType.VERSION.getMediaType()));
-
- // then
- final CacheControl cacheControl = restfulResponse.getHeader(Header.CACHE_CONTROL);
- assertThat(cacheControl, hasMaxAge(24 * 60 * 60));
- assertThat(cacheControl.getMaxAge(), is(24 * 60 * 60));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_xrofollowlinks.java
new file mode 100644
index 0000000..47f0b2c
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_xrofollowlinks.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.resources.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 VersionResourceTest_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())));
+ }
+
+}
[05/50] [abbrv] ISIS-233-ro: testing domainservices_services resource
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_response_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_response_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_response_representation.java
new file mode 100644
index 0000000..4dfa56e
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_response_representation.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.RepresentationMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.hamcrest.CoreMatchers.endsWith;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status.Family;
+
+import org.apache.isis.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 VersionResourceTest_root_response_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/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainobject/DomainObjectResourceTest_instanceid_get_response_header_cacheControl.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainobject/DomainObjectResourceTest_instanceid_get_response_header_cacheControl.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainobject/DomainObjectResourceTest_instanceid_get_response_header_cacheControl.java
new file mode 100644
index 0000000..8e59c83
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainobject/DomainObjectResourceTest_instanceid_get_response_header_cacheControl.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.zzztodo.domainobject;
+
+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 DomainObjectResourceTest_instanceid_get_response_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/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainobject/DomainObjectResourceTest_instanceid_get_response_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainobject/DomainObjectResourceTest_instanceid_get_response_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainobject/DomainObjectResourceTest_instanceid_get_response_representation.java
new file mode 100644
index 0000000..627a009
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainobject/DomainObjectResourceTest_instanceid_get_response_representation.java
@@ -0,0 +1,401 @@
+/*
+ * 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;
+
+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.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 DomainObjectResourceTest_instanceid_get_response_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());
+ }
+
+ @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())));
+ }
+
+ @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()));
+ }
+
+ @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()));
+ }
+
+ @Test
+ public void domainObjectRepresentation_hasTitle() throws Exception {
+
+ // given, when
+ final DomainObjectRepresentation domainObjectRepr = givenDomainObjectRepresentationFor("OID","32");
+
+ // then
+ assertThat(domainObjectRepr.getTitle(), is("parent 4 - child 2"));
+ }
+
+ @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"));
+ }
+
+ @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));
+
+ }
+
+ @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/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction.java
new file mode 100644
index 0000000..dceab09
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction.java
@@ -0,0 +1,265 @@
+/*
+ * 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;
+
+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 DomainServiceResourceTest_serviceId_invokeAction {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ @SuppressWarnings("unused")
+ private DomainServiceResource resource;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+
+ resource = client.getDomainServiceResource();
+ }
+
+ @Ignore("TODO - fix broken test resulting from introduction of actionresult repr")
+ @Test
+ public void invokeQueryOnly_noArg_usingClientFollow() throws Exception {
+
+ // given
+ final JsonRepresentation givenAction = givenAction("simples", "list");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ // when
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+
+ // then
+ assertThat(invokeLink, is(not(nullValue())));
+ final RestfulResponse<ListRepresentation> restfulResponse = client.followT(invokeLink);
+ final ListRepresentation listRepr = restfulResponse.getEntity();
+
+ assertThat(listRepr.getValue().size(), is(5));
+ }
+
+ @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/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsList.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsList.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsList.java
new file mode 100644
index 0000000..43f26b2
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsList.java
@@ -0,0 +1,13 @@
+package org.apache.isis.viewer.restfulobjects.tck.zzztodo.domainservice;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class DomainServiceResourceTest_serviceId_invokeAction_returnsList {
+
+ @Ignore
+ @Test
+ public void todo() throws Exception {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsObject.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsObject.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsObject.java
new file mode 100644
index 0000000..7577d0d
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsObject.java
@@ -0,0 +1,13 @@
+package org.apache.isis.viewer.restfulobjects.tck.zzztodo.domainservice;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class DomainServiceResourceTest_serviceId_invokeAction_returnsObject {
+
+ @Ignore
+ @Test
+ public void todo() throws Exception {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsScalar.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsScalar.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsScalar.java
new file mode 100644
index 0000000..988ec19
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsScalar.java
@@ -0,0 +1,13 @@
+package org.apache.isis.viewer.restfulobjects.tck.zzztodo.domainservice;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class DomainServiceResourceTest_serviceId_invokeAction_returnsScalar {
+
+ @Ignore
+ @Test
+ public void todo() throws Exception {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsVoid.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsVoid.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsVoid.java
new file mode 100644
index 0000000..8f4f9db
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsVoid.java
@@ -0,0 +1,13 @@
+package org.apache.isis.viewer.restfulobjects.tck.zzztodo.domainservice;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class DomainServiceResourceTest_serviceId_invokeAction_returnsVoid {
+
+ @Ignore
+ @Test
+ public void todo() throws Exception {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_throwsError.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_throwsError.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_throwsError.java
new file mode 100644
index 0000000..72688ec
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_throwsError.java
@@ -0,0 +1,13 @@
+package org.apache.isis.viewer.restfulobjects.tck.zzztodo.domainservice;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class DomainServiceResourceTest_serviceId_invokeAction_throwsError {
+
+ @Ignore
+ @Test
+ public void todo() throws Exception {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/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
new file mode 100644
index 0000000..7ceecd3
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/objectsoftype/ObjectsOfTypeResourceTest_domainTypeId_post.java
@@ -0,0 +1,13 @@
+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/1b9a2a74/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
new file mode 100644
index 0000000..5d9892c
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/stories/UserStoryTest.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.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]+$"));
+ }
+
+}
[12/50] [abbrv] ISIS-233-ro: more on domainservice.serviceId
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/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
new file mode 100644
index 0000000..60e5347
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionTest_req_queryargs_xrofollowlinks.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 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())));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/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
new file mode 100644
index 0000000..d49fa79
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionTest_resp_headers.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.version;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.CacheControl;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.Header;
+import org.apache.isis.viewer.restfulobjects.applib.version.VersionRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.version.VersionResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class 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/5e01f688/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
new file mode 100644
index 0000000..54bf7fe
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionTest_resp_representation.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.RepresentationMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.hamcrest.CoreMatchers.endsWith;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status.Family;
+
+import org.apache.isis.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/5e01f688/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
new file mode 100644
index 0000000..6588346
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/any/security/AnyResourceTest_notAuthorized.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.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/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainobject/DomainObjectResourceTest_instanceid_get_response_header_cacheControl.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainobject/DomainObjectResourceTest_instanceid_get_response_header_cacheControl.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainobject/DomainObjectResourceTest_instanceid_get_response_header_cacheControl.java
deleted file mode 100644
index 8e59c83..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainobject/DomainObjectResourceTest_instanceid_get_response_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;
-
-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 DomainObjectResourceTest_instanceid_get_response_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/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainobject/DomainObjectResourceTest_instanceid_get_response_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainobject/DomainObjectResourceTest_instanceid_get_response_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainobject/DomainObjectResourceTest_instanceid_get_response_representation.java
deleted file mode 100644
index 627a009..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainobject/DomainObjectResourceTest_instanceid_get_response_representation.java
+++ /dev/null
@@ -1,401 +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;
-
-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.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 DomainObjectResourceTest_instanceid_get_response_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());
- }
-
- @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())));
- }
-
- @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()));
- }
-
- @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()));
- }
-
- @Test
- public void domainObjectRepresentation_hasTitle() throws Exception {
-
- // given, when
- final DomainObjectRepresentation domainObjectRepr = givenDomainObjectRepresentationFor("OID","32");
-
- // then
- assertThat(domainObjectRepr.getTitle(), is("parent 4 - child 2"));
- }
-
- @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"));
- }
-
- @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));
-
- }
-
- @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/5e01f688/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
new file mode 100644
index 0000000..b5a879b
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainobject/instanceid/DomainObjectTest_get_resp_header_cacheControl.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.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/5e01f688/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
new file mode 100644
index 0000000..16a71ba
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainobject/instanceid/DomainObjectTest_get_resp_representation.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.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.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/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction.java
deleted file mode 100644
index dceab09..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction.java
+++ /dev/null
@@ -1,265 +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;
-
-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 DomainServiceResourceTest_serviceId_invokeAction {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- @SuppressWarnings("unused")
- private DomainServiceResource resource;
-
- @Before
- public void setUp() throws Exception {
- final WebServer webServer = webServerRule.getWebServer();
- client = new RestfulClient(webServer.getBase());
-
- resource = client.getDomainServiceResource();
- }
-
- @Ignore("TODO - fix broken test resulting from introduction of actionresult repr")
- @Test
- public void invokeQueryOnly_noArg_usingClientFollow() throws Exception {
-
- // given
- final JsonRepresentation givenAction = givenAction("simples", "list");
- final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
-
- // when
- final LinkRepresentation invokeLink = actionRepr.getInvoke();
-
- // then
- assertThat(invokeLink, is(not(nullValue())));
- final RestfulResponse<ListRepresentation> restfulResponse = client.followT(invokeLink);
- final ListRepresentation listRepr = restfulResponse.getEntity();
-
- assertThat(listRepr.getValue().size(), is(5));
- }
-
- @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/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsList.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsList.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsList.java
deleted file mode 100644
index 43f26b2..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsList.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.zzztodo.domainservice;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class DomainServiceResourceTest_serviceId_invokeAction_returnsList {
-
- @Ignore
- @Test
- public void todo() throws Exception {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsObject.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsObject.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsObject.java
deleted file mode 100644
index 7577d0d..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsObject.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.zzztodo.domainservice;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class DomainServiceResourceTest_serviceId_invokeAction_returnsObject {
-
- @Ignore
- @Test
- public void todo() throws Exception {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsScalar.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsScalar.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsScalar.java
deleted file mode 100644
index 988ec19..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsScalar.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.zzztodo.domainservice;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class DomainServiceResourceTest_serviceId_invokeAction_returnsScalar {
-
- @Ignore
- @Test
- public void todo() throws Exception {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsVoid.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsVoid.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsVoid.java
deleted file mode 100644
index 8f4f9db..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_returnsVoid.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.zzztodo.domainservice;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class DomainServiceResourceTest_serviceId_invokeAction_returnsVoid {
-
- @Ignore
- @Test
- public void todo() throws Exception {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_throwsError.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_throwsError.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_throwsError.java
deleted file mode 100644
index 72688ec..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/DomainServiceResourceTest_serviceId_invokeAction_throwsError.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.zzztodo.domainservice;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class DomainServiceResourceTest_serviceId_invokeAction_throwsError {
-
- @Ignore
- @Test
- public void todo() throws Exception {
-
- }
-}
[23/50] [abbrv] git commit: ISIS-233: argument format and validation
Posted by da...@apache.org.
ISIS-233: argument format and validation
* the argument processing was missing the 'value' node
* now rendering the body with 'invalidReason' if validation error occurs.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/f9803296
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/f9803296
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/f9803296
Branch: refs/heads/master
Commit: f9803296b6db290f3ab27ac9245ed36100227d7d
Parents: 646a07c
Author: Dan Haywood <da...@apache.org>
Authored: Tue Mar 12 23:30:42 2013 +0000
Committer: Dan Haywood <da...@apache.org>
Committed: Sat Apr 27 19:01:16 2013 +0100
----------------------------------------------------------------------
.../applib/client/RestfulResponse.java | 5 +
.../rendering/domainobjects/JsonValueEncoder.java | 126 ++++++++-------
.../domainobjects/ObjectActionReprRenderer.java | 2 +-
.../restfulobjects/server/ResourceContext.java | 2 +-
.../server/RestfulObjectsApplicationException.java | 28 ++--
.../RestfulObjectsApplicationExceptionMapper.java | 28 +++-
.../resources/DomainObjectResourceServerside.java | 32 ++--
.../server/resources/DomainResourceHelper.java | 79 ++++++----
.../resources/DomainTypeResourceServerside.java | 2 +-
.../server/resources/ResourceAbstract.java | 4 +-
...stfulObjectsApplicationExceptionMapperTest.java | 4 +-
.../DomainServiceTest_req_safe_refarg_bad.java | 32 ++---
...ainServiceTest_req_safe_refarg_resp_scalar.java | 33 ++---
...inServiceTest_req_safe_simplearg_resp_list.java | 8 +-
14 files changed, 208 insertions(+), 177 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/f9803296/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java
index 6357be1..758179c 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java
@@ -269,6 +269,10 @@ public class RestfulResponse<T> {
return parser.valueOf(value);
}
+ public String render(X message) {
+ return parser.asString(message);
+ }
+
private static Parser<String> warningParser() {
return new Parser<String>(){
private static final String PREFIX = "199 RestfulObjects ";
@@ -287,6 +291,7 @@ public class RestfulResponse<T> {
}
};
}
+
}
private final Response response;
http://git-wip-us.apache.org/repos/asf/isis/blob/f9803296/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/JsonValueEncoder.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/JsonValueEncoder.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/JsonValueEncoder.java
index 957aa67..6628dfc 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/JsonValueEncoder.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/JsonValueEncoder.java
@@ -36,134 +36,146 @@ public final class JsonValueEncoder {
private static final long serialVersionUID = 1L;
}
- public ObjectAdapter asAdapter(final ObjectSpecification objectSpec, final JsonRepresentation representation) {
+ public ObjectAdapter asAdapter(final ObjectSpecification objectSpec, final JsonRepresentation argRepr) {
if (objectSpec == null) {
- throw new IllegalArgumentException("objectSpec cannot be null");
+ String reason = "ObjectSpec is null, cannot validate";
+ argRepr.mapPut("invalidReason", reason);
+ throw new IllegalArgumentException(reason);
}
final EncodableFacet encodableFacet = objectSpec.getFacet(EncodableFacet.class);
if (encodableFacet == null) {
- throw new IllegalArgumentException("objectSpec expected to have EncodableFacet");
+ String reason = "ObjectSpec expected to have an EncodableFacet";
+ argRepr.mapPut("invalidReason", reason);
+ throw new IllegalArgumentException(reason);
}
- if (representation == null) {
- throw new IllegalArgumentException("representation cannot be null");
+ final JsonRepresentation argValueRepr = argRepr.getRepresentation("value");
+ if(argValueRepr == null) {
+ String reason = "No 'value' key";
+ argRepr.mapPut("invalidReason", reason);
+ throw new IllegalArgumentException(reason);
}
- if (!representation.isValue()) {
- throw new IllegalArgumentException("representation must be of a value");
+ if (!argValueRepr.isValue()) {
+ String reason = "Representation must be of a value";
+ argRepr.mapPut("invalidReason", reason);
+ throw new IllegalArgumentException(reason);
}
// special case handling for JSON built-ins
if (isBoolean(objectSpec)) {
- if (!representation.isBoolean()) {
- throwIncompatibleException(objectSpec, representation);
+ if (!argValueRepr.isBoolean()) {
+ throwIncompatibleException(objectSpec, argRepr);
}
- final String argStr = "" + representation.asBoolean();
+ final String argStr = "" + argValueRepr.asBoolean();
return encodableFacet.fromEncodedString(argStr);
}
if (isInteger(objectSpec)) {
- if (representation.isInt()) {
- final String argStr = "" + representation.asInt();
+ if (argValueRepr.isInt()) {
+ final String argStr = "" + argValueRepr.asInt();
return encodableFacet.fromEncodedString(argStr);
}
// best effort
- if (representation.isString()) {
- final String argStr = representation.asString();
+ if (argValueRepr.isString()) {
+ final String argStr = argValueRepr.asString();
return encodableFacet.fromEncodedString(argStr);
}
// give up
- throwIncompatibleException(objectSpec, representation);
+ throwIncompatibleException(objectSpec, argRepr);
}
if (isLong(objectSpec)) {
- if (!representation.isLong()) {
- throwIncompatibleException(objectSpec, representation);
+ if (!argValueRepr.isLong()) {
+ throwIncompatibleException(objectSpec, argRepr);
}
- final String argStr = "" + representation.asLong();
+ final String argStr = "" + argValueRepr.asLong();
return encodableFacet.fromEncodedString(argStr);
}
if (isBigInteger(objectSpec)) {
- if (representation.isBigInteger()) {
- final String argStr = "" + representation.asBigInteger();
+ if (argValueRepr.isBigInteger()) {
+ final String argStr = "" + argValueRepr.asBigInteger();
return encodableFacet.fromEncodedString(argStr);
}
// best effort
- if (representation.isLong()) {
- final String argStr = "" + representation.asLong();
+ if (argValueRepr.isLong()) {
+ final String argStr = "" + argValueRepr.asLong();
return encodableFacet.fromEncodedString(argStr);
}
- if (representation.isInt()) {
- final String argStr = "" + representation.asInt();
+ if (argValueRepr.isInt()) {
+ final String argStr = "" + argValueRepr.asInt();
return encodableFacet.fromEncodedString(argStr);
}
- if (representation.isString()) {
- final String argStr = representation.asString();
+ if (argValueRepr.isString()) {
+ final String argStr = argValueRepr.asString();
return encodableFacet.fromEncodedString(argStr);
}
// give up
- throwIncompatibleException(objectSpec, representation);
+ throwIncompatibleException(objectSpec, argRepr);
}
if (isBigDecimal(objectSpec)) {
- if (representation.isBigDecimal()) {
- final String argStr = "" + representation.asBigDecimal();
+ if (argValueRepr.isBigDecimal()) {
+ final String argStr = "" + argValueRepr.asBigDecimal();
return encodableFacet.fromEncodedString(argStr);
}
// best effort
- if (representation.isBigInteger()) {
- final String argStr = "" + representation.asBigInteger();
+ if (argValueRepr.isBigInteger()) {
+ final String argStr = "" + argValueRepr.asBigInteger();
return encodableFacet.fromEncodedString(argStr);
}
- if (representation.isDouble()) {
- final String argStr = "" + representation.asDouble();
+ if (argValueRepr.isDouble()) {
+ final String argStr = "" + argValueRepr.asDouble();
return encodableFacet.fromEncodedString(argStr);
}
- if (representation.isLong()) {
- final String argStr = "" + representation.asLong();
+ if (argValueRepr.isLong()) {
+ final String argStr = "" + argValueRepr.asLong();
return encodableFacet.fromEncodedString(argStr);
}
- if (representation.isInt()) {
- final String argStr = "" + representation.asInt();
+ if (argValueRepr.isInt()) {
+ final String argStr = "" + argValueRepr.asInt();
return encodableFacet.fromEncodedString(argStr);
}
- if (representation.isString()) {
- final String argStr = representation.asString();
+ if (argValueRepr.isString()) {
+ final String argStr = argValueRepr.asString();
return encodableFacet.fromEncodedString(argStr);
}
// give up
- throwIncompatibleException(objectSpec, representation);
+ throwIncompatibleException(objectSpec, argRepr);
}
if (isDouble(objectSpec)) {
- if (representation.isDouble()) {
- final String argStr = "" + representation.asDouble();
+ if (argValueRepr.isDouble()) {
+ final String argStr = "" + argValueRepr.asDouble();
return encodableFacet.fromEncodedString(argStr);
}
// best effort
- if (representation.isLong()) {
- final String argStr = "" + representation.asLong();
+ if (argValueRepr.isLong()) {
+ final String argStr = "" + argValueRepr.asLong();
return encodableFacet.fromEncodedString(argStr);
}
- if (representation.isInt()) {
- final String argStr = "" + representation.asInt();
+ if (argValueRepr.isInt()) {
+ final String argStr = "" + argValueRepr.asInt();
return encodableFacet.fromEncodedString(argStr);
}
- if (representation.isString()) {
- final String argStr = representation.asString();
+ if (argValueRepr.isString()) {
+ final String argStr = argValueRepr.asString();
return encodableFacet.fromEncodedString(argStr);
}
// give up
- throwIncompatibleException(objectSpec, representation);
+ throwIncompatibleException(objectSpec, argRepr);
}
- if (!representation.isString()) {
- throw new ExpectedStringRepresentingValueException();
+ if (argValueRepr.isString()) {
+ final String argStr = argValueRepr.asString();
+ return encodableFacet.fromEncodedString(argStr);
}
- final String argStr = representation.asString();
- return encodableFacet.fromEncodedString(argStr);
+
+ final String reason = "Unable to parse value";
+ argRepr.mapPut("invalidReason", reason);
+ throw new IllegalArgumentException(reason);
}
- public Object asObject(final ObjectAdapter objectAdapter) {
+ Object asObject(final ObjectAdapter objectAdapter) {
if (objectAdapter == null) {
throw new IllegalArgumentException("objectAdapter cannot be null");
}
@@ -217,8 +229,10 @@ public final class JsonValueEncoder {
return false;
}
- private void throwIncompatibleException(final ObjectSpecification objectSpec, final JsonRepresentation representation) {
- throw new IllegalArgumentException(String.format("representation '%s' incompatible with objectSpec '%s'", representation.toString(), objectSpec.getCorrespondingClass().getName()));
+ private void throwIncompatibleException(final ObjectSpecification objectSpec, final JsonRepresentation argRepr) {
+ String reason = String.format("representation '%s' incompatible with objectSpec '%s'", argRepr.getMap("value").toString(), objectSpec.getCorrespondingClass().getName());
+ argRepr.mapPut("invalidReason", reason);
+ throw new IllegalArgumentException(reason);
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/f9803296/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectActionReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectActionReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectActionReprRenderer.java
index 3c147de..f288156 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectActionReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectActionReprRenderer.java
@@ -113,7 +113,7 @@ public class ObjectActionReprRenderer extends AbstractObjectMemberReprRenderer<O
final JsonRepresentation argMap = JsonRepresentation.newMap();
final List<ObjectActionParameter> parameters = objectMember.getParameters();
for (int i = 0; i < objectMember.getParameterCount(); i++) {
- argMap.mapPut(parameters.get(i).getId(), argValueFor(i));
+ argMap.mapPut(parameters.get(i).getId() + ".value", argValueFor(i));
}
return argMap;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/f9803296/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/ResourceContext.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/ResourceContext.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/ResourceContext.java
index d7a4f58..27ec6c4 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/ResourceContext.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/ResourceContext.java
@@ -123,7 +123,7 @@ public class ResourceContext implements RendererContext {
private void ensureDomainModelQueryParamSupported() {
final DomainModel domainModel = getArg(RequestParameter.DOMAIN_MODEL);
if(domainModel != DomainModel.FORMAL) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.BAD_REQUEST,
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.BAD_REQUEST,
"x-ro-domain-model of '%s' is not supported", domainModel);
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/f9803296/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationException.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationException.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationException.java
index a9d1d83..01948f7 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationException.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationException.java
@@ -24,23 +24,23 @@ import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpS
public class RestfulObjectsApplicationException extends RuntimeException implements HasHttpStatusCode {
public static final RestfulObjectsApplicationException create(final HttpStatusCode httpStatusCode) {
- return create(httpStatusCode, null);
+ return createWithCause(httpStatusCode, null);
}
- public static RestfulObjectsApplicationException create(final HttpStatusCode httpStatusCode, final String message, final Object... args) {
- return create(httpStatusCode, (Exception) null, message, args);
+ public static RestfulObjectsApplicationException createWithMessage(final HttpStatusCode httpStatusCode, final String message, final Object... args) {
+ return createWithCauseAndMessage(httpStatusCode, (Exception) null, message, args);
}
- public static RestfulObjectsApplicationException create(final HttpStatusCode httpStatusCode, final Exception cause) {
- return create(httpStatusCode, cause, null);
+ public static RestfulObjectsApplicationException createWithCause(final HttpStatusCode httpStatusCode, final Exception cause) {
+ return createWithCauseAndMessage(httpStatusCode, cause, null);
}
- public static RestfulObjectsApplicationException create(final HttpStatusCode httpStatusCode, final Exception cause, final String message, final Object... args) {
+ public static RestfulObjectsApplicationException createWithCauseAndMessage(final HttpStatusCode httpStatusCode, final Exception cause, final String message, final Object... args) {
return new RestfulObjectsApplicationException(httpStatusCode, formatString(message, args), cause, null);
}
- public static RestfulObjectsApplicationException create(final HttpStatusCode httpStatusCode, final JsonRepresentation repr, final String message, final Object... args) {
- return new RestfulObjectsApplicationException(httpStatusCode, formatString(message, args), null, repr);
+ public static RestfulObjectsApplicationException createWithBody(final HttpStatusCode httpStatusCode, final JsonRepresentation body, final String message, final Object... args) {
+ return new RestfulObjectsApplicationException(httpStatusCode, formatString(message, args), null, body);
}
private static String formatString(final String formatStr, final Object... args) {
@@ -49,12 +49,12 @@ public class RestfulObjectsApplicationException extends RuntimeException impleme
private static final long serialVersionUID = 1L;
private final HttpStatusCode httpStatusCode;
- private final JsonRepresentation jsonRepresentation;
+ private final JsonRepresentation body;
- private RestfulObjectsApplicationException(final HttpStatusCode httpStatusCode, final String message, final Throwable ex, final JsonRepresentation jsonRepresentation) {
- super(message, ex);
+ private RestfulObjectsApplicationException(final HttpStatusCode httpStatusCode, final String message, final Throwable cause, final JsonRepresentation body) {
+ super(message, cause);
this.httpStatusCode = httpStatusCode;
- this.jsonRepresentation = jsonRepresentation;
+ this.body = body;
}
@Override
@@ -62,8 +62,8 @@ public class RestfulObjectsApplicationException extends RuntimeException impleme
return httpStatusCode;
}
- public JsonRepresentation getJsonRepresentation() {
- return jsonRepresentation;
+ public JsonRepresentation getBody() {
+ return body;
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/f9803296/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapper.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapper.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapper.java
index 72a9f1b..524c43f 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapper.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapper.java
@@ -21,6 +21,7 @@ package org.apache.isis.viewer.restfulobjects.server;
import java.util.List;
import javax.ws.rs.Path;
+import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder;
import javax.ws.rs.ext.ExceptionMapper;
@@ -38,21 +39,26 @@ import com.google.common.collect.Lists;
@Provider
public class RestfulObjectsApplicationExceptionMapper implements ExceptionMapper<RestfulObjectsApplicationException> {
- private static final String WARNING_HEADER_PREFIX = "199 RestfulObjects ";
-
@Override
public Response toResponse(final RestfulObjectsApplicationException ex) {
- final ResponseBuilder builder = Response.status(ex.getHttpStatusCode().getJaxrsStatusType()).type(RestfulMediaType.APPLICATION_JSON_ERROR).entity(jsonFor(ex));
+ final ResponseBuilder builder = Response.status(ex.getHttpStatusCode().getJaxrsStatusType());
+ final String body = bodyFor(ex);
+ if(body != null) {
+ builder.entity(body);
+ builder.type(MediaType.APPLICATION_JSON); // generic; the spec doesn't define what the media type should be
+ } else {
+ builder.type(RestfulMediaType.APPLICATION_JSON_ERROR);
+ }
final String message = ex.getMessage();
if (message != null) {
- builder.header(RestfulResponse.Header.WARNING.getName(), WARNING_HEADER_PREFIX + message);
+ builder.header(RestfulResponse.Header.WARNING.getName(), RestfulResponse.Header.WARNING.render(message));
}
return builder.build();
}
private static class ExceptionPojo {
- public static ExceptionPojo create(final Exception ex) {
+ public static ExceptionPojo create(final Throwable ex) {
return new ExceptionPojo(ex);
}
@@ -108,16 +114,20 @@ public class RestfulObjectsApplicationExceptionMapper implements ExceptionMapper
}
- static String jsonFor(final RestfulObjectsApplicationException ex) {
- final JsonRepresentation jsonRepresentation = ex.getJsonRepresentation();
+ static String bodyFor(final RestfulObjectsApplicationException ex) {
+ final JsonRepresentation jsonRepresentation = ex.getBody();
if (jsonRepresentation != null) {
return jsonRepresentation.toString();
}
+ Throwable cause = ex.getCause();
+ if(cause == null) {
+ return null;
+ }
try {
- return JsonMapper.instance().write(ExceptionPojo.create(ex));
+ return JsonMapper.instance().write(ExceptionPojo.create(cause));
} catch (final Exception e) {
// fallback
- return "{ \"exception\": \"" + ExceptionUtils.getFullStackTrace(ex) + "\" }";
+ return "{ \"exception\": \"" + ExceptionUtils.getFullStackTrace(cause) + "\" }";
}
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/f9803296/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainObjectResourceServerside.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainObjectResourceServerside.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainObjectResourceServerside.java
index 35ce708..24ff44f 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainObjectResourceServerside.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainObjectResourceServerside.java
@@ -68,27 +68,27 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
final String objectStr = DomainResourceHelper.asStringUtf8(object);
final JsonRepresentation objectRepr = DomainResourceHelper.readAsMap(objectStr);
if (!objectRepr.isMap()) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.BAD_REQUEST, "Body is not a map; got %s", objectRepr);
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.BAD_REQUEST, "Body is not a map; got %s", objectRepr);
}
final ObjectSpecification domainTypeSpec = getSpecificationLoader().lookupBySpecId(ObjectSpecId.of(domainType));
if (domainTypeSpec == null) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.BAD_REQUEST, "Could not determine type of domain object to persist (no class with domainType Id of '%s')", domainType);
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.BAD_REQUEST, "Could not determine type of domain object to persist (no class with domainType Id of '%s')", domainType);
}
final ObjectAdapter objectAdapter = getResourceContext().getPersistenceSession().createTransientInstance(domainTypeSpec);
final JsonRepresentation propertiesList = objectRepr.getArrayEnsured("members[memberType=property]");
if (propertiesList == null) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.BAD_REQUEST, "Could not find properties list (no members[memberType=property]); got %s", objectRepr);
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.BAD_REQUEST, "Could not find properties list (no members[memberType=property]); got %s", objectRepr);
}
if (!DomainResourceHelper.copyOverProperties(getResourceContext(), objectAdapter, propertiesList)) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.BAD_REQUEST, objectRepr, "Illegal property value");
+ throw RestfulObjectsApplicationException.createWithBody(HttpStatusCode.BAD_REQUEST, objectRepr, "Illegal property value");
}
final Consent validity = objectAdapter.getSpecification().isValid(objectAdapter);
if (validity.isVetoed()) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.BAD_REQUEST, objectRepr, validity.getReason());
+ throw RestfulObjectsApplicationException.createWithBody(HttpStatusCode.BAD_REQUEST, objectRepr, validity.getReason());
}
getResourceContext().getPersistenceSession().makePersistent(objectAdapter);
@@ -124,14 +124,14 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
final String objectStr = DomainResourceHelper.asStringUtf8(object);
final JsonRepresentation objectRepr = DomainResourceHelper.readAsMap(objectStr);
if (!objectRepr.isMap()) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.BAD_REQUEST, "Body is not a map; got %s", objectRepr);
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.BAD_REQUEST, "Body is not a map; got %s", objectRepr);
}
final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, oidStr);
final JsonRepresentation propertiesList = objectRepr.getArrayEnsured("members[memberType=property]");
if (propertiesList == null) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.BAD_REQUEST, "Could not find properties list (no members[memberType=property]); got %s", objectRepr);
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.BAD_REQUEST, "Could not find properties list (no members[memberType=property]); got %s", objectRepr);
}
final IsisTransactionManager transactionManager = getResourceContext().getPersistenceSession().getTransactionManager();
@@ -139,13 +139,13 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
try {
if (!DomainResourceHelper.copyOverProperties(getResourceContext(), objectAdapter, propertiesList)) {
transactionManager.abortTransaction();
- throw RestfulObjectsApplicationException.create(HttpStatusCode.BAD_REQUEST, objectRepr, "Illegal property value");
+ throw RestfulObjectsApplicationException.createWithBody(HttpStatusCode.BAD_REQUEST, objectRepr, "Illegal property value");
}
final Consent validity = objectAdapter.getSpecification().isValid(objectAdapter);
if (validity.isVetoed()) {
transactionManager.abortTransaction();
- throw RestfulObjectsApplicationException.create(HttpStatusCode.BAD_REQUEST, objectRepr, validity.getReason());
+ throw RestfulObjectsApplicationException.createWithBody(HttpStatusCode.BAD_REQUEST, objectRepr, validity.getReason());
}
transactionManager.endTransaction();
@@ -198,7 +198,7 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
final Consent consent = property.isAssociationValid(objectAdapter, argAdapter);
if (consent.isVetoed()) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.UNAUTHORIZED, consent.getReason());
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.UNAUTHORIZED, consent.getReason());
}
property.set(objectAdapter, argAdapter);
@@ -220,7 +220,7 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
final Consent consent = property.isAssociationValid(objectAdapter, null);
if (consent.isVetoed()) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.UNAUTHORIZED, consent.getReason());
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.UNAUTHORIZED, consent.getReason());
}
property.set(objectAdapter, null);
@@ -259,7 +259,7 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
final OneToManyAssociation collection = helper.getCollectionThatIsVisibleAndUsable(collectionId, Intent.MUTATE, getResourceContext().getWhere());
if (!collection.getCollectionSemantics().isSet()) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.BAD_REQUEST, "Collection '%s' does not have set semantics", collectionId);
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.BAD_REQUEST, "Collection '%s' does not have set semantics", collectionId);
}
final ObjectSpecification collectionSpec = collection.getSpecification();
@@ -268,7 +268,7 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
final Consent consent = collection.isValidToAdd(objectAdapter, argAdapter);
if (consent.isVetoed()) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.UNAUTHORIZED, consent.getReason());
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.UNAUTHORIZED, consent.getReason());
}
collection.addElement(objectAdapter, argAdapter);
@@ -290,7 +290,7 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
final OneToManyAssociation collection = helper.getCollectionThatIsVisibleAndUsable(collectionId, Intent.MUTATE, getResourceContext().getWhere());
if (!collection.getCollectionSemantics().isListOrArray()) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.METHOD_NOT_ALLOWED, "Collection '%s' does not have list or array semantics", collectionId);
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.METHOD_NOT_ALLOWED, "Collection '%s' does not have list or array semantics", collectionId);
}
final ObjectSpecification collectionSpec = collection.getSpecification();
@@ -299,7 +299,7 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
final Consent consent = collection.isValidToAdd(objectAdapter, argAdapter);
if (consent.isVetoed()) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.UNAUTHORIZED, consent.getReason());
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.UNAUTHORIZED, consent.getReason());
}
collection.addElement(objectAdapter, argAdapter);
@@ -324,7 +324,7 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
final Consent consent = collection.isValidToRemove(objectAdapter, argAdapter);
if (consent.isVetoed()) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.UNAUTHORIZED, consent.getReason());
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.UNAUTHORIZED, consent.getReason());
}
collection.removeElement(objectAdapter, argAdapter);
http://git-wip-us.apache.org/repos/asf/isis/blob/f9803296/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
index e1a8d85..87cd55a 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
@@ -32,7 +32,6 @@ import org.apache.isis.applib.annotation.ActionSemantics;
import org.apache.isis.applib.annotation.Where;
import org.apache.isis.core.commons.authentication.AuthenticationSession;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.oid.RootOid;
import org.apache.isis.core.metamodel.adapter.version.Version;
import org.apache.isis.core.metamodel.consent.Consent;
import org.apache.isis.core.metamodel.facets.object.value.ValueFacet;
@@ -55,7 +54,6 @@ import org.apache.isis.viewer.restfulobjects.rendering.domainobjects.ActionResul
import org.apache.isis.viewer.restfulobjects.rendering.domainobjects.DomainObjectLinkTo;
import org.apache.isis.viewer.restfulobjects.rendering.domainobjects.DomainObjectReprRenderer;
import org.apache.isis.viewer.restfulobjects.rendering.domainobjects.JsonValueEncoder;
-import org.apache.isis.viewer.restfulobjects.rendering.domainobjects.JsonValueEncoder.ExpectedStringRepresentingValueException;
import org.apache.isis.viewer.restfulobjects.rendering.domainobjects.MemberType;
import org.apache.isis.viewer.restfulobjects.rendering.domainobjects.ObjectActionReprRenderer;
import org.apache.isis.viewer.restfulobjects.rendering.domainobjects.ObjectAdapterLinkTo;
@@ -250,7 +248,7 @@ public final class DomainResourceHelper {
final ActionSemantics.Of actionSemantics = action.getSemantics();
if (actionSemantics != ActionSemantics.Of.SAFE) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.METHOD_NOT_ALLOWED, "Method not allowed; action '%s' is not query only", action.getId());
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.METHOD_NOT_ALLOWED, "Method not allowed; action '%s' is not query only", action.getId());
}
return invokeActionUsingAdapters(action, arguments);
@@ -262,7 +260,7 @@ public final class DomainResourceHelper {
final ActionSemantics.Of actionSemantics = action.getSemantics();
if (!actionSemantics.isIdempotentInNature()) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.METHOD_NOT_ALLOWED, "Method not allowed; action '%s' is not idempotent", action.getId());
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.METHOD_NOT_ALLOWED, "Method not allowed; action '%s' is not idempotent", action.getId());
}
return invokeActionUsingAdapters(action, arguments);
}
@@ -291,7 +289,7 @@ public final class DomainResourceHelper {
final Object arg = argAdapter.getObject();
final String reasonNotValid = parameter.isValid(objectAdapter, arg, null);
if (reasonNotValid != null) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.NOT_ACCEPTABLE, reasonNotValid);
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.NOT_ACCEPTABLE, reasonNotValid);
}
}
}
@@ -300,7 +298,7 @@ public final class DomainResourceHelper {
final ObjectAdapter[] argArray = argAdapters.toArray(new ObjectAdapter[0]);
final Consent consent = action.isProposedArgumentSetValid(objectAdapter, argArray);
if (consent.isVetoed()) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.NOT_ACCEPTABLE, consent.getReason());
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.NOT_ACCEPTABLE, consent.getReason());
}
// invoke
@@ -324,33 +322,46 @@ public final class DomainResourceHelper {
* @param resourceContext
* @param objectSpec
* - the {@link ObjectSpecification} to interpret the object as.
- * @param representation
+ * @param argRepr
* - expected to be either a String or a Map (ie from within a
* List, built by parsing a JSON structure).
*/
- private static ObjectAdapter objectAdapterFor(final RendererContext resourceContext, final ObjectSpecification objectSpec, final JsonRepresentation representation) {
+ private static ObjectAdapter objectAdapterFor(final RendererContext resourceContext, final ObjectSpecification objectSpec, final JsonRepresentation argRepr) {
- if (representation == null) {
+ if (argRepr == null) {
return null;
}
// value (encodable)
if (objectSpec.isEncodeable()) {
- return new JsonValueEncoder().asAdapter(objectSpec, representation);
+ return new JsonValueEncoder().asAdapter(objectSpec, argRepr);
+ }
+
+ final JsonRepresentation argValueRepr = argRepr.getRepresentation("value");
+ if(argValueRepr == null) {
+ String reason = "No 'value' key";
+ argRepr.mapPut("invalidReason", reason);
+ throw new IllegalArgumentException(reason);
}
// reference
- if (!representation.isLink()) {
- throw new IllegalArgumentException("Expected a link (because this object's type is not a value) but found no 'href'");
+ if (!argValueRepr.isLink()) {
+ final String reason = "Expected a link (because this object's type is not a value) but found no 'href'";
+ argRepr.mapPut("invalidReason", reason);
+ throw new IllegalArgumentException(reason);
}
- final String oidFromHref = UrlParserUtils.encodedOidFromLink(representation);
+ final String oidFromHref = UrlParserUtils.encodedOidFromLink(argValueRepr);
if (oidFromHref == null) {
- throw new IllegalArgumentException("Could not parse 'href' to identify the object's OID");
+ final String reason = "Could not parse 'href' to identify the object's OID";
+ argRepr.mapPut("invalidReason", reason);
+ throw new IllegalArgumentException(reason);
}
final ObjectAdapter objectAdapter = OidUtils.getObjectAdapterElseNull(resourceContext, oidFromHref);
if (objectAdapter == null) {
- throw new IllegalArgumentException("Object not found for 'href'");
+ final String reason = "'href' does not reference a known entity";
+ argRepr.mapPut("invalidReason", reason);
+ throw new IllegalArgumentException(reason);
}
return objectAdapter;
}
@@ -417,7 +428,7 @@ public final class DomainResourceHelper {
final Consent usable = objectMember.isUsable(authenticationSession, objectAdapter, where);
if (usable.isVetoed()) {
final String memberTypeStr = memberType.name().toLowerCase();
- throw RestfulObjectsApplicationException.create(HttpStatusCode.NOT_ACCEPTABLE, "%s is not usable: '%s' (%s)", memberTypeStr, memberId, usable.getReason());
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.NOT_ACCEPTABLE, "%s is not usable: '%s' (%s)", memberTypeStr, memberId, usable.getReason());
}
}
return objectMember;
@@ -425,7 +436,7 @@ public final class DomainResourceHelper {
protected static void throwNotFoundException(final String memberId, final MemberType memberType) {
final String memberTypeStr = memberType.name().toLowerCase();
- throw RestfulObjectsApplicationException.create(HttpStatusCode.NOT_FOUND, "%s '%s' either does not exist or is not visible", memberTypeStr, memberId);
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.NOT_FOUND, "%s '%s' either does not exist or is not visible", memberTypeStr, memberId);
}
// ///////////////////////////////////////////////////////////////////
@@ -448,7 +459,7 @@ public final class DomainResourceHelper {
ObjectAdapter parseAsMapWithSingleValue(final ObjectSpecification objectSpec, final JsonRepresentation arguments) {
final JsonRepresentation representation = arguments.getRepresentation("value");
if (arguments.size() != 1 || representation == null) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.BAD_REQUEST, "Body should be a map with a single key 'value' whose value represents an instance of type '%s'", resourceFor(objectSpec));
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.BAD_REQUEST, "Body should be a map with a single key 'value' whose value represents an instance of type '%s'", resourceFor(objectSpec));
}
return objectAdapterFor(resourceContext, objectSpec, representation);
@@ -463,19 +474,23 @@ public final class DomainResourceHelper {
final List<ObjectAdapter> argAdapters = Lists.newArrayList();
final List<ObjectActionParameter> parameters = action.getParameters();
+ final StringBuilder invalidReasonBuf = new StringBuilder();
for (int i = 0; i < argList.size(); i++) {
- final String paramName = parameters.get(i).getName();
final JsonRepresentation arg = argList.get(i);
final ObjectSpecification paramSpec = parameters.get(i).getSpecification();
try {
final ObjectAdapter objectAdapter = objectAdapterFor(resourceContext, paramSpec, arg);
argAdapters.add(objectAdapter);
- } catch (final ExpectedStringRepresentingValueException e) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.BAD_REQUEST, "Action '%s', argument %s should be a URL encoded string representing a value of type %s", action.getId(), paramName, resourceFor(paramSpec));
- } catch (final ExpectedMapRepresentingLinkException e) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.BAD_REQUEST, "Action '%s', argument %s should be a map representing a link to reference of type %s", action.getId(), paramName, resourceFor(paramSpec));
+ } catch (final IllegalArgumentException e) {
+ if(invalidReasonBuf.length()>0) {
+ invalidReasonBuf.append("; ");
+ }
+ invalidReasonBuf.append(e.getMessage());
}
}
+ if(invalidReasonBuf.length()>0) {
+ throw RestfulObjectsApplicationException.createWithBody(HttpStatusCode.VALIDATION_FAILED, arguments, invalidReasonBuf.toString());
+ }
return argAdapters;
}
@@ -486,7 +501,9 @@ public final class DomainResourceHelper {
for (final Entry<String, JsonRepresentation> arg : arguments.mapIterable()) {
final String argName = arg.getKey();
if (action.getParameterById(argName) == null) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.BAD_REQUEST, "Action '%s' does not have a parameter %s but an argument of that name was provided", action.getId(), argName);
+ String reason = String.format("Action '%s' does not have a parameter %s but an argument of that name was provided", action.getId(), argName);
+ arguments.mapPut("x-ro-invalidReason", reason);
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.VALIDATION_FAILED, reason);
}
}
@@ -497,7 +514,9 @@ public final class DomainResourceHelper {
final String paramId = param.getId();
final JsonRepresentation argRepr = arguments.getRepresentation(paramId);
if (argRepr == null && !param.isOptional()) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.BAD_REQUEST, "Action '%s', no argument found for (mandatory) parameter '%s'", action.getId(), paramId);
+ String reason = String.format("Action '%s', no argument found for (mandatory) parameter '%s'", action.getId(), paramId);
+ arguments.mapPut("x-ro-invalidReason", reason);
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.VALIDATION_FAILED, reason);
}
argList.add(argRepr);
}
@@ -543,15 +562,15 @@ public final class DomainResourceHelper {
try {
final JsonRepresentation jsonRepr = JsonMapper.instance().read(args);
if (!jsonRepr.isMap()) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.BAD_REQUEST, "could not read %s as a JSON map", argsNature);
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.BAD_REQUEST, "could not read %s as a JSON map", argsNature);
}
return jsonRepr;
} catch (final JsonParseException e) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.BAD_REQUEST, e, "could not parse %s", argsNature);
+ throw RestfulObjectsApplicationException.createWithCauseAndMessage(HttpStatusCode.BAD_REQUEST, e, "could not parse %s", argsNature);
} catch (final JsonMappingException e) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.BAD_REQUEST, e, "could not read %s as JSON", argsNature);
+ throw RestfulObjectsApplicationException.createWithCauseAndMessage(HttpStatusCode.BAD_REQUEST, e, "could not read %s as JSON", argsNature);
} catch (final IOException e) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.BAD_REQUEST, e, "could not parse %s", argsNature);
+ throw RestfulObjectsApplicationException.createWithCauseAndMessage(HttpStatusCode.BAD_REQUEST, e, "could not parse %s", argsNature);
}
}
@@ -560,7 +579,7 @@ public final class DomainResourceHelper {
final byte[] byteArray = ByteStreams.toByteArray(body);
return new String(byteArray, Charsets.UTF_8);
} catch (final IOException e) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.BAD_REQUEST, e, "could not read body");
+ throw RestfulObjectsApplicationException.createWithCauseAndMessage(HttpStatusCode.BAD_REQUEST, e, "could not read body");
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/f9803296/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainTypeResourceServerside.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainTypeResourceServerside.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainTypeResourceServerside.java
index 839b84f..1d2de44 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainTypeResourceServerside.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainTypeResourceServerside.java
@@ -280,7 +280,7 @@ public class DomainTypeResourceServerside extends ResourceAbstract implements Do
private static String linkFromFormalArgs(final String argumentsQueryString, final String paramName) {
final JsonRepresentation arguments = DomainResourceHelper.readQueryStringAsMap(argumentsQueryString);
if (!arguments.isLink(paramName)) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.BAD_REQUEST, "Args should contain a link '%s'", paramName);
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.BAD_REQUEST, "Args should contain a link '%s'", paramName);
}
return arguments.getLink(paramName).getHref();
http://git-wip-us.apache.org/repos/asf/isis/blob/f9803296/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java
index b3a5a69..9f00f5b 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java
@@ -174,7 +174,7 @@ public abstract class ResourceAbstract {
if (objectAdapter == null) {
final String instanceIdUnencoded = UrlDecoderUtils.urlDecode(instanceId);
- throw RestfulObjectsApplicationException.create(HttpStatusCode.NOT_FOUND, "could not determine adapter for OID: '%s:%s'", domainType, instanceIdUnencoded);
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.NOT_FOUND, "could not determine adapter for OID: '%s:%s'", domainType, instanceIdUnencoded);
}
return objectAdapter;
}
@@ -197,7 +197,7 @@ public abstract class ResourceAbstract {
return serviceAdapter;
}
}
- throw RestfulObjectsApplicationException.create(HttpStatusCode.NOT_FOUND, "Could not locate service '%s'", serviceId);
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.NOT_FOUND, "Could not locate service '%s'", serviceId);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/f9803296/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapperTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapperTest.java b/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapperTest.java
index a94d987..6aa9834 100644
--- a/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapperTest.java
+++ b/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapperTest.java
@@ -71,7 +71,7 @@ public class RestfulObjectsApplicationExceptionMapperTest {
public void entity_withMessage() throws Exception {
// givens
- final RestfulObjectsApplicationException ex = RestfulObjectsApplicationException.create(HttpStatusCode.BAD_REQUEST, "foobar");
+ final RestfulObjectsApplicationException ex = RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.BAD_REQUEST, "foobar");
// when
final Response response = exceptionMapper.toResponse(ex);
@@ -92,7 +92,7 @@ public class RestfulObjectsApplicationExceptionMapperTest {
public void entity_withCause() throws Exception {
// given
final Exception cause = new Exception("barfoo");
- final RestfulObjectsApplicationException ex = RestfulObjectsApplicationException.create(HttpStatusCode.BAD_REQUEST, cause, "foobar");
+ final RestfulObjectsApplicationException ex = RestfulObjectsApplicationException.createWithCauseAndMessage(HttpStatusCode.BAD_REQUEST, cause, "foobar");
// when
final Response response = exceptionMapper.toResponse(ex);
http://git-wip-us.apache.org/repos/asf/isis/blob/f9803296/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
index a766d4e..3bcb277 100644
--- 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
@@ -18,11 +18,10 @@
*/
package org.apache.isis.viewer.restfulobjects.tck.domainservice.serviceId.action.invoke;
-import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+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.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
import javax.ws.rs.core.MediaType;
@@ -30,7 +29,6 @@ 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;
@@ -42,14 +40,9 @@ import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceR
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;
@@ -67,7 +60,6 @@ public class DomainServiceTest_req_safe_refarg_bad {
@Before
public void setUp() throws Exception {
client = webServerRule.getClient();
-
serviceResource = client.getDomainServiceResource();
}
@@ -86,26 +78,24 @@ public class DomainServiceTest_req_safe_refarg_bad {
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);
+ args.mapPut("searchFor.value", nonExistentEntityLink);
+ args.mapPut("from.value", 0);
+ args.mapPut("to.value", 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"));
+ assertThat(restfulResponse.getHeader(Header.WARNING), is("'href' does not reference a known entity"));
- // hmmm... what is the media type, though? the spec doesn't say. just assuming generic for now.
+ // 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.invalidReason"), is("'href' does not reference a known entity"));
}
@Ignore("still to update according to above test...")
@@ -119,9 +109,9 @@ public class DomainServiceTest_req_safe_refarg_bad {
// 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);
+ 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);
http://git-wip-us.apache.org/repos/asf/isis/blob/f9803296/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
index c9dad04..f7cd2c0 100644
--- 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
@@ -19,18 +19,16 @@
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 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;
@@ -42,13 +40,9 @@ import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRe
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;
@@ -58,7 +52,6 @@ public class DomainServiceTest_req_safe_refarg_resp_scalar {
public IsisWebServerRule webServerRule = new IsisWebServerRule();
private RestfulClient client;
-
private DomainServiceResource serviceResource;
@Before
@@ -87,9 +80,9 @@ public class DomainServiceTest_req_safe_refarg_resp_scalar {
// 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);
+ args.mapPut("searchFor.value", firstEntityLink);
+ args.mapPut("from.value", 0);
+ args.mapPut("to.value", 3);
RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
@@ -114,9 +107,9 @@ public class DomainServiceTest_req_safe_refarg_resp_scalar {
// 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);
+ args.mapPut("searchFor.value", firstEntityLink);
+ args.mapPut("from.value", 3);
+ args.mapPut("to.values", 5);
restfulResponse = client.followT(invokeLink, args);
@@ -139,9 +132,9 @@ public class DomainServiceTest_req_safe_refarg_resp_scalar {
// 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);
+ 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);
@@ -165,8 +158,8 @@ public class DomainServiceTest_req_safe_refarg_resp_scalar {
final JsonRepresentation args = invokeLink.getArguments();
// when
- args.mapPut("from", from);
- args.mapPut("to", to);
+ args.mapPut("from.value", from);
+ args.mapPut("to.value", to);
final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
http://git-wip-us.apache.org/repos/asf/isis/blob/f9803296/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
index 1e8d02b..0e5c67c 100644
--- 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
@@ -81,8 +81,8 @@ public class DomainServiceTest_req_safe_simplearg_resp_list {
assertThat(args, RestfulMatchers.mapHas("to"));
// when
- args.mapPut("from", 1);
- args.mapPut("to", 3);
+ args.mapPut("from.value", 1);
+ args.mapPut("to.value", 3);
final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
@@ -100,8 +100,8 @@ public class DomainServiceTest_req_safe_simplearg_resp_list {
// given, when
JsonRepresentation args = JsonRepresentation.newMap();
- args.mapPut("from", 1);
- args.mapPut("to", 3);
+ 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);
[45/50] [abbrv] ISIS-233: more tck tests for RO viewer.
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/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
index 7207f1f..a85643e 100644
--- 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
@@ -1,10 +1,27 @@
package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+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.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
public class Get_whenVoid_thenRepresentation_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 todo() throws Exception {
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenVoid_thenResponseHeaders_ContentLength_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_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenVoid_thenResponseHeaders_ContentLength_ok_TODO.java
index d63e7d7..bb3b566 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenVoid_thenResponseHeaders_ContentLength_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenVoid_thenResponseHeaders_ContentLength_ok_TODO.java
@@ -1,13 +1,25 @@
package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+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.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
public class Get_whenVoid_thenResponseHeaders_ContentLength_ok_TODO {
- @Ignore
- @Test
- public void todo() throws Exception {
-
+ @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());
}
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenVoid_thenResponseHeaders_ContentType_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_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenVoid_thenResponseHeaders_ContentType_ok_TODO.java
index dd394f6..c0e2286 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenVoid_thenResponseHeaders_ContentType_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenVoid_thenResponseHeaders_ContentType_ok_TODO.java
@@ -1,10 +1,27 @@
package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+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.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
public class Get_whenVoid_thenResponseHeaders_ContentType_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 todo() throws Exception {
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/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
index c9d3a89..01b9b22 100644
--- 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
@@ -1,13 +1,25 @@
package org.apache.isis.viewer.restfulobjects.tck.objectsoftype;
+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.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
public class Post_ok_TODO {
- @Ignore
- @Test
- public void todo() throws Exception {
-
+ @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());
}
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_CacheControl_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_CacheControl_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_CacheControl_ok_TODO.java
index 43f1704..326d20c 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_CacheControl_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_CacheControl_ok_TODO.java
@@ -39,23 +39,4 @@ public class Post_thenResponseHeaders_CacheControl_ok_TODO {
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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_ContentLength_ok_TODO.java
index e8e15d5..86acb53 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_ContentLength_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_ContentLength_ok_TODO.java
@@ -39,23 +39,4 @@ public class Post_thenResponseHeaders_ContentLength_ok_TODO {
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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_ContentType_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_ContentType_ok_TODO.java
index 0cf1401..8ff7963 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_ContentType_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_ContentType_ok_TODO.java
@@ -39,23 +39,4 @@ public class Post_thenResponseHeaders_ContentType_ok_TODO {
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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_thenResponseHeaders_ContentLength_ok_TODO.java
index ffc84fc..3f9e81f 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_thenResponseHeaders_ContentLength_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_thenResponseHeaders_ContentLength_ok_TODO.java
@@ -38,24 +38,4 @@ public class Get_thenResponseHeaders_ContentLength_ok_TODO {
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/430e8b3c/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/actions/typeof/annotation/TypeOfAnnotationForActionsFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/actions/typeof/annotation/TypeOfAnnotationForActionsFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/actions/typeof/annotation/TypeOfAnnotationForActionsFacetFactory.java
index fb050bf..8ab6fef 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/actions/typeof/annotation/TypeOfAnnotationForActionsFacetFactory.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/actions/typeof/annotation/TypeOfAnnotationForActionsFacetFactory.java
@@ -19,6 +19,8 @@
package org.apache.isis.core.progmodel.facets.actions.typeof.annotation;
+import java.lang.reflect.GenericDeclaration;
+import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
@@ -43,46 +45,68 @@ public class TypeOfAnnotationForActionsFacetFactory extends FacetFactoryAbstract
@Override
public void process(final ProcessMethodContext processMethodContext) {
- final TypeOf annotation = Annotations.getAnnotation(processMethodContext.getMethod(), TypeOf.class);
-
- final Class<?> methodReturnType = processMethodContext.getMethod().getReturnType();
+ final Method method = processMethodContext.getMethod();
+ final Class<?> methodReturnType = method.getReturnType();
if (!collectionTypeRegistry.isCollectionType(methodReturnType) && !collectionTypeRegistry.isArrayType(methodReturnType)) {
return;
}
- final Class<?> returnType = processMethodContext.getMethod().getReturnType();
+ final Class<?> returnType = method.getReturnType();
if (returnType.isArray()) {
final Class<?> componentType = returnType.getComponentType();
FacetUtil.addFacet(new TypeOfFacetInferredFromArray(componentType, processMethodContext.getFacetHolder(), getSpecificationLoader()));
return;
}
+ final TypeOf annotation = Annotations.getAnnotation(method, TypeOf.class);
if (annotation != null) {
FacetUtil.addFacet(new TypeOfFacetAnnotationForAction(annotation.value(), processMethodContext.getFacetHolder(), getSpecificationLoader()));
return;
}
- final Type type = processMethodContext.getMethod().getGenericReturnType();
+ final Type type = method.getGenericReturnType();
if (!(type instanceof ParameterizedType)) {
return;
}
- final ParameterizedType parameterizedType = (ParameterizedType) type;
- final Type[] actualTypeArguments = parameterizedType.getActualTypeArguments();
- if (actualTypeArguments.length == 0) {
+ final ParameterizedType methodParameterizedType = (ParameterizedType) type;
+ final Type[] methodActualTypeArguments = methodParameterizedType.getActualTypeArguments();
+ if (methodActualTypeArguments.length == 0) {
return;
}
- final Object actualTypeArgument = actualTypeArguments[0];
- if (actualTypeArgument instanceof Class) {
- final Class<?> actualType = (Class<?>) actualTypeArgument;
+ final Object methodActualTypeArgument = methodActualTypeArguments[0];
+ if (methodActualTypeArgument instanceof Class) {
+ final Class<?> actualType = (Class<?>) methodActualTypeArgument;
FacetUtil.addFacet(new TypeOfFacetInferredFromGenerics(actualType, processMethodContext.getFacetHolder(), getSpecificationLoader()));
return;
}
- if (actualTypeArgument instanceof TypeVariable) {
-
- // TODO: what to do here?
+ if (methodActualTypeArgument instanceof TypeVariable) {
+
+ TypeVariable<?> methodTypeVariable = (TypeVariable<?>) methodActualTypeArgument;
+ final GenericDeclaration methodGenericClassDeclaration = methodTypeVariable.getGenericDeclaration();
+
+ // try to match up with the actual type argument of the generic superclass.
+ final Type genericSuperclass = processMethodContext.getCls().getGenericSuperclass();
+ if(genericSuperclass instanceof ParameterizedType) {
+ final ParameterizedType parameterizedTypeOfSuperclass = (ParameterizedType)genericSuperclass;
+ if(parameterizedTypeOfSuperclass.getRawType() == methodGenericClassDeclaration) {
+ final Type[] genericSuperClassActualTypeArguments = parameterizedTypeOfSuperclass.getActualTypeArguments();
+ // simplification: if there's just one, then use it.
+ if(methodActualTypeArguments.length == 1) {
+ final Type actualType = genericSuperClassActualTypeArguments[0];
+ if(actualType instanceof Class) {
+ // just being safe
+ Class<?> actualCls = (Class<?>) actualType;
+ FacetUtil.addFacet(new TypeOfFacetInferredFromGenerics(actualCls, processMethodContext.getFacetHolder(), getSpecificationLoader()));
+ return;
+ }
+ }
+ }
+ }
+
+ // TODO: otherwise, what to do?
return;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/scalars/JodaValuedEntity.java
----------------------------------------------------------------------
diff --git a/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/scalars/JodaValuedEntity.java b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/scalars/JodaValuedEntity.java
new file mode 100644
index 0000000..70a5e6d
--- /dev/null
+++ b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/scalars/JodaValuedEntity.java
@@ -0,0 +1,91 @@
+/*
+ * 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.core.tck.dom.scalars;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Date;
+
+import org.joda.time.LocalDate;
+import org.joda.time.LocalDateTime;
+
+import org.apache.isis.applib.AbstractDomainObject;
+import org.apache.isis.applib.annotation.MemberOrder;
+import org.apache.isis.applib.annotation.ObjectType;
+import org.apache.isis.applib.annotation.Optional;
+import org.apache.isis.applib.annotation.Title;
+
+@javax.jdo.annotations.PersistenceCapable
+@javax.jdo.annotations.Discriminator("JODA")
+@javax.jdo.annotations.Query(
+ name="joda_findByStringProperty", language="JDOQL",
+ value="SELECT FROM org.apache.isis.tck.dom.scalars.JdkValuedEntity WHERE stringProperty == :i")
+@ObjectType("JODA")
+public class JodaValuedEntity extends AbstractDomainObject {
+
+ // {{ StringProperty (also title, pk)
+ private String stringProperty;
+
+ @javax.jdo.annotations.PrimaryKey
+ @Title
+ @Optional
+ @MemberOrder(sequence = "1")
+ public String getStringProperty() {
+ return stringProperty;
+ }
+
+ public void setStringProperty(final String description) {
+ this.stringProperty = description;
+ }
+
+ // }}
+
+ // {{ LocalDateProperty
+ private LocalDate localDateProperty;
+
+ @Optional
+ @MemberOrder(sequence = "1")
+ public LocalDate getLocalDateProperty() {
+ return localDateProperty;
+ }
+
+ public void setLocalDateProperty(final LocalDate localDateProperty) {
+ this.localDateProperty = localDateProperty;
+ }
+ // }}
+
+
+ // {{ LocalDateTimeProperty
+ private LocalDateTime localDateTimeProperty;
+
+ @Optional
+ @MemberOrder(sequence = "1")
+ public LocalDateTime getLocalDateTimeProperty() {
+ return localDateTimeProperty;
+ }
+
+ public void setLocalDateTimeProperty(final LocalDateTime localDateTimeProperty) {
+ this.localDateTimeProperty = localDateTimeProperty;
+ }
+ // }}
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/scalars/JodaValuedEntityRepository.java
----------------------------------------------------------------------
diff --git a/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/scalars/JodaValuedEntityRepository.java b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/scalars/JodaValuedEntityRepository.java
new file mode 100644
index 0000000..1630539
--- /dev/null
+++ b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/scalars/JodaValuedEntityRepository.java
@@ -0,0 +1,44 @@
+/*
+ * 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.core.tck.dom.scalars;
+
+import org.apache.isis.applib.annotation.MemberOrder;
+import org.apache.isis.applib.annotation.Named;
+import org.apache.isis.applib.annotation.ObjectType;
+import org.apache.isis.core.tck.dom.AbstractEntityRepository;
+
+@Named("JodaValuedEntities")
+@ObjectType("JodaValuedEntities")
+public class JodaValuedEntityRepository extends AbstractEntityRepository<JodaValuedEntity> {
+
+ public JodaValuedEntityRepository() {
+ super(JodaValuedEntity.class, "JodaValuedEntities");
+ }
+
+ /**
+ * Required to discover the JodaValueEntity type.
+ */
+ @Override
+ @MemberOrder(sequence = "2")
+ public JodaValuedEntity newEntity() {
+ return super.newEntity();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/core/tck/tck-fixture/src/main/java/org/apache/isis/core/tck/fixture/scalars/JodaValuedEntityFixture.java
----------------------------------------------------------------------
diff --git a/core/tck/tck-fixture/src/main/java/org/apache/isis/core/tck/fixture/scalars/JodaValuedEntityFixture.java b/core/tck/tck-fixture/src/main/java/org/apache/isis/core/tck/fixture/scalars/JodaValuedEntityFixture.java
new file mode 100644
index 0000000..e86e457
--- /dev/null
+++ b/core/tck/tck-fixture/src/main/java/org/apache/isis/core/tck/fixture/scalars/JodaValuedEntityFixture.java
@@ -0,0 +1,47 @@
+/*
+ * 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.core.tck.fixture.scalars;
+
+import org.apache.isis.applib.fixtures.AbstractFixture;
+import org.apache.isis.core.tck.dom.scalars.JodaValuedEntity;
+import org.apache.isis.core.tck.dom.scalars.JodaValuedEntityRepository;
+
+public class JodaValuedEntityFixture extends AbstractFixture {
+
+ @Override
+ public void install() {
+ createEntity();
+ createEntity();
+ createEntity();
+ createEntity();
+ createEntity();
+ }
+
+ private JodaValuedEntity createEntity() {
+ return jodaValuesEntityRepository.newEntity();
+ }
+
+ private JodaValuedEntityRepository jodaValuesEntityRepository;
+
+ public void setJdkValuesEntityRepository(final JodaValuedEntityRepository jodaValuesEntityRepository) {
+ this.jodaValuesEntityRepository = jodaValuesEntityRepository;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/core/tck/tck-fixture/src/main/java/org/apache/isis/core/tck/fixture/scalars/PrimitiveValuedEntityFixture.java
----------------------------------------------------------------------
diff --git a/core/tck/tck-fixture/src/main/java/org/apache/isis/core/tck/fixture/scalars/PrimitiveValuedEntityFixture.java b/core/tck/tck-fixture/src/main/java/org/apache/isis/core/tck/fixture/scalars/PrimitiveValuedEntityFixture.java
index 612c18c..e9db111 100644
--- a/core/tck/tck-fixture/src/main/java/org/apache/isis/core/tck/fixture/scalars/PrimitiveValuedEntityFixture.java
+++ b/core/tck/tck-fixture/src/main/java/org/apache/isis/core/tck/fixture/scalars/PrimitiveValuedEntityFixture.java
@@ -35,7 +35,16 @@ public class PrimitiveValuedEntityFixture extends AbstractFixture {
}
private PrimitiveValuedEntity createEntity() {
- return primitiveValuesEntityRepository.newEntity();
+ final PrimitiveValuedEntity pve = primitiveValuesEntityRepository.newEntity();
+ pve.setBooleanProperty(true);
+ pve.setByteProperty((byte)123);
+ pve.setShortProperty((short)32123);
+ pve.setCharProperty('a');
+ pve.setIntProperty(987654321);
+ pve.setLongProperty(2345678901234567890L);
+ pve.setFloatProperty(12345678901234567890.1234567890F);
+ pve.setDoubleProperty(12345678901234567890.1234567890);
+ return pve;
}
private PrimitiveValuedEntityRepository primitiveValuesEntityRepository;
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/core/tck/tck-fixture/src/main/java/org/apache/isis/core/tck/fixture/scalars/WrapperValuedEntityFixture.java
----------------------------------------------------------------------
diff --git a/core/tck/tck-fixture/src/main/java/org/apache/isis/core/tck/fixture/scalars/WrapperValuedEntityFixture.java b/core/tck/tck-fixture/src/main/java/org/apache/isis/core/tck/fixture/scalars/WrapperValuedEntityFixture.java
index 9b9060c..0d9d869 100644
--- a/core/tck/tck-fixture/src/main/java/org/apache/isis/core/tck/fixture/scalars/WrapperValuedEntityFixture.java
+++ b/core/tck/tck-fixture/src/main/java/org/apache/isis/core/tck/fixture/scalars/WrapperValuedEntityFixture.java
@@ -35,7 +35,17 @@ public class WrapperValuedEntityFixture extends AbstractFixture {
}
private WrapperValuedEntity createEntity() {
- return wrapperValuesEntityRepository.newEntity();
+ final WrapperValuedEntity wve = wrapperValuesEntityRepository.newEntity();
+ wve.setBooleanProperty(true);
+ wve.setByteProperty((byte)123);
+ wve.setShortProperty((short)32123);
+ wve.setCharacterProperty('a');
+ wve.setIntegerProperty(987654321);
+ wve.setLongProperty(2345678901234567890L);
+ wve.setFloatProperty(12345678901234567890.1234567890F);
+ wve.setDoubleProperty(12345678901234567890.1234567890);
+
+ return wve;
}
private WrapperValuedEntityRepository wrapperValuesEntityRepository;
[34/50] [abbrv] ISIS-233: adding new test stubs (TODOs)
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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 {
+
+}
[14/50] [abbrv] ISIS-233-ro: more on domainservice.serviceId
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_response_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_response_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_response_representation.java
deleted file mode 100644
index 1241c36..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_response_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;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.CoreMatchers.endsWith;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.Response;
-
-import org.apache.isis.core.webserver.WebServer;
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.Rel;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class DomainServiceResourceTest_services_response_representation {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
- private DomainServiceResource resource;
-
- @Before
- public void setUp() throws Exception {
- final WebServer webServer = webServerRule.getWebServer();
- client = new RestfulClient(webServer.getBase());
-
- resource = client.getDomainServiceResource();
- }
-
- @Test
- public void representation() throws Exception {
-
- // when
- final Response response = resource.services();
- final RestfulResponse<ListRepresentation> restfulResponse = RestfulResponse.ofT(response);
-
- // then
- final ListRepresentation repr = restfulResponse.getEntity();
-
- assertThat(repr, isMap());
-
- assertThat(repr.getSelf(), isLink(client)
- .rel(Rel.SELF)
- .href(endsWith(":39393/services"))
- .httpMethod(RestfulHttpMethod.GET)
- .type(RepresentationType.LIST.getMediaType())
- .returning(HttpStatusCode.OK)
- );
- assertThat(repr.getUp(), isLink(client)
- .rel(Rel.UP)
- .href(endsWith(":39393/"))
- .httpMethod(RestfulHttpMethod.GET)
- .type(RepresentationType.HOME_PAGE.getMediaType())
- .returning(HttpStatusCode.OK)
- );
-
- assertThat(repr.getValue(), isArray());
-
- assertThat(repr.getLinks(), isArray());
- assertThat(repr.getExtensions(), isMap());
- }
-
- @Test
- public void linksToDomainServiceResources() throws Exception {
-
- // given
- final RestfulResponse<ListRepresentation> jsonResp = RestfulResponse.ofT(resource.services());
- final ListRepresentation repr = jsonResp.getEntity();
-
- // when
- final JsonRepresentation values = repr.getValue();
-
- // then
- for (final LinkRepresentation link : values.arrayIterable(LinkRepresentation.class)) {
- assertThat("HiddenRepository should not show up in services list", false, is(link.getHref().endsWith("HiddenRepository")));
- }
-
- // and also
- for (final LinkRepresentation link : values.arrayIterable(LinkRepresentation.class)) {
-
- assertThat(link, isLink(client)
- .rel(containsString(Rel.SERVICE.getName()))
- .href(containsString(":39393/"))
- .httpMethod(RestfulHttpMethod.GET)
- .type(RepresentationType.DOMAIN_OBJECT.getMediaType())
- );
- assertThat(link, isLink(client)
- .returning(HttpStatusCode.OK)
- .responseEntityWithSelfHref(link.getHref())
- );
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/Util.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/Util.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/Util.java
deleted file mode 100644
index 3b64116..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/Util.java
+++ /dev/null
@@ -1,49 +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;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.Response;
-
-import org.apache.isis.viewer.restfulobjects.applib.Rel;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-
-public class Util {
-
- private Util(){}
-
- public static String givenLinkToService(RestfulClient restfulClient, String serviceId) throws JsonParseException, JsonMappingException, IOException {
-
- final DomainServiceResource resource = restfulClient.getDomainServiceResource();
- final Response response = resource.services();
- final ListRepresentation services = RestfulResponse.<ListRepresentation> ofT(response).getEntity();
-
- final String href = services.getRepresentation("value[rel=" + Rel.SERVICE.getName() + ";serviceId=\"" +
- serviceId +
- "\"]").asLink().getHref();
- return href;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/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
new file mode 100644
index 0000000..93b694e
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/DomainServiceTest_req_header_accept.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainservice.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/5e01f688/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
new file mode 100644
index 0000000..6fb5f43
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/DomainServiceTest_req_queryarg_xrofollowlinks.java
@@ -0,0 +1,152 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainservice.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.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/5e01f688/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
new file mode 100644
index 0000000..460d57d
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/DomainServiceTest_resp_headers.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainservice.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.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/5e01f688/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
new file mode 100644
index 0000000..f4d886b
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/DomainServiceTest_resp_representation.java
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainservice.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.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/5e01f688/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
new file mode 100644
index 0000000..cfde1b2
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_req_header_accept.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainservice.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.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/5e01f688/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
new file mode 100644
index 0000000..970eac0
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_req_queryarg_xrodomainmodel.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainservice.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.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/5e01f688/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
new file mode 100644
index 0000000..8aabfcf
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_req_queryarg_xrofollowlinks.java
@@ -0,0 +1,119 @@
+/*
+ * 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.RepresentationMatchers.isArray;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.Response;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.RequestParameter;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+public class 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());
+ }
+
+ @Ignore("todo... the service Id is wrong")
+ @Test
+ public void withCriteria() throws Exception {
+
+ final String href = givenHrefToService("simples");
+
+ final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, href).withArg(RequestParameter.FOLLOW_LINKS, "members[id=%s].links[rel=details]", "list");
+ final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+ final DomainObjectRepresentation repr = restfulResponse.getEntity();
+
+ final JsonRepresentation membersList = repr.getMembers();
+ assertThat(membersList, isArray());
+
+ JsonRepresentation actionRepr;
+
+ actionRepr = membersList.getRepresentation("[id=%s]", "list");
+ assertThat(actionRepr.getRepresentation("links[rel=details]"), is(not(nullValue())));
+ assertThat(actionRepr.getRepresentation("links[rel=details].value"), is(not(nullValue()))); // followed
+
+ actionRepr = membersList.getRepresentation("[id=%s]", "newTransientEntity");
+ assertThat(actionRepr.getRepresentation("links[rel=details]"), is(not(nullValue())));
+ assertThat(actionRepr.getRepresentation("links[rel=details].value"), is(nullValue())); // not
+ // followed
+ }
+
+ @Ignore("todo")
+ @Test
+ public void toSelf() throws Exception {
+
+ }
+
+ @Ignore("todo")
+ @Test
+ public void toDescribedBy() throws Exception {
+
+ }
+
+ @Ignore("todo")
+ @Test
+ public void toMembers() throws Exception {
+
+ // no need to do an individual member, that's been tested already elsewhere
+ }
+
+
+ private String givenHrefToService(final String serviceId) throws JsonParseException, JsonMappingException, IOException {
+ final DomainServiceResource resource = client.getDomainServiceResource();
+ final Response response = resource.services();
+ final ListRepresentation services = RestfulResponse.<ListRepresentation> ofT(response).getEntity();
+
+ return services.getRepresentation("values[id=%s]", serviceId).asLink().getHref();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/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
new file mode 100644
index 0000000..60fc1b3
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_resp_headers.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.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/5e01f688/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
new file mode 100644
index 0000000..b988766
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_resp_representation.java
@@ -0,0 +1,148 @@
+/*
+ * 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.RepresentationMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.CoreMatchers.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.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.junit.Before;
+import org.junit.Ignore;
+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"));
+ }
+
+
+ @Ignore("todo")
+ @Test
+ public void disabledAction() throws Exception {
+
+
+ // has a disabledRead
+
+ }
+
+ @Ignore("todo")
+ @Test
+ public void nonExistentAction() throws Exception {
+
+
+ // eg...
+ // DomainObjectMemberRepresentation listMemberRepr = repr.getAction("foobar");
+
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/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
new file mode 100644
index 0000000..6f43799
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/DomainServiceTest_when_notFound.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainservice.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/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Util.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Util.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Util.java
new file mode 100644
index 0000000..f0af94e
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Util.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainservice.serviceId;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.Response;
+
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+
+public class Util {
+
+ private Util(){}
+
+ public static String givenLinkToService(RestfulClient restfulClient, String serviceId) throws JsonParseException, JsonMappingException, IOException {
+
+ final DomainServiceResource resource = restfulClient.getDomainServiceResource();
+ final Response response = resource.services();
+ final ListRepresentation services = RestfulResponse.<ListRepresentation> ofT(response).getEntity();
+
+ final String href = services.getRepresentation("value[rel=" + Rel.SERVICE.getName() + ";serviceId=\"" +
+ serviceId +
+ "\"]").asLink().getHref();
+ return href;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_header_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_header_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_header_accept.java
deleted file mode 100644
index 8eaf96d..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_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;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.MediaType;
-
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.jboss.resteasy.client.ClientRequest;
-import org.jboss.resteasy.client.ClientResponse;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class HomePageResourceTest_root_header_accept {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- private RestfulRequest request;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
- request = client.createRequest(RestfulHttpMethod.GET, "/");
- }
-
- @Test
- public void applicationJson_noProfile_returns200() throws Exception {
-
- request.withHeader(RestfulRequest.Header.ACCEPT, MediaType.APPLICATION_JSON_TYPE);
- final RestfulResponse<HomePageRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- assertThat(restfulResponse.getHeader(RestfulResponse.Header.CONTENT_TYPE), is(RepresentationType.HOME_PAGE.getMediaType()));
- }
-
- @Test
- public void applicationJson_profileHomePage_returns200() throws Exception {
-
- request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.HOME_PAGE.getMediaType());
- final RestfulResponse<HomePageRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- }
-
- @Test
- public void missingHeader_returns200() throws Exception {
-
- final RestfulResponse<HomePageRepresentation> restfulResp = request.executeT();
-
- assertThat(restfulResp.getStatus(), is(HttpStatusCode.OK));
- }
-
- @Test
- public void applicationJson_profileIncorrect_returns406() throws Exception {
-
- request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.USER.getMediaType());
- final RestfulResponse<HomePageRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
- }
-
- @Test
- public void incorrectMediaType_returnsNotAcceptable() throws Exception {
-
- // given
- final ClientRequest clientRequest = client.getClientRequestFactory().createRelativeRequest("/");
- clientRequest.accept(MediaType.APPLICATION_ATOM_XML_TYPE);
-
- // when
- final ClientResponse<?> resp = clientRequest.get();
- final RestfulResponse<JsonRepresentation> restfulResp = RestfulResponse.of(resp);
-
- // then
- assertThat(restfulResp.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_queryargs_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_queryargs_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_queryargs_xrofollowlinks.java
deleted file mode 100644
index b3e27d4..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_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;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.Rel;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.RequestParameter;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class HomePageResourceTest_root_queryargs_xrofollowlinks {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- private RestfulRequest request;
- private RestfulResponse<HomePageRepresentation> restfulResponse;
- private HomePageRepresentation repr;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
-
- }
-
- @Test
- public void noFollow() throws Exception {
- request = client.createRequest(RestfulHttpMethod.GET, "");
- restfulResponse = request.executeT();
- repr = restfulResponse.getEntity();
-
- assertThat(repr.getSelf().getValue(), is(nullValue()));
- assertThat(repr.getUser().getValue(), is(nullValue()));
- assertThat(repr.getVersion().getValue(), is(nullValue()));
- assertThat(repr.getServices().getValue(), is(nullValue()));
- }
-
- @Test
- public void self() throws Exception {
-
- repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.SELF.getName() + "]");
-
- assertThat(repr.getSelf().getValue(), is(not(nullValue())));
- }
-
- @Test
- public void user() throws Exception {
-
- repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.USER.getName() + "]");
-
- assertThat(repr.getUser().getValue(), is(not(nullValue())));
- }
-
- @Test
- public void services() throws Exception {
-
- repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.SERVICES.getName() + "]");
-
- assertThat(repr.getServices().getValue(), is(not(nullValue())));
- }
-
- @Test
- public void version() throws Exception {
-
- repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.VERSION.getName() + "]");
-
- assertThat(repr.getVersion().getValue(), is(not(nullValue())));
- }
-
- @Test
- public void multiple() throws Exception {
-
- repr = whenExecuteAndFollowLinksUsing("/",
- "links[rel=" + Rel.USER.getName() + "]," +
- "links[rel=" + Rel.SERVICES.getName() + "]," +
- "links[rel=" + Rel.VERSION.getName() + "]");
-
- assertThat(repr.getServices().getValue(), is(not(nullValue())));
- assertThat(repr.getUser().getValue(), is(not(nullValue())));
- assertThat(repr.getVersion().getValue(), is(not(nullValue())));
- }
-
- @Test
- public void allServices_Value() throws Exception {
-
- repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.SERVICES.getName() + "].value");
-
- final JsonRepresentation servicesValue = repr.getServices().getValue();
- assertThat(servicesValue, is(not(nullValue())));
- assertThat(servicesValue, isMap());
- final JsonRepresentation serviceLinkList = servicesValue.getArray("value");
- assertThat(serviceLinkList, isArray());
-
- JsonRepresentation service;
-
- service = serviceLinkList.getRepresentation("[rel=%s;serviceId=\"%s\"]", Rel.SERVICE.getName(), "JdkValuedEntities");
- assertThat(service, isMap());
- assertThat(service.getRepresentation("value"), is(not(nullValue())));
-
- service = serviceLinkList.getRepresentation("[rel=%s;serviceId=\"%s\"]", Rel.SERVICE.getName(), "WrapperValuedEntities");
- assertThat(service, isMap());
- assertThat(service.getRepresentation("value"), is(not(nullValue())));
- }
-
- @Test
- public void selectedService_Value() throws Exception {
-
- repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.SERVICES.getName() + "].value[rel=" + Rel.SERVICE.andParam("serviceId", "WrapperValuedEntities")+"]");
-
- final JsonRepresentation servicesValue = repr.getServices().getValue();
- assertThat(servicesValue, is(not(nullValue())));
- assertThat(servicesValue, isMap());
- final JsonRepresentation serviceLinkList = servicesValue.getArray("value");
- assertThat(serviceLinkList, isArray());
-
- JsonRepresentation service;
-
- service = serviceLinkList.getRepresentation("[rel=%s;serviceId=\"%s\"]", Rel.SERVICE.getName(), "WrapperValuedEntities");
- assertThat(service, isMap());
- assertThat(service.getRepresentation("value"), is(not(nullValue())));
-
- service = serviceLinkList.getRepresentation("[rel=%s;serviceId=\"%s\"]", Rel.SERVICE.getName(), "JdkValuedEntities");
- assertThat(service.getRepresentation("value"), is(nullValue()));
- }
-
- private HomePageRepresentation whenExecuteAndFollowLinksUsing(final String uriTemplate, final String followLinks) throws JsonParseException, JsonMappingException, IOException {
- request = client.createRequest(RestfulHttpMethod.GET, uriTemplate).withArg(RequestParameter.FOLLOW_LINKS, followLinks);
- restfulResponse = request.executeT();
- return restfulResponse.getEntity();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_response_headers.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_response_headers.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_response_headers.java
deleted file mode 100644
index 6b8da68..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_response_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;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.CacheControl;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.Header;
-import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageResource;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class HomePageResourceTest_root_response_headers {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
- private HomePageResource resource;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
- resource = client.getHomePageResource();
- }
-
-
- @Test
- public void contentType_and_cacheControl() throws Exception {
- // given
- final Response resp = resource.homePage();
-
- // when
- final RestfulResponse<HomePageRepresentation> restfulResponse = RestfulResponse.ofT(resp);
-
- // then
- final MediaType contentType = restfulResponse.getHeader(Header.CONTENT_TYPE);
- assertThat(contentType, hasType("application"));
- assertThat(contentType, hasSubType("json"));
- assertThat(contentType, hasParameter("profile", "urn:org.restfulobjects:repr-types/homepage"));
- assertThat(contentType, is(RepresentationType.HOME_PAGE.getMediaType()));
-
- // then
- final CacheControl cacheControl = restfulResponse.getHeader(Header.CACHE_CONTROL);
- assertThat(cacheControl, hasMaxAge(24 * 60 * 60));
- assertThat(cacheControl.getMaxAge(), is(24 * 60 * 60));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_response_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_response_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_response_representation.java
deleted file mode 100644
index 282165d..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_response_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;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
-import static org.hamcrest.CoreMatchers.endsWith;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status.Family;
-
-import org.apache.isis.viewer.restfulobjects.applib.Rel;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageResource;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class HomePageResourceTest_root_response_representation {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
- private HomePageResource resource;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
- resource = client.getHomePageResource();
- }
-
- @Test
- public void representation() throws Exception {
-
- // given
- final Response resp = resource.homePage();
-
- // when
- final RestfulResponse<HomePageRepresentation> restfulResponse = RestfulResponse.ofT(resp);
- assertThat(restfulResponse.getStatus().getFamily(), is(Family.SUCCESSFUL));
-
- // then
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
-
- final HomePageRepresentation repr = restfulResponse.getEntity();
- assertThat(repr, is(not(nullValue())));
- assertThat(repr, isMap());
-
- assertThat(repr.getSelf(), isLink(client)
- .rel(Rel.SELF)
- .href(endsWith(":39393/"))
- .httpMethod(RestfulHttpMethod.GET)
- .type(RepresentationType.HOME_PAGE.getMediaType())
- .returning(HttpStatusCode.OK)
- );
- assertThat(repr.getUser(), isLink(client)
- .rel(Rel.USER)
- .href(endsWith(":39393/user"))
- .httpMethod(RestfulHttpMethod.GET)
- .type(RepresentationType.USER.getMediaType())
- .returning(HttpStatusCode.OK)
- );
- assertThat(repr.getServices(), isLink(client)
- .rel(Rel.SERVICES)
- .href(endsWith(":39393/services"))
- .httpMethod(RestfulHttpMethod.GET)
- .type(RepresentationType.LIST.getMediaType())
- .returning(HttpStatusCode.OK)
- );
- assertThat(repr.getVersion(), isLink(client)
- .rel(Rel.VERSION)
- .href(endsWith(":39393/version"))
- .httpMethod(RestfulHttpMethod.GET)
- .type(RepresentationType.VERSION.getMediaType())
- .returning(HttpStatusCode.OK)
- );
-
- assertThat(repr.getLinks(), isArray());
- assertThat(repr.getExtensions(), isMap());
- }
-
-}
[10/50] [abbrv] git commit: ISIS-233-ro: more on domain service
representation
Posted by da...@apache.org.
ISIS-233-ro: more on domain service representation
... and a bit on its content-type
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/771d1ab2
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/771d1ab2
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/771d1ab2
Branch: refs/heads/master
Commit: 771d1ab201d1efd1cb779cc70532df8a9dfc81d0
Parents: 1b9a2a7
Author: Dan Haywood <da...@apache.org>
Authored: Tue Feb 26 08:26:39 2013 +0000
Committer: Dan Haywood <da...@apache.org>
Committed: Sat Apr 27 18:57:33 2013 +0100
----------------------------------------------------------------------
.../restfulobjects/applib/RepresentationType.java | 17 +++-
.../applib/client/RestfulResponse.java | 1 +
.../DomainObjectMemberRepresentation.java | 55 +++++++++
.../domainobjects/DomainObjectRepresentation.java | 57 +++++++--
.../viewer/restfulobjects/applib/util/Parser.java | 21 +++-
.../RepresentationTypeTest_getMediaType.java | 41 +++++++
...RepresentationTypeTest_getMediaType_lookup.java | 57 ---------
.../applib/RepresentationTypeTest_getName.java | 37 ++++++
.../RepresentationTypeTest_getName_lookup.java | 55 ---------
.../applib/RepresentationTypeTest_lookup.java | 72 ++++++++++++
.../applib/domainObjectRepresentation.json | 45 +++----
.../AbstractObjectMemberReprRenderer.java | 4 +-
.../domainobjects/DomainObjectReprRenderer.java | 24 +++--
.../rendering/domainobjects/MemberType.java | 14 +--
.../AbstractTypeMemberReprRenderer.java | 2 +-
.../domaintypes/ActionDescriptionReprRenderer.java | 2 +-
.../ActionParameterDescriptionReprRenderer.java | 2 +-
.../CollectionDescriptionReprRenderer.java | 2 +-
.../domaintypes/DomainTypeReprRenderer.java | 4 +-
.../PropertyDescriptionReprRenderer.java | 2 +-
.../resources/DomainServiceResourceServerside.java | 1 -
.../resources/DomainTypeResourceServerside.java | 10 +-
.../server/resources/ResourceAbstract.java | 19 +++-
...stfulObjectsApplicationExceptionMapperTest.java | 2 +-
..._serviceId_request_queryarg_xrofollowlinks.java | 20 +++
...iceResourceTest_serviceId_response_headers.java | 6 +-
...urceTest_serviceId_response_representation.java | 91 +++++++++++++--
27 files changed, 459 insertions(+), 204 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/771d1ab2/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationType.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationType.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationType.java
index 1a2a005..9ccab9c 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationType.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationType.java
@@ -125,9 +125,20 @@ public enum RepresentationType {
}
public static RepresentationType lookup(final MediaType mediaType) {
- for (final RepresentationType representationType : values()) {
- if (representationType.getMediaType().equals(mediaType)) {
- return representationType;
+ if(mediaType != null) {
+ for (final RepresentationType representationType : values()) {
+ final MediaType candidate = representationType.getMediaType();
+ if(!candidate.getType().equals(mediaType.getType())) {
+ continue;
+ }
+ if(!candidate.getSubtype().equals(mediaType.getSubtype())) {
+ continue;
+ }
+ String candidateProfile = candidate.getParameters().get("profile");
+ String mediaTypeProfile = mediaType.getParameters().get("profile");
+ if(candidateProfile == null || candidateProfile.equals(mediaTypeProfile)) {
+ return representationType;
+ }
}
}
return RepresentationType.GENERIC;
http://git-wip-us.apache.org/repos/asf/isis/blob/771d1ab2/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java
index 6c96b1e..371c34e 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java
@@ -245,6 +245,7 @@ public class RestfulResponse<T> {
public final static Header<Date> LAST_MODIFIED = new Header<Date>("Last-Modified", Parser.forDate());
public final static Header<CacheControl> CACHE_CONTROL = new Header<CacheControl>("Cache-Control", Parser.forCacheControl());
public final static Header<MediaType> CONTENT_TYPE = new Header<MediaType>("Content-Type", Parser.forJaxRsMediaType());
+ public final static Header<String> ETAG = new Header<String>("ETag", Parser.forETag());
private final String name;
private final Parser<X> parser;
http://git-wip-us.apache.org/repos/asf/isis/blob/771d1ab2/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectMemberRepresentation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectMemberRepresentation.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectMemberRepresentation.java
new file mode 100644
index 0000000..faabe18
--- /dev/null
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectMemberRepresentation.java
@@ -0,0 +1,55 @@
+/*
+ * 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.applib.domainobjects;
+
+import org.codehaus.jackson.JsonNode;
+
+/**
+ * Represents the members within the {@link DomainObjectRepresentation}'s <tt>members</tt>
+ * map.
+ *
+ * <p>
+ * Do not confuse with the subclasses of {@link AbstractObjectMemberRepresentation}, which
+ * are standalone representations in their own right.
+ */
+public class DomainObjectMemberRepresentation extends DomainRepresentation {
+
+ public DomainObjectMemberRepresentation(final JsonNode jsonNode) {
+ super(jsonNode);
+ }
+
+ /**
+ * Whether this is a <tt>property</tt>, <tt>collection</tt> or <tt>action</tt>.
+ */
+ public String getMemberType() {
+ return getString("memberType");
+ }
+
+ /**
+ * The reason this member cannot be modified (if property or collection) or
+ * invoked (if action).
+ *
+ * <p>
+ * If null, then is not disabled.
+ */
+ public String getDisabledReason() {
+ return getString("disabledReason");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/771d1ab2/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectRepresentation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectRepresentation.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectRepresentation.java
index 98e714f..bc9ee9b 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectRepresentation.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectRepresentation.java
@@ -34,38 +34,62 @@ public class DomainObjectRepresentation extends DomainRepresentation {
}
/**
- * Only for persistent or addressable objects
+ * Populated only for domain objects, not for domain services.
*/
- public String getOid() {
- return getString("oid");
+ public String getDomainType() {
+ return getString("instanceId");
+ }
+
+ /**
+ * Populated only for domain objects, not for domain services.
+ */
+ public String getInstanceId() {
+ return getString("instanceId");
+ }
+
+ /**
+ * Populated only for domain services, not for domain objects.
+ */
+ public String getServiceId() {
+ return getString("serviceId");
}
public JsonRepresentation getMembers() {
- return getRepresentation("members").ensureArray();
+ return getRepresentation("members");
}
- public JsonRepresentation getProperty(final String id) {
- return getRepresentation("members[memberType=property id=%s]", id);
+ public DomainObjectMemberRepresentation getProperty(final String id) {
+ return getMember(id, "property");
}
public JsonRepresentation getProperties() {
return getRepresentation("members[memberType=property]").ensureArray();
}
- public JsonRepresentation getCollection(final String id) {
- return getRepresentation("members[memberType=collection id=%s]", id);
+ public DomainObjectMemberRepresentation getCollection(final String id) {
+ return getMember(id, "collection");
}
public JsonRepresentation getCollections() {
return getRepresentation("members[memberType=collection]").ensureArray();
}
- public JsonRepresentation getActions() {
- return getRepresentation("members[memberType=action]");
+ public DomainObjectMemberRepresentation getAction(final String id) {
+ return getMember(id, "action");
}
- public JsonRepresentation getAction(final String id) {
- return getRepresentation("members[memberType=action id=%s]", id);
+ private DomainObjectMemberRepresentation getMember(final String id, String memberType) {
+ // TODO: would be nice to use "members.%s[memberType=...]" instead
+ JsonRepresentation jsonRepr = getRepresentation("members.%s", id);
+ if(jsonRepr == null) {
+ return null;
+ }
+ DomainObjectMemberRepresentation member = jsonRepr.as(DomainObjectMemberRepresentation.class);
+ return member.getMemberType().equals(memberType) ? member : null;
+ }
+
+ public JsonRepresentation getActions() {
+ return getRepresentation("members[memberType=action]");
}
/**
@@ -75,4 +99,13 @@ public class DomainObjectRepresentation extends DomainRepresentation {
return getLinkWithRel(Rel.PERSIST);
}
+
+ /**
+ * Isis extension.
+ */
+ public String getOid() {
+ return getString("extensions.oid");
+ }
+
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/771d1ab2/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/Parser.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/Parser.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/Parser.java
index 846e0ea..d23e821 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/Parser.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/Parser.java
@@ -20,7 +20,6 @@ package org.apache.isis.viewer.restfulobjects.applib.util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
@@ -407,4 +406,24 @@ public abstract class Parser<T> {
};
}
+ public static Parser<String> forETag() {
+ return new Parser<String>(){
+
+ private final static String WEAK_PREFIX="W/";
+
+ @Override
+ public String valueOf(String str) {
+ if(str == null) {
+ return null;
+ }
+ return null;
+ }
+
+ @Override
+ public String asString(String t) {
+ // TODO Auto-generated method stub
+ return null;
+ }};
+ }
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/771d1ab2/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getMediaType.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getMediaType.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getMediaType.java
new file mode 100644
index 0000000..4844d0b
--- /dev/null
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getMediaType.java
@@ -0,0 +1,41 @@
+/*
+ * 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.applib;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import org.junit.Test;
+
+
+public class RepresentationTypeTest_getMediaType {
+
+ @Test
+ public void whenHasProfile() {
+ assertThat(RepresentationType.GENERIC.getMediaTypeProfile(), is(nullValue()));
+ }
+
+ @Test
+ public void whenHasNoProfile() {
+ assertThat(RepresentationType.GENERIC.getMediaTypeProfile(), is(nullValue()));
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/771d1ab2/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getMediaType_lookup.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getMediaType_lookup.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getMediaType_lookup.java
deleted file mode 100644
index ae9aa2a..0000000
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getMediaType_lookup.java
+++ /dev/null
@@ -1,57 +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.applib;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.MediaType;
-
-import org.junit.Test;
-
-
-public class RepresentationTypeTest_getMediaType_lookup {
-
- @Test
- public void roundtrip() {
- for (final RepresentationType repType : RepresentationType.values()) {
- final MediaType mediaType = repType.getMediaType();
- final RepresentationType lookup = RepresentationType.lookup(mediaType);
- assertSame(repType, lookup);
- }
- }
-
- @Test
- public void whenUnknown() {
- assertThat(RepresentationType.lookup(MediaType.APPLICATION_SVG_XML), is(RepresentationType.GENERIC));
- }
-
- @Test
- public void whenNull() {
- assertThat(RepresentationType.lookup((MediaType) null), is(RepresentationType.GENERIC));
- }
-
- @Test
- public void getMediaTypeProfile() {
- assertThat(RepresentationType.VERSION.getMediaTypeProfile(), is("urn:org.restfulobjects:repr-types/version"));
- assertThat(RepresentationType.GENERIC.getMediaTypeProfile(), is(nullValue()));
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/771d1ab2/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getName.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getName.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getName.java
new file mode 100644
index 0000000..0adae4e
--- /dev/null
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getName.java
@@ -0,0 +1,37 @@
+/*
+ * 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.applib;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.junit.Test;
+
+public class RepresentationTypeTest_getName {
+
+ @Test
+ public void selectedValues() {
+ assertThat(RepresentationType.VERSION.getName(), is("version"));
+ assertThat(RepresentationType.HOME_PAGE.getName(), is("homePage"));
+ assertThat(RepresentationType.ACTION_PARAMETER_DESCRIPTION.getName(), is("actionParameterDescription"));
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/771d1ab2/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getName_lookup.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getName_lookup.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getName_lookup.java
deleted file mode 100644
index 75ef1fe..0000000
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_getName_lookup.java
+++ /dev/null
@@ -1,55 +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.applib;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThat;
-
-import org.junit.Test;
-
-public class RepresentationTypeTest_getName_lookup {
-
- @Test
- public void selectedValues() {
- assertThat(RepresentationType.VERSION.getName(), is("version"));
- assertThat(RepresentationType.HOME_PAGE.getName(), is("homePage"));
- assertThat(RepresentationType.ACTION_PARAMETER_DESCRIPTION.getName(), is("actionParameterDescription"));
- }
-
- @Test
- public void roundtrip() {
- for (final RepresentationType repType : RepresentationType.values()) {
- final String name = repType.getName();
- final RepresentationType lookup = RepresentationType.lookup(name);
- assertSame(repType, lookup);
- }
- }
-
- @Test
- public void lookup_whenUnknown() {
- assertThat(RepresentationType.lookup("foobar"), is(RepresentationType.GENERIC));
- }
-
- @Test
- public void lookup_whenNull() {
- assertThat(RepresentationType.lookup((String) null), is(RepresentationType.GENERIC));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/771d1ab2/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_lookup.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_lookup.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_lookup.java
new file mode 100644
index 0000000..d10d9b7
--- /dev/null
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationTypeTest_lookup.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.applib;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.MediaType;
+
+import org.junit.Test;
+
+
+public class RepresentationTypeTest_lookup {
+
+ @Test
+ public void roundtrip() {
+ // overloaded
+ for (final RepresentationType repType : RepresentationType.values()) {
+ final MediaType mediaType = repType.getMediaType();
+ final RepresentationType lookup = RepresentationType.lookup(mediaType);
+ assertSame(repType, lookup);
+ }
+
+ for (final RepresentationType repType : RepresentationType.values()) {
+ final String name = repType.getName();
+ final RepresentationType lookup = RepresentationType.lookup(name);
+ assertSame(repType, lookup);
+ }
+ }
+
+ @Test
+ public void whenUnknown() {
+ assertThat(RepresentationType.lookup(MediaType.APPLICATION_SVG_XML), is(RepresentationType.GENERIC));
+ assertThat(RepresentationType.lookup("foobar"), is(RepresentationType.GENERIC));
+
+ }
+
+ @Test
+ public void whenNull() {
+ assertThat(RepresentationType.lookup((MediaType) null), is(RepresentationType.GENERIC));
+ assertThat(RepresentationType.lookup((String) null), is(RepresentationType.GENERIC));
+ }
+
+ @Test
+ public void whenDomainObjectWithXRoParameter() {
+ MediaType toLookup = RepresentationType.DOMAIN_OBJECT.getMediaType("x-ro-domain-type", "http://mycompany.com:39393/domain-types/JdkValuedEntities");
+ // ignores the parameter.
+ assertThat(
+ RepresentationType.lookup(toLookup), is(RepresentationType.DOMAIN_OBJECT));
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/771d1ab2/component/viewer/restfulobjects/applib/src/test/resources/org/apache/isis/viewer/restfulobjects/applib/domainObjectRepresentation.json
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/resources/org/apache/isis/viewer/restfulobjects/applib/domainObjectRepresentation.json b/component/viewer/restfulobjects/applib/src/test/resources/org/apache/isis/viewer/restfulobjects/applib/domainObjectRepresentation.json
index f9ffb60..249d389 100644
--- a/component/viewer/restfulobjects/applib/src/test/resources/org/apache/isis/viewer/restfulobjects/applib/domainObjectRepresentation.json
+++ b/component/viewer/restfulobjects/applib/src/test/resources/org/apache/isis/viewer/restfulobjects/applib/domainObjectRepresentation.json
@@ -1,9 +1,10 @@
{
- "oid": "OID:25",
+ "domainType": "Simple",
+ "instanceId": "25",
"title": "Untitled Simple Entity",
- "members": [
- {
- "id": "ABigDecimal",
+
+ "members": {
+ "ABigDecimal": {
"memberType": "property",
"details": {
"rel": "details",
@@ -21,8 +22,7 @@
}
]
},
- {
- "id": "ABigInteger",
+ "ABigInteger": {
"memberType": "property",
"details": {
"rel": "details",
@@ -40,8 +40,7 @@
}
]
},
- {
- "id": "ADouble",
+ "ADouble": {
"memberType": "property",
"details": {
"rel": "details",
@@ -60,8 +59,7 @@
}
]
},
- {
- "id": "ALong",
+ "ALong": {
"memberType": "property",
"details": {
"rel": "details",
@@ -80,8 +78,7 @@
}
]
},
- {
- "id": "anInt",
+ "anInt": {
"memberType": "property",
"details": {
"rel": "details",
@@ -100,8 +97,7 @@
}
]
},
- {
- "id": "anotherDouble",
+ "anotherDouble": {
"memberType": "property",
"details": {
"rel": "details",
@@ -119,8 +115,7 @@
}
]
},
- {
- "id": "anotherInt",
+ "anotherInt": {
"memberType": "property",
"details": {
"rel": "details",
@@ -138,8 +133,7 @@
}
]
},
- {
- "id": "anotherLong",
+ "anotherLong": {
"memberType": "property",
"details": {
"rel": "details",
@@ -157,8 +151,7 @@
}
]
},
- {
- "id": "flag",
+ "flag": {
"memberType": "property",
"details": {
"rel": "details",
@@ -177,8 +170,7 @@
}
]
},
- {
- "id": "name",
+ "name": {
"memberType": "property",
"details": {
"rel": "details",
@@ -197,8 +189,7 @@
}
]
},
- {
- "id": "toggle",
+ "toggle": {
"memberType": "action",
"details": {
"rel": "details",
@@ -225,7 +216,7 @@
}
]
}
- ],
+ },
"links": [
{
"rel": "describedby",
@@ -234,5 +225,7 @@
"type": "application/json;profile=\"urn:org.restfulobjects/domaintype\""
}
],
- "extensions": {}
+ "extensions": {
+ "oid": "Simple:25"
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/771d1ab2/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/AbstractObjectMemberReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/AbstractObjectMemberReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/AbstractObjectMemberReprRenderer.java
index 47357d4..63ea8c7 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/AbstractObjectMemberReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/AbstractObjectMemberReprRenderer.java
@@ -80,7 +80,9 @@ public abstract class AbstractObjectMemberReprRenderer<R extends ReprRendererAbs
usingLinkTo(new DomainObjectLinkTo());
// done eagerly so can use as criteria for x-ro-follow-links
- representation.mapPut(memberType.getJsProp(), objectMember.getId());
+ if(!mode.isInline()) {
+ representation.mapPut("id", objectMember.getId());
+ }
representation.mapPut("memberType", memberType.getName());
return cast(this);
http://git-wip-us.apache.org/repos/asf/isis/blob/771d1ab2/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java
index e8e8454..ba00775 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java
@@ -43,6 +43,7 @@ import org.apache.isis.viewer.restfulobjects.rendering.RendererContext;
import org.apache.isis.viewer.restfulobjects.rendering.ReprRendererAbstract;
import org.apache.isis.viewer.restfulobjects.rendering.domaintypes.DomainTypeReprRenderer;
import org.apache.isis.viewer.restfulobjects.rendering.util.OidUtils;
+import org.hamcrest.core.IsSame;
public class DomainObjectReprRenderer extends ReprRendererAbstract<DomainObjectReprRenderer, ObjectAdapter> {
@@ -106,7 +107,8 @@ public class DomainObjectReprRenderer extends ReprRendererAbstract<DomainObjectR
@Override
public DomainObjectReprRenderer with(final ObjectAdapter objectAdapter) {
this.objectAdapter = objectAdapter;
- addMediaTypeParams(X_RO_DOMAIN_TYPE, objectAdapter.getSpecification().getFullIdentifier());
+ String domainTypeHref = DomainTypeReprRenderer.newLinkToBuilder(getRendererContext(), Rel.DOMAIN_TYPE, objectAdapter.getSpecification()).build().getString("href");
+ addMediaTypeParams(X_RO_DOMAIN_TYPE, domainTypeHref);
return this;
}
@@ -114,14 +116,14 @@ public class DomainObjectReprRenderer extends ReprRendererAbstract<DomainObjectR
@Override
public JsonRepresentation render() {
- // self, oid
+ // self, extensions.oid
if (!mode.representsArguments()) {
if (objectAdapter.representsPersistent()) {
if (includesSelf) {
final JsonRepresentation self = linkToBuilder.with(objectAdapter).builder(Rel.SELF).build();
getLinks().arrayAdd(self);
}
- representation.mapPut("oid", getOidStr());
+ getExtensions().mapPut("oid", getOidStr());
}
}
@@ -151,7 +153,7 @@ public class DomainObjectReprRenderer extends ReprRendererAbstract<DomainObjectR
if (!mode.representsArguments()) {
// update/persist
addPersistLinkIfTransientAndPersistable();
- addUpdatePropertiesLinkIfPersistent();
+ addUpdatePropertiesLinkIfPersistentAndNotService();
// extensions
final boolean isService = objectAdapter.getSpecification().isService();
@@ -175,7 +177,7 @@ public class DomainObjectReprRenderer extends ReprRendererAbstract<DomainObjectR
}
private DomainObjectReprRenderer withMembers(final ObjectAdapter objectAdapter) {
- final JsonRepresentation members = JsonRepresentation.newArray();
+ final JsonRepresentation members = JsonRepresentation.newMap();
final List<ObjectAssociation> associations = objectAdapter.getSpecification().getAssociations();
addAssociations(objectAdapter, members, associations);
@@ -208,7 +210,7 @@ public class DomainObjectReprRenderer extends ReprRendererAbstract<DomainObjectR
renderer.asArguments();
}
- members.arrayAdd(renderer.render());
+ members.mapPut(assoc.getId(), renderer.render());
}
if (mode.representsArguments()) {
@@ -222,7 +224,7 @@ public class DomainObjectReprRenderer extends ReprRendererAbstract<DomainObjectR
renderer.with(new ObjectAndCollection(objectAdapter, collection)).usingLinkTo(linkToBuilder);
- members.arrayAdd(renderer.render());
+ members.mapPut(assoc.getId(), renderer.render());
}
}
}
@@ -245,7 +247,7 @@ public class DomainObjectReprRenderer extends ReprRendererAbstract<DomainObjectR
renderer.with(new ObjectAndAction(objectAdapter, action)).usingLinkTo(linkToBuilder);
- members.arrayAdd(renderer.render());
+ members.mapPut(action.getId(), renderer.render());
}
}
}
@@ -282,10 +284,14 @@ public class DomainObjectReprRenderer extends ReprRendererAbstract<DomainObjectR
}
- private void addUpdatePropertiesLinkIfPersistent() {
+ private void addUpdatePropertiesLinkIfPersistentAndNotService() {
if (!objectAdapter.representsPersistent()) {
return;
}
+ final boolean isService = objectAdapter.getSpecification().isService();
+ if(isService) {
+ return;
+ }
final DomainObjectReprRenderer renderer = new DomainObjectReprRenderer(getRendererContext(), null, JsonRepresentation.newMap());
final JsonRepresentation domainObjectRepr = renderer.with(objectAdapter).asModifyPropertiesLinkArguments().render();
http://git-wip-us.apache.org/repos/asf/isis/blob/771d1ab2/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/MemberType.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/MemberType.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/MemberType.java
index 0d21d6f..dd154be 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/MemberType.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/MemberType.java
@@ -43,7 +43,7 @@ import com.google.common.collect.ImmutableMap;
public enum MemberType {
- PROPERTY("properties/", "id", RepresentationType.OBJECT_PROPERTY, ImmutableMap.of("modify", MutatorSpec.of(Rel.MODIFY, PropertyValidateFacet.class, PropertySetterFacet.class, RestfulHttpMethod.PUT, BodyArgs.ONE), "clear",
+ PROPERTY("properties/", RepresentationType.OBJECT_PROPERTY, ImmutableMap.of("modify", MutatorSpec.of(Rel.MODIFY, PropertyValidateFacet.class, PropertySetterFacet.class, RestfulHttpMethod.PUT, BodyArgs.ONE), "clear",
MutatorSpec.of(Rel.CLEAR, PropertyValidateFacet.class, PropertyClearFacet.class, RestfulHttpMethod.DELETE, BodyArgs.NONE))) {
@Override
public ObjectSpecification specFor(final ObjectMember objectMember) {
@@ -54,7 +54,7 @@ public enum MemberType {
* {@link #getMutators()} are keyed by
* {@link CollectionSemantics#getAddToKey()}
*/
- COLLECTION("collections/", "id", RepresentationType.OBJECT_COLLECTION, ImmutableMap.of("addToSet", MutatorSpec.of(Rel.ADD_TO, CollectionValidateAddToFacet.class, CollectionAddToFacet.class, RestfulHttpMethod.PUT, BodyArgs.ONE), "addToList",
+ COLLECTION("collections/", RepresentationType.OBJECT_COLLECTION, ImmutableMap.of("addToSet", MutatorSpec.of(Rel.ADD_TO, CollectionValidateAddToFacet.class, CollectionAddToFacet.class, RestfulHttpMethod.PUT, BodyArgs.ONE), "addToList",
MutatorSpec.of(Rel.ADD_TO, CollectionValidateAddToFacet.class, CollectionAddToFacet.class, RestfulHttpMethod.POST, BodyArgs.ONE), "removeFrom", MutatorSpec.of(Rel.REMOVE_FROM, CollectionValidateRemoveFromFacet.class, CollectionRemoveFromFacet.class, RestfulHttpMethod.DELETE, BodyArgs.ONE))) {
@Override
public ObjectSpecification specFor(final ObjectMember objectMember) {
@@ -65,7 +65,7 @@ public enum MemberType {
* {@link #getMutators()} are keyed by
* {@link ActionSemantics#getInvokeKey()}
*/
- ACTION("actions/", "id", RepresentationType.ACTION_RESULT, ImmutableMap.of("invokeQueryOnly", MutatorSpec.of(Rel.INVOKE, ActionValidationFacet.class, ActionInvocationFacet.class, RestfulHttpMethod.GET, BodyArgs.MANY, "invoke"), "invokeIdempotent",
+ ACTION("actions/", RepresentationType.ACTION_RESULT, ImmutableMap.of("invokeQueryOnly", MutatorSpec.of(Rel.INVOKE, ActionValidationFacet.class, ActionInvocationFacet.class, RestfulHttpMethod.GET, BodyArgs.MANY, "invoke"), "invokeIdempotent",
MutatorSpec.of(Rel.INVOKE, ActionValidationFacet.class, ActionInvocationFacet.class, RestfulHttpMethod.PUT, BodyArgs.MANY, "invoke"), "invoke", MutatorSpec.of(Rel.INVOKE, ActionValidationFacet.class, ActionInvocationFacet.class, RestfulHttpMethod.POST, BodyArgs.MANY, "invoke"))) {
@Override
public ObjectSpecification specFor(final ObjectMember objectMember) {
@@ -75,24 +75,18 @@ public enum MemberType {
};
private final String urlPart;
- private final String jsProp;
private final String name;
private final RepresentationType representationType;
private final Map<String, MutatorSpec> mutators;
- private MemberType(final String urlPart, final String jsProp, final RepresentationType representationType, final Map<String, MutatorSpec> mutators) {
+ private MemberType(final String urlPart, final RepresentationType representationType, final Map<String, MutatorSpec> mutators) {
this.urlPart = urlPart;
- this.jsProp = jsProp;
this.representationType = representationType;
this.mutators = mutators;
name = Enums.enumToCamelCase(this);
}
- public String getJsProp() {
- return jsProp;
- }
-
public String getUrlPart() {
return urlPart;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/771d1ab2/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/AbstractTypeMemberReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/AbstractTypeMemberReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/AbstractTypeMemberReprRenderer.java
index b449ddf..70ec60a 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/AbstractTypeMemberReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/AbstractTypeMemberReprRenderer.java
@@ -49,7 +49,7 @@ public abstract class AbstractTypeMemberReprRenderer<R extends ReprRendererAbstr
memberType = MemberType.determineFrom(objectFeature);
// done eagerly so can use as criteria for x-ro-follow-links
- representation.mapPut(memberType.getJsProp(), objectFeature.getId());
+ representation.mapPut("id", objectFeature.getId());
representation.mapPut("memberType", memberType.getName());
return cast(this);
http://git-wip-us.apache.org/repos/asf/isis/blob/771d1ab2/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/ActionDescriptionReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/ActionDescriptionReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/ActionDescriptionReprRenderer.java
index 87ca4c2..8227c88 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/ActionDescriptionReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/ActionDescriptionReprRenderer.java
@@ -34,7 +34,7 @@ public class ActionDescriptionReprRenderer extends AbstractTypeMemberReprRendere
public static LinkBuilder newLinkToBuilder(final RendererContext resourceContext, final Rel rel, final ObjectSpecification objectSpecification, final ObjectAction objectAction) {
final String typeFullName = objectSpecification.getFullIdentifier();
final String actionId = objectAction.getId();
- final String url = "domainTypes/" + typeFullName + "/actions/" + actionId;
+ final String url = "domain-types/" + typeFullName + "/actions/" + actionId;
return LinkBuilder.newBuilder(resourceContext, rel.getName(), RepresentationType.ACTION_DESCRIPTION, url);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/771d1ab2/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/ActionParameterDescriptionReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/ActionParameterDescriptionReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/ActionParameterDescriptionReprRenderer.java
index 333935b..b703b4d 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/ActionParameterDescriptionReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/ActionParameterDescriptionReprRenderer.java
@@ -34,7 +34,7 @@ public class ActionParameterDescriptionReprRenderer extends AbstractTypeFeatureR
final ObjectAction objectAction = objectActionParameter.getAction();
final String actionId = objectAction.getId();
final String paramName = objectActionParameter.getName();
- final String url = String.format("domainTypes/%s/actions/%s/params/%s", typeFullName, actionId, paramName);
+ final String url = String.format("domain-types/%s/actions/%s/params/%s", typeFullName, actionId, paramName);
return LinkBuilder.newBuilder(resourceContext, rel.andParam("id", deriveId(objectActionParameter)), RepresentationType.ACTION_PARAMETER_DESCRIPTION, url);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/771d1ab2/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/CollectionDescriptionReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/CollectionDescriptionReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/CollectionDescriptionReprRenderer.java
index e89b2fe..46e4eaf 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/CollectionDescriptionReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/CollectionDescriptionReprRenderer.java
@@ -30,7 +30,7 @@ public class CollectionDescriptionReprRenderer extends AbstractTypeMemberReprRen
public static LinkBuilder newLinkToBuilder(final RendererContext resourceContext, final Rel rel, final ObjectSpecification objectSpecification, final OneToManyAssociation collection) {
final String typeFullName = objectSpecification.getFullIdentifier();
final String collectionId = collection.getId();
- final String url = "domainTypes/" + typeFullName + "/collections/" + collectionId;
+ final String url = "domain-types/" + typeFullName + "/collections/" + collectionId;
return LinkBuilder.newBuilder(resourceContext, rel.getName(), RepresentationType.COLLECTION_DESCRIPTION, url);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/771d1ab2/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/DomainTypeReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/DomainTypeReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/DomainTypeReprRenderer.java
index c2e96ef..e36f82b 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/DomainTypeReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/DomainTypeReprRenderer.java
@@ -38,8 +38,8 @@ import com.google.common.base.Strings;
public class DomainTypeReprRenderer extends ReprRendererAbstract<DomainTypeReprRenderer, ObjectSpecification> {
public static LinkBuilder newLinkToBuilder(final RendererContext resourceContext, final Rel rel, final ObjectSpecification objectSpec) {
- final String typeFullName = objectSpec.getFullIdentifier();
- final String url = "domainTypes/" + typeFullName;
+ final String typeFullName = objectSpec.getSpecId().asString();
+ final String url = "domain-types/" + typeFullName;
return LinkBuilder.newBuilder(resourceContext, rel.getName(), RepresentationType.DOMAIN_TYPE, url);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/771d1ab2/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/PropertyDescriptionReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/PropertyDescriptionReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/PropertyDescriptionReprRenderer.java
index 6e0ca01..da6494b 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/PropertyDescriptionReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/PropertyDescriptionReprRenderer.java
@@ -31,7 +31,7 @@ public class PropertyDescriptionReprRenderer extends AbstractTypeMemberReprRende
public static LinkBuilder newLinkToBuilder(final RendererContext resourceContext, final Rel rel, final ObjectSpecification objectSpecification, final OneToOneAssociation property) {
final String typeFullName = objectSpecification.getFullIdentifier();
final String propertyId = property.getId();
- final String url = "domainTypes/" + typeFullName + "/properties/" + propertyId;
+ final String url = "domain-types/" + typeFullName + "/properties/" + propertyId;
return LinkBuilder.newBuilder(resourceContext, rel.getName(), RepresentationType.PROPERTY_DESCRIPTION, url);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/771d1ab2/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java
index 9913481..f9e4e47 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java
@@ -51,7 +51,6 @@ public class DomainServiceResourceServerside extends ResourceAbstract implements
@Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_LIST, RestfulMediaType.APPLICATION_JSON_ERROR })
public Response services() {
init(RepresentationType.LIST, Where.STANDALONE_TABLES);
-
final List<ObjectAdapter> serviceAdapters = getResourceContext().getServiceAdapters();
http://git-wip-us.apache.org/repos/asf/isis/blob/771d1ab2/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainTypeResourceServerside.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainTypeResourceServerside.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainTypeResourceServerside.java
index 4bfcbef..0c8824b 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainTypeResourceServerside.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainTypeResourceServerside.java
@@ -29,7 +29,6 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.metamodel.spec.ObjectSpecification;
import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
@@ -43,8 +42,6 @@ import org.apache.isis.viewer.restfulobjects.applib.RestfulMediaType;
import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
import org.apache.isis.viewer.restfulobjects.applib.domaintypes.DomainTypeResource;
import org.apache.isis.viewer.restfulobjects.rendering.LinkBuilder;
-import org.apache.isis.viewer.restfulobjects.rendering.RendererFactory;
-import org.apache.isis.viewer.restfulobjects.rendering.domainobjects.DomainObjectReprRenderer;
import org.apache.isis.viewer.restfulobjects.rendering.domaintypes.ActionDescriptionReprRenderer;
import org.apache.isis.viewer.restfulobjects.rendering.domaintypes.ActionParameterDescriptionReprRenderer;
import org.apache.isis.viewer.restfulobjects.rendering.domaintypes.CollectionDescriptionReprRenderer;
@@ -58,7 +55,6 @@ import org.apache.isis.viewer.restfulobjects.rendering.domaintypes.TypeActionRes
import org.apache.isis.viewer.restfulobjects.rendering.domaintypes.TypeListReprRenderer;
import org.apache.isis.viewer.restfulobjects.server.RestfulObjectsApplicationException;
import org.apache.isis.viewer.restfulobjects.server.util.UrlParserUtils;
-import org.jboss.resteasy.annotations.ClientResponseType;
import com.google.common.base.Strings;
@@ -67,7 +63,7 @@ import com.google.common.base.Strings;
* with {@link Path} rather than the interface (at least under RestEasy 1.0.2
* and 1.1-RC2).
*/
-@Path("/domainTypes")
+@Path("/domain-types")
public class DomainTypeResourceServerside extends ResourceAbstract implements DomainTypeResource {
@Override
@@ -210,7 +206,7 @@ public class DomainTypeResourceServerside extends ResourceAbstract implements Do
@Override
@GET
- @Path("/{domainType}/typeactions/isSubtypeOf/invoke")
+ @Path("/{domainType}/type-actions/isSubtypeOf/invoke")
@Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_TYPE_ACTION_RESULT, RestfulMediaType.APPLICATION_JSON_ERROR })
public Response domainTypeIsSubtypeOf(
@PathParam("domainType") final String domainType,
@@ -240,7 +236,7 @@ public class DomainTypeResourceServerside extends ResourceAbstract implements Do
@Override
@GET
- @Path("/{domainType}/typeactions/isSupertypeOf/invoke")
+ @Path("/{domainType}/type-actions/isSupertypeOf/invoke")
@Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_TYPE_ACTION_RESULT, RestfulMediaType.APPLICATION_JSON_ERROR })
public Response domainTypeIsSupertypeOf(
@PathParam("domainType") final String domainType,
http://git-wip-us.apache.org/repos/asf/isis/blob/771d1ab2/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java
index 5d1e6fb..248f408 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java
@@ -19,13 +19,17 @@
package org.apache.isis.viewer.restfulobjects.server.resources;
import java.io.IOException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
+import java.util.TimeZone;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.core.CacheControl;
import javax.ws.rs.core.Context;
+import javax.ws.rs.core.EntityTag;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Request;
@@ -62,6 +66,7 @@ import org.codehaus.jackson.map.JsonMappingException;
public abstract class ResourceAbstract {
+
protected final static JsonMapper jsonMapper = JsonMapper.instance();
public enum Caching {
@@ -86,6 +91,7 @@ public abstract class ResourceAbstract {
// nb: SET is excluded; we simply flatten contributed actions.
public final static ActionType[] ACTION_TYPES = { ActionType.USER, ActionType.DEBUG, ActionType.EXPLORATION };
+ private final static String UTC_DATEFORMAT = "yyyy-MM-ddTHH:mm:ss.sss";
@Context
HttpHeaders httpHeaders;
@@ -204,11 +210,18 @@ public abstract class ResourceAbstract {
if (version != null && version.getTime() != null) {
final Date time = version.getTime();
responseBuilder.lastModified(time);
- responseBuilder.tag("" + time);
+ responseBuilder.tag(asETag(time));
}
return responseBuilder;
}
+ private static EntityTag asETag(final Date time) {
+ final SimpleDateFormat sdf = new SimpleDateFormat(UTC_DATEFORMAT);
+ sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
+ final String utcTime = sdf.format(time);
+ return new EntityTag(utcTime, true);
+ }
+
// //////////////////////////////////////////////////////////////
// Dependencies (from singletons)
// //////////////////////////////////////////////////////////////
@@ -233,10 +246,6 @@ public abstract class ResourceAbstract {
return IsisContext.getPersistenceSession();
}
- private OidGenerator getOidGenerator() {
- return getPersistenceSession().getOidGenerator();
- }
-
protected Localization getLocalization() {
return IsisContext.getLocalization();
}
http://git-wip-us.apache.org/repos/asf/isis/blob/771d1ab2/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapperTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapperTest.java b/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapperTest.java
index d058e3d..a94d987 100644
--- a/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapperTest.java
+++ b/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapperTest.java
@@ -77,7 +77,7 @@ public class RestfulObjectsApplicationExceptionMapperTest {
final Response response = exceptionMapper.toResponse(ex);
// then
- assertThat((String) response.getMetadata().get("Warning").get(0), is(ex.getMessage()));
+ assertThat((String) response.getMetadata().get("Warning").get(0), is("199 RestfulObjects " + ex.getMessage()));
// and then
final String entity = (String) response.getEntity();
http://git-wip-us.apache.org/repos/asf/isis/blob/771d1ab2/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrofollowlinks.java
index e354fe7..d53619c 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrofollowlinks.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrofollowlinks.java
@@ -88,6 +88,26 @@ public class DomainServiceResourceTest_serviceId_request_queryarg_xrofollowlinks
// followed
}
+ @Ignore("todo")
+ @Test
+ public void toSelf() throws Exception {
+
+ }
+
+ @Ignore("todo")
+ @Test
+ public void toDescribedBy() throws Exception {
+
+ }
+
+ @Ignore("todo")
+ @Test
+ public void toMembers() throws Exception {
+
+ // no need to do an individual member, that's been tested already elsewhere
+ }
+
+
private String givenHrefToService(final String serviceId) throws JsonParseException, JsonMappingException, IOException {
final DomainServiceResource resource = client.getDomainServiceResource();
final Response response = resource.services();
http://git-wip-us.apache.org/repos/asf/isis/blob/771d1ab2/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_headers.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_headers.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_headers.java
index bdac603..1a943fd 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_headers.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_headers.java
@@ -19,6 +19,7 @@
package org.apache.isis.viewer.restfulobjects.tck.domainservice;
import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
import javax.ws.rs.core.Response;
@@ -57,10 +58,13 @@ public class DomainServiceResourceTest_serviceId_response_headers {
// when
final RestfulResponse<DomainObjectRepresentation> jsonResp = RestfulResponse.ofT(resp);
+
// then
assertThat(jsonResp.getStatus(), is(HttpStatusCode.OK));
- assertThat(jsonResp.getHeader(RestfulResponse.Header.CONTENT_TYPE), is(RepresentationType.DOMAIN_OBJECT.getMediaType("x-ro-domain-type", "org.apache.isis.core.tck.dom.scalars.JdkValuedEntityRepository")));
+ assertThat(jsonResp.getHeader(RestfulResponse.Header.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/771d1ab2/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_representation.java
index 107c048..2b77339 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_representation.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_representation.java
@@ -23,15 +23,20 @@ import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.a
import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.CoreMatchers.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.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;
@@ -55,12 +60,11 @@ public class DomainServiceResourceTest_serviceId_response_representation {
resource = client.getDomainServiceResource();
}
- @Ignore("todo... the service Id is wrong")
@Test
public void representation() throws Exception {
// given
- final Response resp = resource.service("simples");
+ final Response resp = resource.service("JdkValuedEntities");
// when
final RestfulResponse<DomainObjectRepresentation> jsonResp = RestfulResponse.ofT(resp);
@@ -72,16 +76,87 @@ public class DomainServiceResourceTest_serviceId_response_representation {
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.getOid(), matches("OID[:].+"));
- assertThat(repr.getTitle(), matches("Simples"));
-
- assertThat(repr.getMembers(), isArray());
-
+
+ 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(3));
+ 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(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"));
+ }
+
+ @Ignore("todo - factored out since failing")
+ @Test
+ public void link_describedBy() throws Exception {
+
+ // given
+ final Response resp = resource.service("JdkValuedEntities");
+
+ // when
+ final RestfulResponse<DomainObjectRepresentation> jsonResp = RestfulResponse.ofT(resp);
+ final DomainObjectRepresentation repr = jsonResp.getEntity();
+
+ // then
+ LinkRepresentation describedByLink = repr.getLinkWithRel(Rel.DESCRIBEDBY);
+ assertThat(describedByLink, isLink(client)
+ .returning(HttpStatusCode.OK)
+ .responseEntityWithSelfHref(describedByLink.getHref()));
+
+ }
+
+ @Ignore("todo")
+ @Test
+ public void disabledAction() throws Exception {
+
+
+ // has a disabledRead
+
+ }
+
+ @Ignore("todo")
+ @Test
+ public void nonExistentAction() throws Exception {
+
+
+ // eg...
+ // DomainObjectMemberRepresentation listMemberRepr = repr.getAction("foobar");
+
}
[20/50] [abbrv] ISIS-233: more testing on actions
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/AdapterManager.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/AdapterManager.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/AdapterManager.java
index d561f67..6866dbc 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/AdapterManager.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/AdapterManager.java
@@ -28,6 +28,7 @@ import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
import org.apache.isis.core.metamodel.spec.ObjectSpecification;
import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
+import org.apache.isis.core.runtime.persistence.ObjectNotFoundException;
/**
* Responsible for managing the {@link ObjectAdapter adapter}s and {@link Oid
@@ -113,7 +114,9 @@ public interface AdapterManager extends Injectable {
* The {@link ConcurrencyChecking} parameter determines whether concurrency checking is performed.
* If it is requested, then a check is made to ensure that the {@link Oid#getVersion() version}
* of the {@link TypedOid oid} of the recreated adapter is the same as that of the provided {@link TypedOid oid}.
- * If the version differs, then a {@link ConcurrencyException} is thrown.
+ * If the version differs, then a {@link ConcurrencyException} is thrown.
+ *
+ * @throws {@link ObjectNotFoundException} if the object does not exist.
*/
ObjectAdapter adapterFor(TypedOid oid, ConcurrencyChecking concurrencyChecking);
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/core/metamodel/src/main/java/org/apache/isis/core/runtime/persistence/ObjectNotFoundException.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/runtime/persistence/ObjectNotFoundException.java b/core/metamodel/src/main/java/org/apache/isis/core/runtime/persistence/ObjectNotFoundException.java
new file mode 100644
index 0000000..47cee58
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/runtime/persistence/ObjectNotFoundException.java
@@ -0,0 +1,42 @@
+/*
+ * 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.core.runtime.persistence;
+
+import org.apache.isis.core.metamodel.adapter.oid.Oid;
+
+public class ObjectNotFoundException extends ObjectPersistenceException {
+ private static final long serialVersionUID = 1L;
+
+ public ObjectNotFoundException() {
+ super();
+ }
+
+ public ObjectNotFoundException(final Oid oid) {
+ super("Object not found in store with oid " + oid);
+ }
+
+ public ObjectNotFoundException(final Oid oid, final Throwable cause) {
+ super("Object not found in store with oid " + oid, cause);
+ }
+
+ public ObjectNotFoundException(final String s) {
+ super(s);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/core/metamodel/src/main/java/org/apache/isis/core/runtime/persistence/ObjectPersistenceException.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/runtime/persistence/ObjectPersistenceException.java b/core/metamodel/src/main/java/org/apache/isis/core/runtime/persistence/ObjectPersistenceException.java
new file mode 100644
index 0000000..99f0593
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/runtime/persistence/ObjectPersistenceException.java
@@ -0,0 +1,42 @@
+/*
+ * 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.core.runtime.persistence;
+
+import org.apache.isis.core.commons.exceptions.IsisException;
+
+public class ObjectPersistenceException extends IsisException {
+ private static final long serialVersionUID = 1L;
+
+ public ObjectPersistenceException() {
+ super();
+ }
+
+ public ObjectPersistenceException(final String message) {
+ super(message);
+ }
+
+ public ObjectPersistenceException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+ public ObjectPersistenceException(final Throwable cause) {
+ super(cause);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/ObjectNotFoundException.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/ObjectNotFoundException.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/ObjectNotFoundException.java
deleted file mode 100644
index 47cee58..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/ObjectNotFoundException.java
+++ /dev/null
@@ -1,42 +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.core.runtime.persistence;
-
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-
-public class ObjectNotFoundException extends ObjectPersistenceException {
- private static final long serialVersionUID = 1L;
-
- public ObjectNotFoundException() {
- super();
- }
-
- public ObjectNotFoundException(final Oid oid) {
- super("Object not found in store with oid " + oid);
- }
-
- public ObjectNotFoundException(final Oid oid, final Throwable cause) {
- super("Object not found in store with oid " + oid, cause);
- }
-
- public ObjectNotFoundException(final String s) {
- super(s);
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/ObjectPersistenceException.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/ObjectPersistenceException.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/ObjectPersistenceException.java
deleted file mode 100644
index 99f0593..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/ObjectPersistenceException.java
+++ /dev/null
@@ -1,42 +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.core.runtime.persistence;
-
-import org.apache.isis.core.commons.exceptions.IsisException;
-
-public class ObjectPersistenceException extends IsisException {
- private static final long serialVersionUID = 1L;
-
- public ObjectPersistenceException() {
- super();
- }
-
- public ObjectPersistenceException(final String message) {
- super(message);
- }
-
- public ObjectPersistenceException(final String message, final Throwable cause) {
- super(message, cause);
- }
-
- public ObjectPersistenceException(final Throwable cause) {
- super(cause);
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault.java
index 9f1b083..a8be449 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault.java
@@ -58,6 +58,7 @@ import org.apache.isis.core.metamodel.spec.ObjectSpecification;
import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
+import org.apache.isis.core.runtime.persistence.ObjectNotFoundException;
import org.apache.isis.core.runtime.system.context.IsisContext;
import org.apache.isis.core.runtime.system.persistence.AdapterManagerSpi;
import org.apache.isis.core.runtime.system.persistence.OidGenerator;
@@ -296,8 +297,12 @@ public class AdapterManagerDefault implements AdapterManagerSpi {
ObjectAdapter adapter = getAdapterFor(typedOid);
if (adapter == null) {
// else recreate
- final Object pojo = pojoRecreator.recreatePojo(typedOid);
- adapter = mapRecreatedPojo(typedOid, pojo);
+ try {
+ final Object pojo = pojoRecreator.recreatePojo(typedOid);
+ adapter = mapRecreatedPojo(typedOid, pojo);
+ } catch(RuntimeException ex) {
+ throw new ObjectNotFoundException(typedOid, ex);
+ }
}
// sync versions of original, with concurrency checking if required
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java
----------------------------------------------------------------------
diff --git a/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java
index 88c2b9a..b14a73f 100644
--- a/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java
+++ b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java
@@ -46,7 +46,6 @@ public class ActionsEntityRepository extends AbstractEntityRepository<ActionsEnt
return this.firstMatch(query);
}
-
@ActionSemantics(Of.SAFE)
@MemberOrder(sequence = "1")
public List<ActionsEntity> subList(@Named("from") int from, @Named("to") int to) {
@@ -56,7 +55,11 @@ public class ActionsEntityRepository extends AbstractEntityRepository<ActionsEnt
return list.subList(fromChecked, toChecked);
}
-
-
+ @ActionSemantics(Of.SAFE)
+ @MemberOrder(sequence = "1")
+ public boolean contains(@Named("searchFor") ActionsEntity entity, @Named("from") int from, @Named("to") int to) {
+ List<ActionsEntity> list = subList(from, to);
+ return list.contains(entity);
+ }
}
[18/50] [abbrv] git commit: ISIS-233: starting to test service action
invoke.
Posted by da...@apache.org.
ISIS-233: starting to test service action invoke.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/8c3c71a6
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/8c3c71a6
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/8c3c71a6
Branch: refs/heads/master
Commit: 8c3c71a6cae6d59acc3a70c3ef3ff2d14c59bb54
Parents: c0e6f1d
Author: Dan Haywood <da...@apache.org>
Authored: Wed Mar 6 00:35:56 2013 +0000
Committer: Dan Haywood <da...@apache.org>
Committed: Sat Apr 27 18:57:42 2013 +0100
----------------------------------------------------------------------
.../restfulobjects/applib/JsonRepresentation.java | 31 +++++
.../domainobjects/ObjectActionRepresentation.java | 3 +-
.../restfulobjects/tck/RepresentationMatchers.java | 14 ++
.../isis/viewer/restfulobjects/tck/Util.java | 79 ++++++++++++
.../DomainServiceTest_req_header_accept.java | 1 +
...ainServiceTest_req_queryarg_xrodomainmodel.java | 1 +
...ainServiceTest_req_queryarg_xrofollowlinks.java | 13 +--
.../DomainServiceTest_resp_representation.java | 3 -
.../tck/domainservice/serviceId/Util.java | 49 -------
.../invoke/DomainServiceTest_action_invoke.java | 98 +++++++++++++++
.../DomainServiceTest_invoke_TOREFACTOR.java | 21 +---
11 files changed, 230 insertions(+), 83 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/8c3c71a6/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java
index 1efc2ea..17c0cad 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java
@@ -1121,6 +1121,36 @@ public class JsonRepresentation {
return buf.toString();
}
+
+ // ///////////////////////////////////////////////////////////////////////
+ // equals and hashcode
+ // ///////////////////////////////////////////////////////////////////////
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((jsonNode == null) ? 0 : jsonNode.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ JsonRepresentation other = (JsonRepresentation) obj;
+ if (jsonNode == null) {
+ if (other.jsonNode != null)
+ return false;
+ } else if (!jsonNode.equals(other.jsonNode))
+ return false;
+ return true;
+ }
+
// ///////////////////////////////////////////////////////////////////////
// toString
// ///////////////////////////////////////////////////////////////////////
@@ -1130,4 +1160,5 @@ public class JsonRepresentation {
return jsonNode.toString();
}
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/8c3c71a6/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/ObjectActionRepresentation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/ObjectActionRepresentation.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/ObjectActionRepresentation.java
index 019adb0..54af825 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/ObjectActionRepresentation.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/ObjectActionRepresentation.java
@@ -19,6 +19,7 @@
package org.apache.isis.viewer.restfulobjects.applib.domainobjects;
import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
import org.codehaus.jackson.JsonNode;
public class ObjectActionRepresentation extends AbstractObjectMemberRepresentation {
@@ -28,7 +29,7 @@ public class ObjectActionRepresentation extends AbstractObjectMemberRepresentati
}
public LinkRepresentation getInvoke() {
- return getLinkWithRel("invoke");
+ return getLinkWithRel(Rel.INVOKE);
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/8c3c71a6/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/RepresentationMatchers.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/RepresentationMatchers.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/RepresentationMatchers.java
index b8a0c2c..6b1957d 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/RepresentationMatchers.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/RepresentationMatchers.java
@@ -39,6 +39,7 @@ 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.tck.RepresentationMatchers.AbstractMatcherBuilder;
+import org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.LinkMatcherBuilder;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
@@ -172,6 +173,7 @@ public class RepresentationMatchers {
private String typeParameterName;
private String typeParameterValue;
private String selfHref;
+ private JsonRepresentation arguments;
private LinkMatcherBuilder(final RestfulClient client) {
super(client);
@@ -218,6 +220,11 @@ public class RepresentationMatchers {
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");
@@ -275,6 +282,10 @@ public class RepresentationMatchers {
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");
}
@@ -335,6 +346,9 @@ public class RepresentationMatchers {
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;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/8c3c71a6/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/Util.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/Util.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/Util.java
new file mode 100644
index 0000000..f1fd706
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/Util.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck;
+
+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.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.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.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+
+public class Util {
+
+ private Util(){}
+
+ public static String givenLinkToService(RestfulClient restfulClient, String serviceId) throws JsonParseException, JsonMappingException, IOException {
+
+ final DomainServiceResource resource = restfulClient.getDomainServiceResource();
+ final Response response = resource.services();
+ final ListRepresentation services = RestfulResponse.<ListRepresentation> ofT(response).getEntity();
+
+ final String href = services.getRepresentation("value[rel=" + Rel.SERVICE.getName() + ";serviceId=\"" +
+ serviceId +
+ "\"]").asLink().getHref();
+ return href;
+ }
+
+ public static String givenHrefToService(RestfulClient client, 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("value[rel=urn:org.restfulobjects:rels/service;serviceId=\"%s\"]", serviceId).asLink().getHref();
+ }
+
+ public static JsonRepresentation givenAction(RestfulClient client, final String serviceId, final String actionId) throws JsonParseException, JsonMappingException, IOException {
+ final String href = givenHrefToService(client, serviceId);
+
+ final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, href).withArg(RequestParameter.FOLLOW_LINKS, "members[%s].links[rel=%s]", actionId, Rel.DETAILS.getName());
+ 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=%s].value", Rel.DETAILS.getName());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/8c3c71a6/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
index cfde1b2..a4b4a80 100644
--- 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
@@ -33,6 +33,7 @@ import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpS
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;
http://git-wip-us.apache.org/repos/asf/isis/blob/8c3c71a6/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
index 970eac0..cc95598 100644
--- 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
@@ -32,6 +32,7 @@ import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.Reques
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;
http://git-wip-us.apache.org/repos/asf/isis/blob/8c3c71a6/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 4021e98..a853226 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
@@ -26,7 +26,6 @@ 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;
@@ -45,9 +44,9 @@ import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.RequestParameter;
import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+
import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.*;
public class DomainServiceTest_req_queryarg_xrofollowlinks {
@@ -163,14 +162,8 @@ public class DomainServiceTest_req_queryarg_xrofollowlinks {
assertThat(actionRepr.getRepresentation("links[rel="+Rel.DETAILS.getName()+"].value"), is(not(nullValue()))); // also followed
}
-
-
private String givenHrefToService(final String serviceId) throws JsonParseException, JsonMappingException, IOException {
- final DomainServiceResource resource = client.getDomainServiceResource();
- final Response response = resource.services();
- final ListRepresentation services = RestfulResponse.<ListRepresentation> ofT(response).getEntity();
-
- return services.getRepresentation("value[rel=urn:org.restfulobjects:rels/service;serviceId=\"%s\"]", serviceId).asLink().getHref();
+ return Util.givenHrefToService(client, serviceId);
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/8c3c71a6/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 fea89c7..95fe1cd 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
@@ -23,13 +23,11 @@ import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.a
import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
-import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.CoreMatchers.endsWith;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
-import javax.ws.rs.HttpMethod;
import javax.ws.rs.core.Response;
import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
@@ -44,7 +42,6 @@ import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceR
import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
import org.hamcrest.Matchers;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/isis/blob/8c3c71a6/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Util.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Util.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Util.java
deleted file mode 100644
index f0af94e..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/Util.java
+++ /dev/null
@@ -1,49 +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 java.io.IOException;
-
-import javax.ws.rs.core.Response;
-
-import org.apache.isis.viewer.restfulobjects.applib.Rel;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-
-public class Util {
-
- private Util(){}
-
- public static String givenLinkToService(RestfulClient restfulClient, String serviceId) throws JsonParseException, JsonMappingException, IOException {
-
- final DomainServiceResource resource = restfulClient.getDomainServiceResource();
- final Response response = resource.services();
- final ListRepresentation services = RestfulResponse.<ListRepresentation> ofT(response).getEntity();
-
- final String href = services.getRepresentation("value[rel=" + Rel.SERVICE.getName() + ";serviceId=\"" +
- serviceId +
- "\"]").asLink().getHref();
- return href;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/8c3c71a6/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_action_invoke.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_action_invoke.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_action_invoke.java
new file mode 100644
index 0000000..f7ce101
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_action_invoke.java
@@ -0,0 +1,98 @@
+/*
+ * 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.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.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.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.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.ActionResultRepresentation.ResultType;
+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 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_action_invoke {
+
+ @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();
+ }
+
+ @Test
+ public void invokeQueryOnly_noArg_usingClientFollow_returning_list() throws Exception {
+
+ // given
+ final JsonRepresentation givenAction = Util.givenAction(client, "ParentEntities", "list");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ // when
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+
+ // then
+ assertThat(invokeLink, isLink(client)
+ .rel(Rel.INVOKE)
+ .httpMethod(RestfulHttpMethod.GET)
+ .href(Matchers.endsWith(":39393/services/ParentEntities/actions/list/invoke"))
+ .arguments(JsonRepresentation.newMap())
+ .build());
+
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink);
+ 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/8c3c71a6/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
index 5626aa7..ded6ed4 100644
--- 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
@@ -62,30 +62,11 @@ public class DomainServiceTest_invoke_TOREFACTOR {
@Before
public void setUp() throws Exception {
- final WebServer webServer = webServerRule.getWebServer();
- client = new RestfulClient(webServer.getBase());
+ client = webServerRule.getClient();
resource = client.getDomainServiceResource();
}
- @Ignore("TODO - fix broken test resulting from introduction of actionresult repr")
- @Test
- public void invokeQueryOnly_noArg_usingClientFollow() throws Exception {
-
- // given
- final JsonRepresentation givenAction = givenAction("simples", "list");
- final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
-
- // when
- final LinkRepresentation invokeLink = actionRepr.getInvoke();
-
- // then
- assertThat(invokeLink, is(not(nullValue())));
- final RestfulResponse<ListRepresentation> restfulResponse = client.followT(invokeLink);
- final ListRepresentation listRepr = restfulResponse.getEntity();
-
- assertThat(listRepr.getValue().size(), is(5));
- }
@Ignore("TODO - fix broken test resulting from introduction of actionresult repr")
@Test
[24/50] [abbrv] git commit: ISIS-233: argument validation when
invoking actions
Posted by da...@apache.org.
ISIS-233: argument validation when invoking actions
* mostly 'invalidReason' and 'x-ro-invalidReason'
* also fix for ObjectActionParameter.isValid, which only worked for strings;
now works for other types too (in backward compatible fashion).
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/b4dd583a
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/b4dd583a
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/b4dd583a
Branch: refs/heads/master
Commit: b4dd583ad354fb52bf27bd71499aaed7120631b1
Parents: f980329
Author: Dan Haywood <da...@apache.org>
Authored: Wed Mar 13 07:33:55 2013 +0000
Committer: Dan Haywood <da...@apache.org>
Committed: Sat Apr 27 19:01:18 2013 +0100
----------------------------------------------------------------------
.../server/resources/DomainResourceHelper.java | 82 +++++-----
...DomainServiceTest_req_safe_noarg_resp_list.java | 22 ++-
.../DomainServiceTest_req_safe_refarg_bad.java | 57 ++-----
...ainServiceTest_req_safe_refarg_resp_scalar.java | 58 ++++---
...eq_safe_simplearg_fail_all_args_validation.java | 133 ++++++++++++++
...e_simplearg_fail_individual_arg_validation.java | 134 +++++++++++++++
...inServiceTest_req_safe_simplearg_resp_list.java | 21 ++-
.../specimpl/ObjectActionParameterParseable.java | 34 +++--
.../tck/dom/actions/ActionsEntityRepository.java | 26 +++-
9 files changed, 430 insertions(+), 137 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/b4dd583a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
index 87cd55a..67d546d 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
@@ -273,36 +273,11 @@ public final class DomainResourceHelper {
private Response invokeActionUsingAdapters(final ObjectAction action, final JsonRepresentation arguments) {
- final List<ObjectAdapter> argAdapters = parseArguments(action, arguments);
-
- // validate individual args
- final List<ObjectActionParameter> parameters = action.getParameters();
- for (int i = 0; i < parameters.size(); i++) {
- final ObjectActionParameter parameter = parameters.get(i);
- final ObjectAdapter argAdapter = argAdapters.get(i);
- if (argAdapter == null) {
- // can only happen if this is an optional parameter; nothing to
- // do
- continue;
- }
- if (argAdapter.getSpecification().containsFacet(ValueFacet.class)) {
- final Object arg = argAdapter.getObject();
- final String reasonNotValid = parameter.isValid(objectAdapter, arg, null);
- if (reasonNotValid != null) {
- throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.NOT_ACCEPTABLE, reasonNotValid);
- }
- }
- }
-
- // validate all args
- final ObjectAdapter[] argArray = argAdapters.toArray(new ObjectAdapter[0]);
- final Consent consent = action.isProposedArgumentSetValid(objectAdapter, argArray);
- if (consent.isVetoed()) {
- throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.NOT_ACCEPTABLE, consent.getReason());
- }
+ final List<ObjectAdapter> argAdapters = parseAndValidateArguments(action, arguments);
// invoke
- final ObjectAdapter returnedAdapter = action.execute(objectAdapter, argArray);
+ final ObjectAdapter[] argArray2 = argAdapters.toArray(new ObjectAdapter[0]);
+ final ObjectAdapter returnedAdapter = action.execute(objectAdapter, argArray2);
// response (void)
final ActionResultReprRenderer renderer = new ActionResultReprRenderer(resourceContext, null, JsonRepresentation.newMap());
@@ -465,35 +440,62 @@ public final class DomainResourceHelper {
return objectAdapterFor(resourceContext, objectSpec, representation);
}
- private List<ObjectAdapter> parseArguments(final ObjectAction action, final JsonRepresentation arguments) {
- return parseArguments(resourceContext, action, arguments);
- }
-
- public static List<ObjectAdapter> parseArguments(final RendererContext resourceContext, final ObjectAction action, final JsonRepresentation arguments) {
+ private List<ObjectAdapter> parseAndValidateArguments(final ObjectAction action, final JsonRepresentation arguments) {
final List<JsonRepresentation> argList = argListFor(action, arguments);
final List<ObjectAdapter> argAdapters = Lists.newArrayList();
final List<ObjectActionParameter> parameters = action.getParameters();
final StringBuilder invalidReasonBuf = new StringBuilder();
for (int i = 0; i < argList.size(); i++) {
- final JsonRepresentation arg = argList.get(i);
+ final JsonRepresentation argRepr = argList.get(i);
final ObjectSpecification paramSpec = parameters.get(i).getSpecification();
try {
- final ObjectAdapter objectAdapter = objectAdapterFor(resourceContext, paramSpec, arg);
- argAdapters.add(objectAdapter);
- } catch (final IllegalArgumentException e) {
- if(invalidReasonBuf.length()>0) {
- invalidReasonBuf.append("; ");
+ final ObjectAdapter argAdapter = objectAdapterFor(resourceContext, paramSpec, argRepr);
+ argAdapters.add(argAdapter);
+
+ // validate individual arg
+ final ObjectActionParameter parameter = parameters.get(i);
+ if (argAdapter == null) {
+ // can only happen if this is an optional parameter; nothing to
+ // do
+ continue;
}
- invalidReasonBuf.append(e.getMessage());
+ if (argAdapter.getSpecification().containsFacet(ValueFacet.class)) {
+ final Object argPojo = argAdapter.getObject();
+ final String reasonNotValid = parameter.isValid(objectAdapter, argPojo, null);
+ if (reasonNotValid != null) {
+ argRepr.mapPut("invalidReason", reasonNotValid);
+ appendReasonTo(invalidReasonBuf, "Validation failed, see body for details");
+ }
+ }
+ } catch (final IllegalArgumentException e) {
+ String reason = e.getMessage();
+ appendReasonTo(invalidReasonBuf, reason);
}
}
+
+ // validate all args
+ final ObjectAdapter[] argArray = argAdapters.toArray(new ObjectAdapter[0]);
+ final Consent consent = action.isProposedArgumentSetValid(objectAdapter, argArray);
+ if (consent.isVetoed()) {
+ arguments.mapPut("x-ro-invalidReason", consent.getReason());
+ appendReasonTo(invalidReasonBuf, "Validation failed, see body for details");
+ }
+
if(invalidReasonBuf.length()>0) {
throw RestfulObjectsApplicationException.createWithBody(HttpStatusCode.VALIDATION_FAILED, arguments, invalidReasonBuf.toString());
}
+
return argAdapters;
}
+ private void appendReasonTo(final StringBuilder buf, String reason) {
+ if(buf.length()>0) {
+ buf.append("; ");
+ }
+ buf.append(reason);
+ }
+
private static List<JsonRepresentation> argListFor(final ObjectAction action, final JsonRepresentation arguments) {
final List<JsonRepresentation> argList = Lists.newArrayList();
http://git-wip-us.apache.org/repos/asf/isis/blob/b4dd583a/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
index 1470fb4..612f32b 100644
--- 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
@@ -18,18 +18,23 @@
*/
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;
@@ -37,6 +42,8 @@ import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresenta
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;
@@ -78,6 +85,12 @@ public class DomainServiceTest_req_safe_noarg_resp_list {
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));
@@ -93,14 +106,7 @@ public class DomainServiceTest_req_safe_noarg_resp_list {
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));
+ then(restfulResponse);
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/b4dd583a/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
index 3bcb277..d31ca0e 100644
--- 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
@@ -20,31 +20,29 @@ package org.apache.isis.viewer.restfulobjects.tck.domainservice.serviceId.action
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.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.junit.Before;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
@@ -68,7 +66,7 @@ public class DomainServiceTest_req_safe_refarg_bad {
// given a reference to a non-existent entity
LinkRepresentation nonExistentEntityLink = new LinkRepresentation()
- .withHref("http://localhost:39393/objects/NONEXISTENT/123");
+ .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");
@@ -84,6 +82,10 @@ public class DomainServiceTest_req_safe_refarg_bad {
RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+ 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));
@@ -95,53 +97,28 @@ public class DomainServiceTest_req_safe_refarg_bad {
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"));
}
- @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();
+ // 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 entity
- // (for a range where the entity is contained in the range)
+ // when query the 'contains' action passing in the reference to the non-existent entity
JsonRepresentation args = JsonRepresentation.newMap();
- args.mapPut("searchFor.value", firstEntityLink);
+ 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
- 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));
+ then(args, restfulResponse);
}
-
- 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/b4dd583a/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
index f7cd2c0..d707510 100644
--- 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
@@ -18,19 +18,24 @@
*/
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;
@@ -41,6 +46,8 @@ import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ScalarValueRep
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;
@@ -86,23 +93,8 @@ public class DomainServiceTest_req_safe_refarg_resp_scalar {
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));
+ // then
+ thenResponseIsScalarValueOf(restfulResponse, true);
// and when query the 'contains' action for a different range which does not
@@ -113,14 +105,11 @@ public class DomainServiceTest_req_safe_refarg_resp_scalar {
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));
+ // then
+ thenResponseIsScalarValueOf(restfulResponse, false);
}
+
@Test
public void usingResourceProxy() throws Exception {
@@ -139,16 +128,29 @@ public class DomainServiceTest_req_safe_refarg_resp_scalar {
RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
// then
- final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
+ 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())));
- assertThat(actionResultRepr.getResultType(), is(ResultType.SCALAR_VALUE));
ScalarValueRepresentation scalarValueRepr = resultRepr.as(ScalarValueRepresentation.class);
-
- assertThat(scalarValueRepr.getValue().asBoolean(), is(true));
+
+ 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");
http://git-wip-us.apache.org/repos/asf/isis/blob/b4dd583a/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
new file mode 100644
index 0000000..93ab7b1
--- /dev/null
+++ 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
@@ -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.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/b4dd583a/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
new file mode 100644
index 0000000..7393abb
--- /dev/null
+++ 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
@@ -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.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/b4dd583a/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
index 0e5c67c..cdcaa2e 100644
--- 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
@@ -18,18 +18,24 @@
*/
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;
@@ -39,6 +45,8 @@ 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;
@@ -86,15 +94,9 @@ public class DomainServiceTest_req_safe_simplearg_resp_list {
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));
+ then(restfulResponse);
}
-
@Test
public void usingResourceProxy() throws Exception {
@@ -106,6 +108,11 @@ public class DomainServiceTest_req_safe_simplearg_resp_list {
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));
http://git-wip-us.apache.org/repos/asf/isis/blob/b4dd583a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionParameterParseable.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionParameterParseable.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionParameterParseable.java
index e05a1d8..44de1c9 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionParameterParseable.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionParameterParseable.java
@@ -77,22 +77,32 @@ public class ObjectActionParameterParseable extends ObjectActionParameterAbstrac
@Override
public String isValid(final ObjectAdapter adapter, final Object proposedValue, final Localization localization) {
- if (!(proposedValue instanceof String)) {
- return null;
- }
- final String proposedString = (String) proposedValue;
- final ObjectActionParameter objectActionParameter = getAction().getParameters().get(getNumber());
- if (!(objectActionParameter instanceof ParseableEntryActionParameter)) {
+ final ObjectActionParameter parameter = getAction().getParameters().get(getNumber());
+ final ObjectSpecification parameterSpecification = parameter.getSpecification();
+ if(proposedValue == null) {
return null;
}
- final ParseableEntryActionParameter parameter = (ParseableEntryActionParameter) objectActionParameter;
-
- final ObjectSpecification parameterSpecification = parameter.getSpecification();
- final ParseableFacet p = parameterSpecification.getFacet(ParseableFacet.class);
- final ObjectAdapter newValue = p.parseTextEntry(null, proposedString, localization);
+
+ ObjectAdapter proposedValueAdapter = getAdapterMap().adapterFor(proposedValue);
+ final ObjectSpecification proposedValueSpec = proposedValueAdapter.getSpecification();
+ if(proposedValueSpec.isOfType(proposedValueSpec)) {
+ // nothing to do
+ } else {
+ // try to parse
+ if (!(parameter instanceof ParseableEntryActionParameter)) {
+ return null;
+ }
+ if (!(proposedValue instanceof String)) {
+ return null;
+ }
+ final String proposedString = (String) proposedValue;
+
+ final ParseableFacet p = parameterSpecification.getFacet(ParseableFacet.class);
+ proposedValueAdapter = p.parseTextEntry(null, proposedString, localization);
+ }
- final ValidityContext<?> ic = parameter.createProposedArgumentInteractionContext(getAuthenticationSession(), InteractionInvocationMethod.BY_USER, adapter, arguments(newValue), getNumber());
+ final ValidityContext<?> ic = parameter.createProposedArgumentInteractionContext(getAuthenticationSession(), InteractionInvocationMethod.BY_USER, adapter, arguments(proposedValueAdapter), getNumber());
final InteractionResultSet buf = new InteractionResultSet();
InteractionUtils.isValidResultSet(parameter, ic, buf);
http://git-wip-us.apache.org/repos/asf/isis/blob/b4dd583a/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java
----------------------------------------------------------------------
diff --git a/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java
index b14a73f..1c89a73 100644
--- a/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java
+++ b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java
@@ -24,10 +24,12 @@ import java.util.List;
import org.apache.isis.applib.annotation.ActionSemantics;
import org.apache.isis.applib.annotation.ActionSemantics.Of;
import org.apache.isis.applib.annotation.MemberOrder;
+import org.apache.isis.applib.annotation.MustSatisfy;
import org.apache.isis.applib.annotation.Named;
import org.apache.isis.applib.annotation.ObjectType;
import org.apache.isis.applib.query.Query;
import org.apache.isis.applib.query.QueryDefault;
+import org.apache.isis.applib.spec.Specification;
import org.apache.isis.core.tck.dom.AbstractEntityRepository;
@Named("ActionsEntities")
@@ -48,12 +50,22 @@ public class ActionsEntityRepository extends AbstractEntityRepository<ActionsEnt
@ActionSemantics(Of.SAFE)
@MemberOrder(sequence = "1")
- public List<ActionsEntity> subList(@Named("from") int from, @Named("to") int to) {
+ public List<ActionsEntity> subList(
+ @MustSatisfy(IntegerCannotBeNegative.class)
+ @Named("from") int from,
+ @MustSatisfy(IntegerCannotBeNegative.class)
+ @Named("to") int to) {
List<ActionsEntity> list = list();
int toChecked = Math.min(to, list.size());
int fromChecked = Math.min(from, toChecked);
return list.subList(fromChecked, toChecked);
}
+ public String validateSubList(final int from, final int to) {
+ if(from > to) {
+ return "'from' cannot be larger than 'to'";
+ }
+ return null;
+ }
@ActionSemantics(Of.SAFE)
@MemberOrder(sequence = "1")
@@ -61,5 +73,15 @@ public class ActionsEntityRepository extends AbstractEntityRepository<ActionsEnt
List<ActionsEntity> list = subList(from, to);
return list.contains(entity);
}
-
+
+ public static class IntegerCannotBeNegative implements Specification {
+ @Override
+ public String satisfies(Object obj) {
+ if(!(obj instanceof Integer)) {
+ return null;
+ }
+ Integer integer = (Integer) obj;
+ return integer.intValue() < 0? "Cannot be less than zero": null;
+ }
+ }
}
[19/50] [abbrv] git commit: ISIS-233: more action testing
Posted by da...@apache.org.
ISIS-233: more action testing
... and discovered that will need a different way to pass querystring
if using the JBoss RestEasy client framework
... have invented a new 'x-isis-querystring' for this.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/62bda8d4
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/62bda8d4
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/62bda8d4
Branch: refs/heads/master
Commit: 62bda8d46e82f728493386c8852265fa605037a5
Parents: 8c3c71a
Author: Dan Haywood <da...@apache.org>
Authored: Wed Mar 6 08:36:10 2013 +0000
Committer: Dan Haywood <da...@apache.org>
Committed: Sat Apr 27 18:57:44 2013 +0100
----------------------------------------------------------------------
.../domainobjects/DomainServiceResource.java | 10 +-
.../applib/util/UrlEncodingUtils.java | 7 +-
.../resources/DomainServiceResourceServerside.java | 8 +-
.../tck/src/main/webapp/WEB-INF/isis.properties | 6 +-
.../restfulobjects/tck/RepresentationMatchers.java | 15 ++
.../invoke/DomainServiceTest_action_invoke.java | 98 ------------
.../invoke/DomainServiceTest_safe_noarg_list.java | 106 +++++++++++++
.../DomainServiceTest_safe_simplearg_list.java | 123 +++++++++++++++
.../core/tck/dom/AbstractEntityRepository.java | 4 +-
.../isis/core/tck/dom/actions/ActionsEntity.java | 76 +++++++++
.../tck/dom/actions/ActionsEntityRepository.java | 62 ++++++++
.../tck/fixture/actions/ActionsEntityFixture.java | 52 ++++++
.../fixture/busrules/BusRulesEntityFixture.java | 2 +-
13 files changed, 462 insertions(+), 107 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/62bda8d4/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainServiceResource.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainServiceResource.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainServiceResource.java
index 29de6cd..627ef4a 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainServiceResource.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainServiceResource.java
@@ -27,6 +27,7 @@ import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@@ -75,11 +76,18 @@ public interface DomainServiceResource {
// domain service action invoke
// //////////////////////////////////////////////////////////
+ /**
+ * Because it isn't possible with the RestEasy client-side framework to specify a query string nor to pass arbitrary query params; instead
+ * we provide an additional syntax of passing an Isis-defined query param <tt>x-isis-querystring</tt>.
+ *
+ * <p>
+ * The content of this is taken to be the URL encoded map of arguments.
+ */
@GET
@Path("/{serviceId}/actions/{actionId}/invoke")
@Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_ACTION_RESULT, RestfulMediaType.APPLICATION_JSON_ERROR })
@ClientResponseType(entityType = String.class)
- public Response invokeActionQueryOnly(@PathParam("serviceId") final String serviceId, @PathParam("actionId") final String actionId);
+ public Response invokeActionQueryOnly(@PathParam("serviceId") final String serviceId, @PathParam("actionId") final String actionId, @QueryParam("x-isis-querystring") final String xIsisQueryString);
@PUT
@Path("/{serviceId}/actions/{actionId}/invoke")
http://git-wip-us.apache.org/repos/asf/isis/blob/62bda8d4/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/UrlEncodingUtils.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/UrlEncodingUtils.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/UrlEncodingUtils.java
index c21fb2a..63e73c7 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/UrlEncodingUtils.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/UrlEncodingUtils.java
@@ -24,6 +24,7 @@ import java.net.URLEncoder;
import java.util.Arrays;
import java.util.List;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
import org.codehaus.jackson.JsonNode;
import com.google.common.base.Charsets;
@@ -61,7 +62,11 @@ public final class UrlEncodingUtils {
}
public static String urlEncode(final JsonNode jsonNode) {
- return UrlEncodingUtils.urlEncode(jsonNode.toString());
+ return urlEncode(jsonNode.toString());
+ }
+
+ public static String urlEncode(final JsonRepresentation jsonRepresentation ) {
+ return urlEncode(jsonRepresentation.toString());
}
public static String urlEncode(final String str) {
http://git-wip-us.apache.org/repos/asf/isis/blob/62bda8d4/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java
index 86156ef..da3254a 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java
@@ -26,6 +26,7 @@ import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@@ -125,11 +126,12 @@ public class DomainServiceResourceServerside extends ResourceAbstract implements
@GET
@Path("/{serviceId}/actions/{actionId}/invoke")
@Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_ACTION_RESULT, RestfulMediaType.APPLICATION_JSON_ERROR })
- public Response invokeActionQueryOnly(@PathParam("serviceId") final String serviceId, @PathParam("actionId") final String actionId) {
+ public Response invokeActionQueryOnly(@PathParam("serviceId") final String serviceId, @PathParam("actionId") final String actionId, @QueryParam("x-isis-querystring") final String xIsisQueryString) {
init(RepresentationType.ACTION_RESULT, Where.STANDALONE_TABLES);
- final JsonRepresentation arguments = getResourceContext().getQueryStringAsJsonRepr();
-
+ final JsonRepresentation arguments = DomainResourceHelper.readQueryStringAsMap(
+ xIsisQueryString != null? xIsisQueryString : getResourceContext().getQueryString());
+
final ObjectAdapter serviceAdapter = getServiceAdapter(serviceId);
final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), serviceAdapter).using(new DomainServiceLinkTo());
http://git-wip-us.apache.org/repos/asf/isis/blob/62bda8d4/component/viewer/restfulobjects/tck/src/main/webapp/WEB-INF/isis.properties
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/main/webapp/WEB-INF/isis.properties b/component/viewer/restfulobjects/tck/src/main/webapp/WEB-INF/isis.properties
index 03b05ca..0734bb7 100644
--- a/component/viewer/restfulobjects/tck/src/main/webapp/WEB-INF/isis.properties
+++ b/component/viewer/restfulobjects/tck/src/main/webapp/WEB-INF/isis.properties
@@ -39,7 +39,8 @@ isis.services =\
refs.UnidirReferencingEntityRepository,\
defaults.WithDefaultsEntityRepository,\
defaults.HiddenRepository,\
- busrules.BusRulesEntityRepository
+ busrules.BusRulesEntityRepository,\
+ actions.ActionsEntityRepository
isis.fixtures.prefix= org.apache.isis.core.tck.fixture
@@ -51,6 +52,7 @@ isis.fixtures=\
scalars.WrapperValuedEntityFixture,\
refs.ParentEntitiesFixture,\
defaults.WithDefaultsEntityFixture,\
- busrules.BusRulesEntityFixture
+ busrules.BusRulesEntityFixture,\
+ actions.ActionsEntityFixture
http://git-wip-us.apache.org/repos/asf/isis/blob/62bda8d4/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/RepresentationMatchers.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/RepresentationMatchers.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/RepresentationMatchers.java
index 6b1957d..b9cc167 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/RepresentationMatchers.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/RepresentationMatchers.java
@@ -509,4 +509,19 @@ public class RepresentationMatchers {
};
}
+ 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);
+ }
+ };
+ }
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/62bda8d4/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_action_invoke.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_action_invoke.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_action_invoke.java
deleted file mode 100644
index f7ce101..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_action_invoke.java
+++ /dev/null
@@ -1,98 +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.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.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.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.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.ActionResultRepresentation.ResultType;
-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 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_action_invoke {
-
- @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();
- }
-
- @Test
- public void invokeQueryOnly_noArg_usingClientFollow_returning_list() throws Exception {
-
- // given
- final JsonRepresentation givenAction = Util.givenAction(client, "ParentEntities", "list");
- final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
-
- // when
- final LinkRepresentation invokeLink = actionRepr.getInvoke();
-
- // then
- assertThat(invokeLink, isLink(client)
- .rel(Rel.INVOKE)
- .httpMethod(RestfulHttpMethod.GET)
- .href(Matchers.endsWith(":39393/services/ParentEntities/actions/list/invoke"))
- .arguments(JsonRepresentation.newMap())
- .build());
-
- final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink);
- 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/62bda8d4/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
new file mode 100644
index 0000000..ff07257
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_safe_noarg_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.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/62bda8d4/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
new file mode 100644
index 0000000..2de1f28
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_safe_simplearg_list.java
@@ -0,0 +1,123 @@
+/*
+ * 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/62bda8d4/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/AbstractEntityRepository.java
----------------------------------------------------------------------
diff --git a/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/AbstractEntityRepository.java b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/AbstractEntityRepository.java
index 92792fd..d6b6a24 100644
--- a/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/AbstractEntityRepository.java
+++ b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/AbstractEntityRepository.java
@@ -23,9 +23,11 @@ import java.util.List;
import java.util.Map;
import org.apache.isis.applib.AbstractFactoryAndRepository;
+import org.apache.isis.applib.annotation.ActionSemantics;
import org.apache.isis.applib.annotation.MemberOrder;
import org.apache.isis.applib.annotation.Programmatic;
import org.apache.isis.applib.annotation.QueryOnly;
+import org.apache.isis.applib.annotation.ActionSemantics.Of;
import org.apache.isis.applib.query.Query;
import org.apache.isis.applib.query.QueryDefault;
@@ -44,7 +46,7 @@ public abstract class AbstractEntityRepository<T> extends AbstractFactoryAndRepo
return serviceId;
}
- @QueryOnly
+ @ActionSemantics(Of.SAFE)
@MemberOrder(sequence = "1")
public List<T> list() {
return allInstances(entityClass);
http://git-wip-us.apache.org/repos/asf/isis/blob/62bda8d4/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntity.java
----------------------------------------------------------------------
diff --git a/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntity.java b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntity.java
new file mode 100644
index 0000000..2f4ed64
--- /dev/null
+++ b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntity.java
@@ -0,0 +1,76 @@
+/*
+ * 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.core.tck.dom.actions;
+
+import org.apache.isis.applib.AbstractDomainObject;
+import org.apache.isis.applib.annotation.ActionSemantics;
+import org.apache.isis.applib.annotation.ActionSemantics.Of;
+import org.apache.isis.applib.annotation.Disabled;
+import org.apache.isis.applib.annotation.Hidden;
+import org.apache.isis.applib.annotation.MemberOrder;
+import org.apache.isis.applib.annotation.ObjectType;
+
+@javax.jdo.annotations.PersistenceCapable
+@javax.jdo.annotations.Discriminator("RTNE")
+@ObjectType("RTNE")
+public class ActionsEntity extends AbstractDomainObject {
+
+ // {{ Id (Integer)
+ private Integer id;
+
+ @javax.jdo.annotations.PrimaryKey // must be on the getter.
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(final Integer id) {
+ this.id = id;
+ }
+ // }}
+
+ // {{ Title
+ public String title() {
+ return null;
+ }
+ // }}
+
+
+
+ @ActionSemantics(Of.SAFE)
+ @MemberOrder(sequence = "1")
+ public ActionsEntity visibleAndInvokableAction() {
+ return this;
+ }
+
+ @Disabled
+ @ActionSemantics(Of.SAFE)
+ @MemberOrder(sequence = "1")
+ public ActionsEntity visibleButUninvokableAction() {
+ return this;
+ }
+
+ @Hidden
+ @ActionSemantics(Of.SAFE)
+ @MemberOrder(sequence = "1")
+ public ActionsEntity invisibleAction() {
+ return this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/62bda8d4/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java
----------------------------------------------------------------------
diff --git a/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java
new file mode 100644
index 0000000..88c2b9a
--- /dev/null
+++ b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java
@@ -0,0 +1,62 @@
+/*
+ * 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.core.tck.dom.actions;
+
+import java.util.List;
+
+import org.apache.isis.applib.annotation.ActionSemantics;
+import org.apache.isis.applib.annotation.ActionSemantics.Of;
+import org.apache.isis.applib.annotation.MemberOrder;
+import org.apache.isis.applib.annotation.Named;
+import org.apache.isis.applib.annotation.ObjectType;
+import org.apache.isis.applib.query.Query;
+import org.apache.isis.applib.query.QueryDefault;
+import org.apache.isis.core.tck.dom.AbstractEntityRepository;
+
+@Named("ActionsEntities")
+@ObjectType("ActionsEntities")
+public class ActionsEntityRepository extends AbstractEntityRepository<ActionsEntity> {
+
+ public ActionsEntityRepository() {
+ super(ActionsEntity.class, "ActionsEntities");
+ }
+
+ @ActionSemantics(Of.SAFE)
+ @MemberOrder(sequence = "1")
+ public ActionsEntity findById(int id) {
+ final Query<ActionsEntity> query =
+ new QueryDefault<ActionsEntity>(ActionsEntity.class, ActionsEntity.class.getName() + "#pk", "id", id);
+ return this.firstMatch(query);
+ }
+
+
+ @ActionSemantics(Of.SAFE)
+ @MemberOrder(sequence = "1")
+ public List<ActionsEntity> subList(@Named("from") int from, @Named("to") int to) {
+ List<ActionsEntity> list = list();
+ int toChecked = Math.min(to, list.size());
+ int fromChecked = Math.min(from, toChecked);
+ return list.subList(fromChecked, toChecked);
+ }
+
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/62bda8d4/core/tck/tck-fixture/src/main/java/org/apache/isis/core/tck/fixture/actions/ActionsEntityFixture.java
----------------------------------------------------------------------
diff --git a/core/tck/tck-fixture/src/main/java/org/apache/isis/core/tck/fixture/actions/ActionsEntityFixture.java b/core/tck/tck-fixture/src/main/java/org/apache/isis/core/tck/fixture/actions/ActionsEntityFixture.java
new file mode 100644
index 0000000..2a5e6ad
--- /dev/null
+++ b/core/tck/tck-fixture/src/main/java/org/apache/isis/core/tck/fixture/actions/ActionsEntityFixture.java
@@ -0,0 +1,52 @@
+/*
+ * 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.core.tck.fixture.actions;
+
+import org.apache.isis.applib.fixtures.AbstractFixture;
+import org.apache.isis.core.tck.dom.actions.ActionsEntity;
+import org.apache.isis.core.tck.dom.actions.ActionsEntityRepository;
+import org.apache.isis.core.tck.dom.busrules.BusRulesEntity;
+import org.apache.isis.core.tck.dom.busrules.BusRulesEntityRepository;
+
+public class ActionsEntityFixture extends AbstractFixture {
+
+ @Override
+ public void install() {
+ createEntity(1);
+ createEntity(2);
+ createEntity(3);
+ createEntity(4);
+ createEntity(5);
+ }
+
+ private ActionsEntity createEntity(Integer id) {
+ final ActionsEntity entity = repository.newEntity();
+ entity.setId(id);
+ return entity;
+ }
+
+ // {{ injected: ActionSemanticsEntityRepository
+ private ActionsEntityRepository repository;
+
+ public void setActionSemanticsEntityRepository(final ActionsEntityRepository repository) {
+ this.repository = repository;
+ }
+ // }}
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/62bda8d4/core/tck/tck-fixture/src/main/java/org/apache/isis/core/tck/fixture/busrules/BusRulesEntityFixture.java
----------------------------------------------------------------------
diff --git a/core/tck/tck-fixture/src/main/java/org/apache/isis/core/tck/fixture/busrules/BusRulesEntityFixture.java b/core/tck/tck-fixture/src/main/java/org/apache/isis/core/tck/fixture/busrules/BusRulesEntityFixture.java
index e31578e..39a84c4 100644
--- a/core/tck/tck-fixture/src/main/java/org/apache/isis/core/tck/fixture/busrules/BusRulesEntityFixture.java
+++ b/core/tck/tck-fixture/src/main/java/org/apache/isis/core/tck/fixture/busrules/BusRulesEntityFixture.java
@@ -39,7 +39,7 @@ public class BusRulesEntityFixture extends AbstractFixture {
return entity;
}
- // {{ injected: WithDefaultsEntityRepository
+ // {{ injected: BusRulesEntityRepository
private BusRulesEntityRepository repository;
public void setBusRulesEntityRepository(final BusRulesEntityRepository repository) {
[29/50] [abbrv] ISIS-233: adding new test stubs (TODOs)
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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]+$"));
- }
-
-}
[38/50] [abbrv] ISIS-233: more stub test cases.
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/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
deleted file mode 100644
index 814d461..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Get_ResponseHeaders_CacheControl_ok_TOFIX.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.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 {
-
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Get_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Get_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Get_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..79bd93c
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Get_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.objectsoftype;
+
+public class Get_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseCode_201_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseCode_201_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseCode_201_ok_TODO.java
new file mode 100644
index 0000000..61408b2
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseCode_201_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.objectsoftype;
+
+public class Post_thenResponseCode_201_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_CacheControl_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_CacheControl_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_CacheControl_ok_TODO.java
new file mode 100644
index 0000000..43f1704
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_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.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 Post_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_ContentLength_ok_TODO.java
new file mode 100644
index 0000000..e8e15d5
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_ContentLength_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.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 Post_thenResponseHeaders_ContentLength_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_ContentType_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_ContentType_ok_TODO.java
new file mode 100644
index 0000000..0cf1401
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_ContentType_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.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 Post_thenResponseHeaders_ContentType_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_Location_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_Location_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_Location_ok_TODO.java
new file mode 100644
index 0000000..8eff361
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_Location_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.objectsoftype;
+
+public class Post_thenResponseHeaders_Location_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_eTag_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_eTag_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_eTag_ok_TODO.java
new file mode 100644
index 0000000..ae08c06
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_thenResponseHeaders_eTag_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.objectsoftype;
+
+public class Post_thenResponseHeaders_eTag_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgIsHrefAndLinksToEntityOfWrongType_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgIsHrefAndLinksToEntityOfWrongType_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgIsHrefAndLinksToEntityOfWrongType_bad_TODO.java
new file mode 100644
index 0000000..c961a94
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgIsHrefAndLinksToEntityOfWrongType_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.objectsoftype;
+
+public class Post_whenArgIsHrefAndLinksToEntityOfWrongType_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgIsHrefAndLinksToNonExistentEntity_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgIsHrefAndLinksToNonExistentEntity_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgIsHrefAndLinksToNonExistentEntity_bad_TODO.java
new file mode 100644
index 0000000..7f61789
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgIsHrefAndLinksToNonExistentEntity_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.objectsoftype;
+
+public class Post_whenArgIsHrefAndLinksToNonExistentEntity_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/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
deleted file mode 100644
index 514f9b4..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgValid_ok_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.objectsoftype;
-
-public class Post_whenArgValid_ok_TODO {
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgsMandatoryButMissing_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgsMandatoryButMissing_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgsMandatoryButMissing_bad_TODO.java
new file mode 100644
index 0000000..1422b1d
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgsMandatoryButMissing_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.objectsoftype;
+
+public class Post_whenArgsMandatoryButMissing_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/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
deleted file mode 100644
index e3d44f5..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgsMissing_bad_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.objectsoftype;
-
-public class Post_whenArgsMissing_bad_TODO {
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/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
deleted file mode 100644
index 14d4307..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgsRefNonExistentEntity_bad_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.objectsoftype;
-
-public class Post_whenArgsRefNonExistentEntity_bad_TODO {
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgsValid_thenPersistsObject_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgsValid_thenPersistsObject_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgsValid_thenPersistsObject_ok_TODO.java
new file mode 100644
index 0000000..8758936
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/objectsoftype/Post_whenArgsValid_thenPersistsObject_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.objectsoftype;
+
+public class Post_whenArgsValid_thenPersistsObject_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Get_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Get_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Get_thenResponseHeaders_ContentLength_ok_TODO.java
new file mode 100644
index 0000000..444b658
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Get_thenResponseHeaders_ContentLength_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.user.root;
+
+public class Get_thenResponseHeaders_ContentLength_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Get_whenQueryArg_xRoDomainModel_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Get_whenQueryArg_xRoDomainModel_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Get_whenQueryArg_xRoDomainModel_ok_TODO.java
new file mode 100644
index 0000000..c9ae7bb
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/Get_whenQueryArg_xRoDomainModel_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.user.root;
+
+public class Get_whenQueryArg_xRoDomainModel_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_thenResponseHeaders_ContentLength_ok_TODO.java
new file mode 100644
index 0000000..ffc84fc
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_thenResponseHeaders_ContentLength_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.version;
+
+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_ContentLength_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_whenQueryArg_xRoDomainModel_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_whenQueryArg_xRoDomainModel_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_whenQueryArg_xRoDomainModel_ok_TODO.java
new file mode 100644
index 0000000..ca156e4
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/Get_whenQueryArg_xRoDomainModel_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.version;
+
+public class Get_whenQueryArg_xRoDomainModel_ok_TODO {
+
+}
[16/50] [abbrv] git commit: ISIS-233: followlinks for
service.serviceId
Posted by da...@apache.org.
ISIS-233: followlinks for service.serviceId
* and started on bus rule testing, creating tck classes and fixtures.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/cfe2b106
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/cfe2b106
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/cfe2b106
Branch: refs/heads/master
Commit: cfe2b106c4b3804ec2af13ec4bd142ca09005f78
Parents: 5e01f68
Author: Dan Haywood <da...@apache.org>
Authored: Tue Mar 5 20:23:08 2013 +0000
Committer: Dan Haywood <da...@apache.org>
Committed: Sat Apr 27 18:57:37 2013 +0100
----------------------------------------------------------------------
.../restfulobjects/applib/util/PathNode.java | 19 ++-
.../restfulobjects/rendering/LinkFollowSpecs.java | 8 +-
.../AbstractObjectMemberReprRenderer.java | 26 ++-
.../domainobjects/DomainObjectReprRenderer.java | 44 +++-
.../domainobjects/ObjectActionReprRenderer.java | 8 +-
.../ObjectCollectionReprRenderer.java | 6 +-
.../domainobjects/ObjectPropertyReprRenderer.java | 6 +-
.../rendering/LinkFollowSpecsTest_follow.java | 19 ++-
.../server/resources/DomainResourceHelper.java | 6 +-
.../resources/DomainServiceResourceServerside.java | 4 +-
.../tck/ide/eclipse/launch/viewer-json-tck.launch | 2 +-
.../tck/src/main/webapp/WEB-INF/isis.properties | 11 +-
...ainServiceTest_req_queryarg_xrofollowlinks.java | 110 ++++++++---
.../DomainServiceTest_resp_representation.java | 4 +-
.../isis/core/tck/dom/busrules/BusRulesEntity.java | 164 +++++++++++++++
.../core/tck/dom/busrules/BusRulesEntityChild.java | 55 +++++
.../tck/dom/busrules/BusRulesEntityRepository.java | 72 +++++++
.../fixture/busrules/BusRulesEntityFixture.java | 50 +++++
18 files changed, 539 insertions(+), 75 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/cfe2b106/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/PathNode.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/PathNode.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/PathNode.java
index a980dae..4cd303a 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/PathNode.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/PathNode.java
@@ -34,7 +34,7 @@ import com.google.common.collect.Maps;
public class PathNode {
private static final Pattern NODE = Pattern.compile("^([^\\[]*)(\\[(.+)\\])?$");
private static final Pattern WHITESPACE = Pattern.compile("\\s+");
- private static final Pattern KEY_VALUE = Pattern.compile("^([^=]+)=(.+)$");
+ private static final Pattern LIST_CRITERIA_SYNTAX = Pattern.compile("^([^=]+)=(.+)$");
public static final PathNode NULL = new PathNode("", Collections.<String, String> emptyMap());
@@ -79,9 +79,12 @@ public class PathNode {
final String criteriaStr = nodeMatcher.group(3);
if (criteriaStr != null) {
for (final String criterium : Splitter.on(WHITESPACE).split(criteriaStr)) {
- final Matcher keyValueMatcher = KEY_VALUE.matcher(criterium);
+ final Matcher keyValueMatcher = LIST_CRITERIA_SYNTAX.matcher(criterium);
if (keyValueMatcher.matches()) {
criteria.put(keyValueMatcher.group(1), keyValueMatcher.group(2));
+ } else {
+ // take content as a map criteria
+ criteria.put(criterium, null);
}
}
}
@@ -115,9 +118,15 @@ public class PathNode {
}
for (final Map.Entry<String, String> criterium : getCriteria().entrySet()) {
final String requiredValue = criterium.getValue();
- final String actualValue = repr.getString(criterium.getKey());
- if (!Objects.equal(requiredValue, actualValue)) {
- return false;
+ if(requiredValue != null) {
+ // list syntax
+ final String actualValue = repr.getString(criterium.getKey());
+ if (!Objects.equal(requiredValue, actualValue)) {
+ return false;
+ }
+ } else {
+ // map syntax
+ return repr.getRepresentation(criterium.getKey()) != null;
}
}
return true;
http://git-wip-us.apache.org/repos/asf/isis/blob/cfe2b106/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/LinkFollowSpecs.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/LinkFollowSpecs.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/LinkFollowSpecs.java
index ed033a9..253bb17 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/LinkFollowSpecs.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/LinkFollowSpecs.java
@@ -105,7 +105,7 @@ public final class LinkFollowSpecs {
* Any keys in the criterium are ignored (these were matched on during the
* {@link #follow(String, Object...)} call).
*/
- public boolean matches(final JsonRepresentation link) {
+ public boolean matches(final JsonRepresentation jsonRepr) {
if (!isFollowing()) {
return false;
}
@@ -113,12 +113,16 @@ public final class LinkFollowSpecs {
return true;
}
for (PathNode criteriaSpec : criteriaSpecs) {
- if(criteriaSpec.matches(link)) {
+ if(criteriaSpec.matches(jsonRepr)) {
return true;
}
}
return false;
}
+ @Override
+ public String toString() {
+ return mode + " : " + criteriaSpecs + " : " + pathSpecs;
+ }
}
http://git-wip-us.apache.org/repos/asf/isis/blob/cfe2b106/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/AbstractObjectMemberReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/AbstractObjectMemberReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/AbstractObjectMemberReprRenderer.java
index 63ea8c7..84c8ef4 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/AbstractObjectMemberReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/AbstractObjectMemberReprRenderer.java
@@ -65,12 +65,24 @@ public abstract class AbstractObjectMemberReprRenderer<R extends ReprRendererAbs
protected T objectMember;
protected Mode mode = Mode.INLINE; // unless we determine otherwise
+ /**
+ * Not for rendering, but is the key that the representation being rendered will be held under.
+ *
+ * <p>
+ * Used to determine whether to follow links; only populated for {@link Mode#INLINE inline} Mode.
+ */
+ private final String memberId;
private final Where where;
- public AbstractObjectMemberReprRenderer(final RendererContext resourceContext, final LinkFollowSpecs linkFollower, final RepresentationType representationType, final JsonRepresentation representation, Where where) {
+ public AbstractObjectMemberReprRenderer(final RendererContext resourceContext, final LinkFollowSpecs linkFollower, String memberId, final RepresentationType representationType, final JsonRepresentation representation, Where where) {
super(resourceContext, linkFollower, representationType, representation);
+ this.memberId = memberId;
this.where = where;
}
+
+ protected String getMemberId() {
+ return memberId;
+ }
@Override
public R with(final ObjectAndMember<T> objectAndMember) {
@@ -79,10 +91,6 @@ public abstract class AbstractObjectMemberReprRenderer<R extends ReprRendererAbs
this.memberType = MemberType.determineFrom(objectMember);
usingLinkTo(new DomainObjectLinkTo());
- // done eagerly so can use as criteria for x-ro-follow-links
- if(!mode.isInline()) {
- representation.mapPut("id", objectMember.getId());
- }
representation.mapPut("memberType", memberType.getName());
return cast(this);
@@ -214,8 +222,12 @@ public abstract class AbstractObjectMemberReprRenderer<R extends ReprRendererAbs
getLinks().arrayAdd(link);
final LinkFollowSpecs membersLinkFollower = getLinkFollowSpecs();
- final LinkFollowSpecs detailsLinkFollower = membersLinkFollower.follow("links[rel=%s]", Rel.DETAILS.getName());
- if (membersLinkFollower.matches(representation) && detailsLinkFollower.matches(link)) {
+ final LinkFollowSpecs detailsLinkFollower = membersLinkFollower.follow("links");
+
+ // create a temporary map that looks the same as the member map we'll be following
+ final JsonRepresentation memberMap = JsonRepresentation.newMap();
+ memberMap.mapPut(getMemberId(), this.representation);
+ if (membersLinkFollower.matches(memberMap) && detailsLinkFollower.matches(link)) {
followDetailsLink(link);
}
return;
http://git-wip-us.apache.org/repos/asf/isis/blob/cfe2b106/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java
index ba00775..da3fa24 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java
@@ -43,7 +43,6 @@ import org.apache.isis.viewer.restfulobjects.rendering.RendererContext;
import org.apache.isis.viewer.restfulobjects.rendering.ReprRendererAbstract;
import org.apache.isis.viewer.restfulobjects.rendering.domaintypes.DomainTypeReprRenderer;
import org.apache.isis.viewer.restfulobjects.rendering.util.OidUtils;
-import org.hamcrest.core.IsSame;
public class DomainObjectReprRenderer extends ReprRendererAbstract<DomainObjectReprRenderer, ObjectAdapter> {
@@ -111,8 +110,7 @@ public class DomainObjectReprRenderer extends ReprRendererAbstract<DomainObjectR
addMediaTypeParams(X_RO_DOMAIN_TYPE, domainTypeHref);
return this;
}
-
-
+
@Override
public JsonRepresentation render() {
@@ -120,8 +118,7 @@ public class DomainObjectReprRenderer extends ReprRendererAbstract<DomainObjectR
if (!mode.representsArguments()) {
if (objectAdapter.representsPersistent()) {
if (includesSelf) {
- final JsonRepresentation self = linkToBuilder.with(objectAdapter).builder(Rel.SELF).build();
- getLinks().arrayAdd(self);
+ addLinkToSelf();
}
getExtensions().mapPut("oid", getOidStr());
}
@@ -147,7 +144,7 @@ public class DomainObjectReprRenderer extends ReprRendererAbstract<DomainObjectR
// described by
if (mode.includesDescribedBy()) {
- getLinks().arrayAdd(DomainTypeReprRenderer.newLinkToBuilder(getRendererContext(), Rel.DESCRIBEDBY, objectAdapter.getSpecification()).build());
+ addLinkToDescribedBy();
}
if (!mode.representsArguments()) {
@@ -164,6 +161,31 @@ public class DomainObjectReprRenderer extends ReprRendererAbstract<DomainObjectR
return representation;
}
+ private void addLinkToSelf() {
+ final JsonRepresentation link = linkToBuilder.with(objectAdapter).builder(Rel.SELF).build();
+
+ final LinkFollowSpecs linkFollower = getLinkFollowSpecs().follow("links");
+ if (linkFollower.matches(link)) {
+ final DomainObjectReprRenderer renderer = new DomainObjectReprRenderer(getRendererContext(), linkFollower, JsonRepresentation.newMap());
+ renderer.with(objectAdapter);
+ link.mapPut("value", renderer.render());
+ }
+
+ getLinks().arrayAdd(link);
+ }
+
+ private void addLinkToDescribedBy() {
+ final JsonRepresentation link = DomainTypeReprRenderer.newLinkToBuilder(getRendererContext(), Rel.DESCRIBEDBY, objectAdapter.getSpecification()).build();
+
+ final LinkFollowSpecs linkFollower = getLinkFollowSpecs().follow("links");
+ if (linkFollower.matches(link)) {
+ final DomainTypeReprRenderer renderer = new DomainTypeReprRenderer(getRendererContext(), linkFollower, JsonRepresentation.newMap());
+ renderer.with(objectAdapter.getSpecification());
+ link.mapPut("value", renderer.render());
+ }
+ getLinks().arrayAdd(link);
+ }
+
private String getDomainType() {
return org.apache.isis.viewer.restfulobjects.rendering.util.OidUtils.getDomainType(objectAdapter);
}
@@ -202,7 +224,7 @@ public class DomainObjectReprRenderer extends ReprRendererAbstract<DomainObjectR
if (assoc instanceof OneToOneAssociation) {
final OneToOneAssociation property = (OneToOneAssociation) assoc;
- final ObjectPropertyReprRenderer renderer = new ObjectPropertyReprRenderer(getRendererContext(), linkFollower, JsonRepresentation.newMap());
+ final ObjectPropertyReprRenderer renderer = new ObjectPropertyReprRenderer(getRendererContext(), linkFollower, property.getId(), JsonRepresentation.newMap());
renderer.with(new ObjectAndProperty(objectAdapter, property)).usingLinkTo(linkToBuilder);
@@ -220,7 +242,7 @@ public class DomainObjectReprRenderer extends ReprRendererAbstract<DomainObjectR
if (assoc instanceof OneToManyAssociation) {
final OneToManyAssociation collection = (OneToManyAssociation) assoc;
- final ObjectCollectionReprRenderer renderer = new ObjectCollectionReprRenderer(getRendererContext(), linkFollower, JsonRepresentation.newMap());
+ final ObjectCollectionReprRenderer renderer = new ObjectCollectionReprRenderer(getRendererContext(), linkFollower, collection.getId(), JsonRepresentation.newMap());
renderer.with(new ObjectAndCollection(objectAdapter, collection)).usingLinkTo(linkToBuilder);
@@ -230,7 +252,6 @@ public class DomainObjectReprRenderer extends ReprRendererAbstract<DomainObjectR
}
private void addActions(final ObjectAdapter objectAdapter, final List<ObjectAction> actions, final JsonRepresentation members) {
- final LinkFollowSpecs linkFollower = getLinkFollowSpecs().follow("members");
for (final ObjectAction action : actions) {
final Consent visibility = action.isVisible(getRendererContext().getAuthenticationSession(), objectAdapter, rendererContext.getWhere());
if (!visibility.isAllowed()) {
@@ -242,8 +263,9 @@ public class DomainObjectReprRenderer extends ReprRendererAbstract<DomainObjectR
addActions(objectAdapter, subactions, members);
} else {
-
- final ObjectActionReprRenderer renderer = new ObjectActionReprRenderer(getRendererContext(), linkFollower, JsonRepresentation.newMap());
+ final LinkFollowSpecs linkFollowSpecs = getLinkFollowSpecs().follow("members["+action.getId()+"]");
+
+ final ObjectActionReprRenderer renderer = new ObjectActionReprRenderer(getRendererContext(), linkFollowSpecs, action.getId(), JsonRepresentation.newMap());
renderer.with(new ObjectAndAction(objectAdapter, action)).usingLinkTo(linkToBuilder);
http://git-wip-us.apache.org/repos/asf/isis/blob/cfe2b106/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectActionReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectActionReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectActionReprRenderer.java
index 7852044..3c147de 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectActionReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectActionReprRenderer.java
@@ -37,13 +37,13 @@ import com.google.common.collect.Lists;
public class ObjectActionReprRenderer extends AbstractObjectMemberReprRenderer<ObjectActionReprRenderer, ObjectAction> {
- public ObjectActionReprRenderer(final RendererContext resourceContext, final LinkFollowSpecs linkFollower, final JsonRepresentation representation) {
- super(resourceContext, linkFollower, RepresentationType.OBJECT_ACTION, representation, Where.OBJECT_FORMS);
+ public ObjectActionReprRenderer(final RendererContext resourceContext, final LinkFollowSpecs linkFollowSpecs, String actionId, final JsonRepresentation representation) {
+ super(resourceContext, linkFollowSpecs, actionId, RepresentationType.OBJECT_ACTION, representation, Where.OBJECT_FORMS);
}
@Override
public JsonRepresentation render() {
- // id and memberType are rendered eagerly
+ // memberType is rendered eagerly
renderMemberContent();
putDisabledReasonIfDisabled();
@@ -64,7 +64,7 @@ public class ObjectActionReprRenderer extends AbstractObjectMemberReprRenderer<O
*/
@Override
protected void followDetailsLink(final JsonRepresentation detailsLink) {
- final ObjectActionReprRenderer renderer = new ObjectActionReprRenderer(getRendererContext(), getLinkFollowSpecs(), JsonRepresentation.newMap());
+ final ObjectActionReprRenderer renderer = new ObjectActionReprRenderer(getRendererContext(), getLinkFollowSpecs(), null, JsonRepresentation.newMap());
renderer.with(new ObjectAndAction(objectAdapter, objectMember)).usingLinkTo(linkTo).asFollowed();
detailsLink.mapPut("value", renderer.render());
}
http://git-wip-us.apache.org/repos/asf/isis/blob/cfe2b106/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectCollectionReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectCollectionReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectCollectionReprRenderer.java
index e3db7c0..4d777b5 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectCollectionReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectCollectionReprRenderer.java
@@ -36,8 +36,8 @@ import com.google.common.collect.Lists;
public class ObjectCollectionReprRenderer extends AbstractObjectMemberReprRenderer<ObjectCollectionReprRenderer, OneToManyAssociation> {
- public ObjectCollectionReprRenderer(final RendererContext resourceContext, final LinkFollowSpecs linkFollower, final JsonRepresentation representation) {
- super(resourceContext, linkFollower, RepresentationType.OBJECT_COLLECTION, representation, Where.PARENTED_TABLES);
+ public ObjectCollectionReprRenderer(final RendererContext resourceContext, final LinkFollowSpecs linkFollower, final String collectionId, final JsonRepresentation representation) {
+ super(resourceContext, linkFollower, collectionId, RepresentationType.OBJECT_COLLECTION, representation, Where.PARENTED_TABLES);
}
@Override
@@ -88,7 +88,7 @@ public class ObjectCollectionReprRenderer extends AbstractObjectMemberReprRender
*/
@Override
protected void followDetailsLink(final JsonRepresentation detailsLink) {
- final ObjectCollectionReprRenderer renderer = new ObjectCollectionReprRenderer(getRendererContext(), getLinkFollowSpecs(), JsonRepresentation.newMap());
+ final ObjectCollectionReprRenderer renderer = new ObjectCollectionReprRenderer(getRendererContext(), getLinkFollowSpecs(), null, JsonRepresentation.newMap());
renderer.with(new ObjectAndCollection(objectAdapter, objectMember)).asFollowed();
detailsLink.mapPut("value", renderer.render());
}
http://git-wip-us.apache.org/repos/asf/isis/blob/cfe2b106/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectPropertyReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectPropertyReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectPropertyReprRenderer.java
index c972610..f04d0ab 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectPropertyReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectPropertyReprRenderer.java
@@ -35,8 +35,8 @@ import com.google.common.collect.Lists;
public class ObjectPropertyReprRenderer extends AbstractObjectMemberReprRenderer<ObjectPropertyReprRenderer, OneToOneAssociation> {
- public ObjectPropertyReprRenderer(final RendererContext resourceContext, final LinkFollowSpecs linkFollower, final JsonRepresentation representation) {
- super(resourceContext, linkFollower, RepresentationType.OBJECT_PROPERTY, representation, Where.OBJECT_FORMS);
+ public ObjectPropertyReprRenderer(final RendererContext resourceContext, final LinkFollowSpecs linkFollower, final String propertyId, final JsonRepresentation representation) {
+ super(resourceContext, linkFollower, propertyId, RepresentationType.OBJECT_PROPERTY, representation, Where.OBJECT_FORMS);
}
@Override
@@ -84,7 +84,7 @@ public class ObjectPropertyReprRenderer extends AbstractObjectMemberReprRenderer
*/
@Override
protected void followDetailsLink(final JsonRepresentation detailsLink) {
- final ObjectPropertyReprRenderer renderer = new ObjectPropertyReprRenderer(getRendererContext(), getLinkFollowSpecs(), JsonRepresentation.newMap());
+ final ObjectPropertyReprRenderer renderer = new ObjectPropertyReprRenderer(getRendererContext(), getLinkFollowSpecs(), null, JsonRepresentation.newMap());
renderer.with(new ObjectAndProperty(objectAdapter, objectMember)).asFollowed();
detailsLink.mapPut("value", renderer.render());
}
http://git-wip-us.apache.org/repos/asf/isis/blob/cfe2b106/component/viewer/restfulobjects/rendering/src/test/java/org/apache/isis/viewer/restfulobjects/rendering/LinkFollowSpecsTest_follow.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/test/java/org/apache/isis/viewer/restfulobjects/rendering/LinkFollowSpecsTest_follow.java b/component/viewer/restfulobjects/rendering/src/test/java/org/apache/isis/viewer/restfulobjects/rendering/LinkFollowSpecsTest_follow.java
index 3ad5e90..e6f3429 100644
--- a/component/viewer/restfulobjects/rendering/src/test/java/org/apache/isis/viewer/restfulobjects/rendering/LinkFollowSpecsTest_follow.java
+++ b/component/viewer/restfulobjects/rendering/src/test/java/org/apache/isis/viewer/restfulobjects/rendering/LinkFollowSpecsTest_follow.java
@@ -68,7 +68,7 @@ public class LinkFollowSpecsTest_follow {
}
@Test
- public void follow_withSingleCriteria() throws Exception {
+ public void follow_withSingleListCriteria() throws Exception {
final List<List<String>> links = asListOfLists("a[x=y].b.c");
final LinkFollowSpecs linkFollower = LinkFollowSpecs.create(links);
@@ -84,6 +84,23 @@ public class LinkFollowSpecsTest_follow {
}
@Test
+ public void follow_withSingleMapCriteria() throws Exception {
+ final List<List<String>> links = asListOfLists("a[x].b.c");
+
+ final LinkFollowSpecs linkFollower = LinkFollowSpecs.create(links);
+
+ assertThat(linkFollower.follow("x").isFollowing(), is(false));
+
+ final LinkFollowSpecs followA = linkFollower.follow("a");
+
+ assertThat(followA.isFollowing(), is(true));
+ assertThat(followA.matches(JsonRepresentation.newMap("x", "y")), is(true));
+ assertThat(followA.matches(JsonRepresentation.newMap("x", "z")), is(true));
+ assertThat(followA.matches(JsonRepresentation.newMap()), is(false));
+ assertThat(followA.matches(JsonRepresentation.newMap("p", "z")), is(false));
+ }
+
+ @Test
public void follow_withMultipleCriteria() throws Exception {
final List<List<String>> links = asListOfLists("a[x=y z=w].b.c");
http://git-wip-us.apache.org/repos/asf/isis/blob/cfe2b106/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
index ff95fcf..9fcbb3a 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
@@ -185,7 +185,7 @@ public final class DomainResourceHelper {
final OneToOneAssociation property = getPropertyThatIsVisibleAndUsable(propertyId, Intent.ACCESS, where);
- final ObjectPropertyReprRenderer renderer = new ObjectPropertyReprRenderer(resourceContext, null, JsonRepresentation.newMap());
+ final ObjectPropertyReprRenderer renderer = new ObjectPropertyReprRenderer(resourceContext, null, null, JsonRepresentation.newMap());
renderer.with(new ObjectAndProperty(objectAdapter, property)).usingLinkTo(adapterLinkTo);
@@ -202,7 +202,7 @@ public final class DomainResourceHelper {
final OneToManyAssociation collection = getCollectionThatIsVisibleAndUsable(collectionId, Intent.ACCESS, where);
- final ObjectCollectionReprRenderer renderer = new ObjectCollectionReprRenderer(resourceContext, null, JsonRepresentation.newMap());
+ final ObjectCollectionReprRenderer renderer = new ObjectCollectionReprRenderer(resourceContext, null, null, JsonRepresentation.newMap());
renderer.with(new ObjectAndCollection(objectAdapter, collection)).usingLinkTo(adapterLinkTo);
@@ -218,7 +218,7 @@ public final class DomainResourceHelper {
Response actionPrompt(final String actionId, Where where) {
final ObjectAction action = getObjectActionThatIsVisibleAndUsable(actionId, Intent.ACCESS, where);
- final ObjectActionReprRenderer renderer = new ObjectActionReprRenderer(resourceContext, null, JsonRepresentation.newMap());
+ final ObjectActionReprRenderer renderer = new ObjectActionReprRenderer(resourceContext, null, null, JsonRepresentation.newMap());
renderer.with(new ObjectAndAction(objectAdapter, action)).usingLinkTo(adapterLinkTo).asStandalone();
http://git-wip-us.apache.org/repos/asf/isis/blob/cfe2b106/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java
index f9e4e47..86156ef 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java
@@ -76,7 +76,9 @@ public class DomainServiceResourceServerside extends ResourceAbstract implements
final ObjectAdapter serviceAdapter = getServiceAdapter(serviceId);
final DomainObjectReprRenderer renderer = new DomainObjectReprRenderer(getResourceContext(), null, JsonRepresentation.newMap());
- renderer.usingLinkToBuilder(new DomainServiceLinkTo()).with(serviceAdapter).includesSelf();
+ renderer.usingLinkToBuilder(new DomainServiceLinkTo())
+ .with(serviceAdapter)
+ .includesSelf();
return responseOfOk(renderer, Caching.ONE_DAY).build();
}
http://git-wip-us.apache.org/repos/asf/isis/blob/cfe2b106/component/viewer/restfulobjects/tck/ide/eclipse/launch/viewer-json-tck.launch
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/ide/eclipse/launch/viewer-json-tck.launch b/component/viewer/restfulobjects/tck/ide/eclipse/launch/viewer-json-tck.launch
index eacbe85..53bd401 100644
--- a/component/viewer/restfulobjects/tck/ide/eclipse/launch/viewer-json-tck.launch
+++ b/component/viewer/restfulobjects/tck/ide/eclipse/launch/viewer-json-tck.launch
@@ -14,6 +14,6 @@
<booleanAttribute key="org.eclipse.jdt.debug.ui.INCLUDE_EXTERNAL_JARS" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.apache.isis.WebServer"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.apache.isis.viewer.json-tck"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="isis-viewer-restfulobjects-tck"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
</launchConfiguration>
http://git-wip-us.apache.org/repos/asf/isis/blob/cfe2b106/component/viewer/restfulobjects/tck/src/main/webapp/WEB-INF/isis.properties
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/main/webapp/WEB-INF/isis.properties b/component/viewer/restfulobjects/tck/src/main/webapp/WEB-INF/isis.properties
index 4bd7fbb..03b05ca 100644
--- a/component/viewer/restfulobjects/tck/src/main/webapp/WEB-INF/isis.properties
+++ b/component/viewer/restfulobjects/tck/src/main/webapp/WEB-INF/isis.properties
@@ -15,13 +15,11 @@
# specific language governing permissions and limitations
# under the License.
-isis.persistor=in-memory
-
isis.authentication=bypass
isis.authorization=bypass
isis.user-profile-store=in-memory
-
+isis.persistor=in-memory
isis.services.prefix = org.apache.isis.core.tck.dom
isis.services =\
@@ -40,7 +38,8 @@ isis.services =\
refs.UnidirReferencedEntityRepository,\
refs.UnidirReferencingEntityRepository,\
defaults.WithDefaultsEntityRepository,\
- defaults.HiddenRepository
+ defaults.HiddenRepository,\
+ busrules.BusRulesEntityRepository
isis.fixtures.prefix= org.apache.isis.core.tck.fixture
@@ -51,7 +50,7 @@ isis.fixtures=\
scalars.PrimitiveValuedEntityFixture,\
scalars.WrapperValuedEntityFixture,\
refs.ParentEntitiesFixture,\
- defaults.WithDefaultsEntityFixture
-
+ defaults.WithDefaultsEntityFixture,\
+ busrules.BusRulesEntityFixture
http://git-wip-us.apache.org/repos/asf/isis/blob/cfe2b106/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 8aabfcf..7e655d7 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.isArray;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
@@ -37,6 +37,7 @@ 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;
@@ -47,6 +48,7 @@ import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRe
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 static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.*;
public class DomainServiceTest_req_queryarg_xrofollowlinks {
@@ -61,51 +63,107 @@ public class DomainServiceTest_req_queryarg_xrofollowlinks {
client = new RestfulClient(webServer.getBase());
}
- @Ignore("todo... the service Id is wrong")
@Test
- public void withCriteria() throws Exception {
+ public void self() throws Exception {
+ final String href = givenHrefToService("WrapperValuedEntities");
- final String href = givenHrefToService("simples");
+ final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, href).withArg(RequestParameter.FOLLOW_LINKS, "links[rel=self]");
+ final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
- final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, href).withArg(RequestParameter.FOLLOW_LINKS, "members[id=%s].links[rel=details]", "list");
+ 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 toMembers() 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, isArray());
+ assertThat(membersList, isMap());
JsonRepresentation actionRepr;
- actionRepr = membersList.getRepresentation("[id=%s]", "list");
- assertThat(actionRepr.getRepresentation("links[rel=details]"), is(not(nullValue())));
- assertThat(actionRepr.getRepresentation("links[rel=details].value"), is(not(nullValue()))); // followed
+ actionRepr = membersList.getRepresentation("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("[id=%s]", "newTransientEntity");
- assertThat(actionRepr.getRepresentation("links[rel=details]"), is(not(nullValue())));
- assertThat(actionRepr.getRepresentation("links[rel=details].value"), is(nullValue())); // not
- // 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
}
- @Ignore("todo")
@Test
- public void toSelf() throws Exception {
-
- }
+ public void singleMember_specified_by_criteria() throws Exception {
- @Ignore("todo")
- @Test
- public void toDescribedBy() 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
}
- @Ignore("todo")
@Test
- public void toMembers() throws Exception {
-
- // no need to do an individual member, that's been tested already elsewhere
+ public void multipleMembers() 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 {
@@ -113,7 +171,7 @@ public class DomainServiceTest_req_queryarg_xrofollowlinks {
final Response response = resource.services();
final ListRepresentation services = RestfulResponse.<ListRepresentation> ofT(response).getEntity();
- return services.getRepresentation("values[id=%s]", serviceId).asLink().getHref();
+ return services.getRepresentation("value[rel=urn:org.restfulobjects:rels/service;serviceId=\"%s\"]", serviceId).asLink().getHref();
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/cfe2b106/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 b988766..a58cfe4 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
@@ -23,13 +23,13 @@ import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.a
import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
-import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.CoreMatchers.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.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;
http://git-wip-us.apache.org/repos/asf/isis/blob/cfe2b106/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/busrules/BusRulesEntity.java
----------------------------------------------------------------------
diff --git a/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/busrules/BusRulesEntity.java b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/busrules/BusRulesEntity.java
new file mode 100644
index 0000000..447ddfb
--- /dev/null
+++ b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/busrules/BusRulesEntity.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.core.tck.dom.busrules;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.isis.applib.AbstractDomainObject;
+import org.apache.isis.applib.annotation.ActionSemantics;
+import org.apache.isis.applib.annotation.Disabled;
+import org.apache.isis.applib.annotation.Hidden;
+import org.apache.isis.applib.annotation.MemberOrder;
+import org.apache.isis.applib.annotation.ObjectType;
+import org.apache.isis.applib.annotation.ActionSemantics.Of;
+
+@javax.jdo.annotations.PersistenceCapable
+@javax.jdo.annotations.Discriminator("BSRL")
+@javax.jdo.annotations.Query(
+ name="prmv_findByIntProperty", language="JDOQL",
+ value="SELECT FROM org.apache.isis.tck.dom.busrules.BusRulesEntity WHERE intProperty == :i")
+@ObjectType("BSRL")
+public class BusRulesEntity extends AbstractDomainObject {
+
+ // {{ Id (Integer)
+ private Integer id;
+
+ @javax.jdo.annotations.PrimaryKey // must be on the getter.
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(final Integer id) {
+ this.id = id;
+ }
+ // }}
+
+ // {{ Title
+ public String title() {
+ return null;
+ }
+ // }}
+
+
+ // {{ visibleAndEditableProperty
+ private int visibleAndEditableProperty;
+
+ @MemberOrder(sequence = "1")
+ public int getVisibleAndEditableProperty() {
+ return visibleAndEditableProperty;
+ }
+
+ public void setVisibleAndEditableProperty(final int intProperty) {
+ this.visibleAndEditableProperty = intProperty;
+ }
+ // }}
+
+
+ // {{ visibleButNotEditableProperty
+ private int visibleButNotEditableProperty;
+
+ @Disabled
+ @MemberOrder(sequence = "2")
+ public int getVisibleButNotEditableProperty() {
+ return visibleButNotEditableProperty;
+ }
+
+ public void setVisibleButNotEditableProperty(final int intProperty) {
+ this.visibleButNotEditableProperty = intProperty;
+ }
+ // }}
+
+ // {{ invisibleProperty
+ private int invisibleProperty;
+
+ @Hidden
+ @MemberOrder(sequence = "3")
+ public int getInvisibleProperty() {
+ return invisibleProperty;
+ }
+
+ public void setInvisibleProperty(final int intProperty) {
+ this.invisibleProperty = intProperty;
+ }
+ // }}
+
+
+ // {{ VisibleAndEditableCollection (Collection)
+ private List<BusRulesEntityChild> editableCollection = new ArrayList<BusRulesEntityChild>();
+
+ @MemberOrder(sequence = "11")
+ public List<BusRulesEntityChild> getVisibleAndEditableCollection() {
+ return editableCollection;
+ }
+
+ public void setVisibleAndEditableCollection(final List<BusRulesEntityChild> children) {
+ this.editableCollection = children;
+ }
+ // }}
+
+
+ // {{ VisibleButNotEditableCollection (Collection)
+ private List<BusRulesEntityChild> notEditableCollection = new ArrayList<BusRulesEntityChild>();
+
+ @MemberOrder(sequence = "11")
+ public List<BusRulesEntityChild> getVisibleButNotEditableCollection() {
+ return notEditableCollection;
+ }
+
+ public void setVisibleButNotEditableCollection(final List<BusRulesEntityChild> children) {
+ this.notEditableCollection = children;
+ }
+ // }}
+
+ // {{ InvisibleCollection (Collection)
+ private List<BusRulesEntityChild> invisibleCollection = new ArrayList<BusRulesEntityChild>();
+
+ @MemberOrder(sequence = "11")
+ public List<BusRulesEntityChild> getInvisibleCollection() {
+ return invisibleCollection;
+ }
+
+ public void setInvisibleCollection(final List<BusRulesEntityChild> children) {
+ this.invisibleCollection = children;
+ }
+ // }}
+
+ @ActionSemantics(Of.SAFE)
+ @MemberOrder(sequence = "1")
+ public BusRulesEntity visibleAndInvokableAction() {
+ return this;
+ }
+
+ @Disabled
+ @ActionSemantics(Of.SAFE)
+ @MemberOrder(sequence = "1")
+ public BusRulesEntity visibleButUninvokableAction() {
+ return this;
+ }
+
+ @Hidden
+ @ActionSemantics(Of.SAFE)
+ @MemberOrder(sequence = "1")
+ public BusRulesEntity invisibleAction() {
+ return this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cfe2b106/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/busrules/BusRulesEntityChild.java
----------------------------------------------------------------------
diff --git a/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/busrules/BusRulesEntityChild.java b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/busrules/BusRulesEntityChild.java
new file mode 100644
index 0000000..5011c23
--- /dev/null
+++ b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/busrules/BusRulesEntityChild.java
@@ -0,0 +1,55 @@
+/*
+ * 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.core.tck.dom.busrules;
+
+import org.apache.isis.applib.AbstractDomainObject;
+import org.apache.isis.applib.annotation.ObjectType;
+
+@javax.jdo.annotations.PersistenceCapable
+@javax.jdo.annotations.Discriminator("BSRC")
+@javax.jdo.annotations.Query(
+ name="prmv_findByIntProperty", language="JDOQL",
+ value="SELECT FROM org.apache.isis.tck.dom.busrules.BusRulesEntityChild WHERE intProperty == :i")
+@ObjectType("BSRC")
+public class BusRulesEntityChild extends AbstractDomainObject {
+
+
+ // {{ Id (Integer)
+ private Integer id;
+
+ @javax.jdo.annotations.PrimaryKey // must be on the getter.
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(final Integer id) {
+ this.id = id;
+ }
+ // }}
+
+ // {{ Title
+ public String title() {
+ return null;
+ }
+ // }}
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cfe2b106/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/busrules/BusRulesEntityRepository.java
----------------------------------------------------------------------
diff --git a/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/busrules/BusRulesEntityRepository.java b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/busrules/BusRulesEntityRepository.java
new file mode 100644
index 0000000..cc1a814
--- /dev/null
+++ b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/busrules/BusRulesEntityRepository.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.core.tck.dom.busrules;
+
+import org.apache.isis.applib.annotation.ActionSemantics;
+import org.apache.isis.applib.annotation.ActionSemantics.Of;
+import org.apache.isis.applib.annotation.Disabled;
+import org.apache.isis.applib.annotation.Hidden;
+import org.apache.isis.applib.annotation.MemberOrder;
+import org.apache.isis.applib.annotation.Named;
+import org.apache.isis.applib.annotation.ObjectType;
+import org.apache.isis.applib.query.Query;
+import org.apache.isis.applib.query.QueryDefault;
+import org.apache.isis.core.tck.dom.AbstractEntityRepository;
+
+@Named("BusinessRulesEntities")
+@ObjectType("BusinessRulesEntities")
+public class BusRulesEntityRepository extends AbstractEntityRepository<BusRulesEntity> {
+
+ public BusRulesEntityRepository() {
+ super(BusRulesEntity.class, "BusinessRulesEntities");
+ }
+
+ @ActionSemantics(Of.SAFE)
+ @MemberOrder(sequence = "1")
+ public BusRulesEntity findById(int id) {
+ final Query<BusRulesEntity> query =
+ new QueryDefault<BusRulesEntity>(BusRulesEntity.class, BusRulesEntity.class.getName() + "#pk", "id", id);
+ return this.firstMatch(query);
+ }
+
+
+ @ActionSemantics(Of.SAFE)
+ @MemberOrder(sequence = "1")
+ public BusRulesEntity visibleAndInvokableAction(int id) {
+ return this.findById(id);
+ }
+
+ @Disabled
+ @ActionSemantics(Of.SAFE)
+ @MemberOrder(sequence = "1")
+ public BusRulesEntity visibleButUninvokableAction(int id) {
+ return this.findById(id);
+ }
+
+ @Hidden
+ @ActionSemantics(Of.SAFE)
+ @MemberOrder(sequence = "1")
+ public BusRulesEntity invisibleAction(int id) {
+ return this.findById(id);
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cfe2b106/core/tck/tck-fixture/src/main/java/org/apache/isis/core/tck/fixture/busrules/BusRulesEntityFixture.java
----------------------------------------------------------------------
diff --git a/core/tck/tck-fixture/src/main/java/org/apache/isis/core/tck/fixture/busrules/BusRulesEntityFixture.java b/core/tck/tck-fixture/src/main/java/org/apache/isis/core/tck/fixture/busrules/BusRulesEntityFixture.java
new file mode 100644
index 0000000..e31578e
--- /dev/null
+++ b/core/tck/tck-fixture/src/main/java/org/apache/isis/core/tck/fixture/busrules/BusRulesEntityFixture.java
@@ -0,0 +1,50 @@
+/*
+ * 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.core.tck.fixture.busrules;
+
+import org.apache.isis.applib.fixtures.AbstractFixture;
+import org.apache.isis.core.tck.dom.busrules.BusRulesEntity;
+import org.apache.isis.core.tck.dom.busrules.BusRulesEntityRepository;
+
+public class BusRulesEntityFixture extends AbstractFixture {
+
+ @Override
+ public void install() {
+ createEntity(1);
+ createEntity(2);
+ createEntity(3);
+ createEntity(4);
+ createEntity(5);
+ }
+
+ private BusRulesEntity createEntity(Integer id) {
+ final BusRulesEntity entity = repository.newEntity();
+ entity.setId(id);
+ return entity;
+ }
+
+ // {{ injected: WithDefaultsEntityRepository
+ private BusRulesEntityRepository repository;
+
+ public void setBusRulesEntityRepository(final BusRulesEntityRepository repository) {
+ this.repository = repository;
+ }
+ // }}
+
+}
[07/50] [abbrv] ISIS-233-ro: testing domainservices_services resource
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_representation.java
deleted file mode 100644
index 5dae3b8..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_representation.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.restfulobjects.tck.resources.domainService;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
-import static org.hamcrest.CoreMatchers.*;
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.CoreMatchers.endsWith;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-
-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.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.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 DomainServiceResourceTest_services_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 ListRepresentation repr = givenRepresentation();
-
- // 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(endsWith(":39393/"))
- .httpMethod(RestfulHttpMethod.GET)
- .type(RepresentationType.HOME_PAGE.getMediaType())
- .returning(HttpStatusCode.OK)
- .responseEntityWithSelfHref(link.getHref())
- );
- }
- }
-
- private ListRepresentation givenRepresentation() throws JsonParseException, JsonMappingException, IOException {
- final RestfulResponse<ListRepresentation> jsonResp = RestfulResponse.ofT(resource.services());
- return jsonResp.getEntity();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_responseHeaders.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_responseHeaders.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_responseHeaders.java
deleted file mode 100644
index 499ff45..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_responseHeaders.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.resources.domainService;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.CacheControl;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.apache.isis.core.webserver.WebServer;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.Header;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class DomainServiceResourceTest_services_responseHeaders {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
- private DomainServiceResource resource;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
- resource = client.getDomainServiceResource();
- }
-
-
- @Test
- public void contentType_and_cacheControl() throws Exception {
- // given
- final Response resp = resource.services();
-
- // when
- final RestfulResponse<ListRepresentation> restfulResponse = RestfulResponse.ofT(resp);
-
- // then
- final MediaType contentType = restfulResponse.getHeader(Header.CONTENT_TYPE);
- assertThat(contentType, hasType("application"));
- assertThat(contentType, hasSubType("json"));
- assertThat(contentType, hasParameter("profile", "urn:org.restfulobjects:repr-types/list"));
- assertThat(contentType, is(RepresentationType.LIST.getMediaType()));
-
- // then
- final CacheControl cacheControl = restfulResponse.getHeader(Header.CACHE_CONTROL);
- assertThat(cacheControl, hasMaxAge(24 * 60 * 60));
- assertThat(cacheControl.getMaxAge(), is(24 * 60 * 60));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_xrofollowlinks.java
deleted file mode 100644
index a50a2da..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_xrofollowlinks.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.resources.domainService;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
-import static org.hamcrest.CoreMatchers.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.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.domainobjects.ListRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.user.UserRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class DomainServiceResourceTest_services_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())));
- }
-
-
- // TODO: split up this test?
- @Test
- public void services_withFollowLinks() throws Exception {
-
- RestfulRequest request;
- RestfulResponse<ListRepresentation> restfulResponse;
- ListRepresentation repr;
-
- request = client.createRequest(RestfulHttpMethod.GET, "services");
- restfulResponse = request.executeT();
- repr = restfulResponse.getEntity();
-
- assertThat(repr.getValue(), isArray());
- assertThat(repr.getValue().size(), is(greaterThan(0)));
- assertThat(repr.getValue().arrayGet(0), isLink().novalue());
-
- request = client.createRequest(RestfulHttpMethod.GET, "services")
- .withArg(RequestParameter.FOLLOW_LINKS, "value");
- restfulResponse = request.executeT();
- repr = restfulResponse.getEntity();
-
- assertThat(repr.getValue().arrayGet(0), isLink().value(is(not(nullValue(JsonRepresentation.class)))));
- assertThat(repr.getValue().arrayGet(0).getRepresentation("value"), isMap());
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_acceptHeader.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_acceptHeader.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_acceptHeader.java
deleted file mode 100644
index b05aed1..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_acceptHeader.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.restfulobjects.tck.resources.home;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.MediaType;
-
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.jboss.resteasy.client.ClientRequest;
-import org.jboss.resteasy.client.ClientResponse;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class HomePageResourceTest_acceptHeader {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- private RestfulRequest request;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
- request = client.createRequest(RestfulHttpMethod.GET, "/");
- }
-
- @Test
- public void applicationJson_noProfile_returns200() throws Exception {
-
- request.withHeader(RestfulRequest.Header.ACCEPT, MediaType.APPLICATION_JSON_TYPE);
- final RestfulResponse<HomePageRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- assertThat(restfulResponse.getHeader(RestfulResponse.Header.CONTENT_TYPE), is(RepresentationType.HOME_PAGE.getMediaType()));
- }
-
- @Test
- public void applicationJson_profileHomePage_returns200() throws Exception {
-
- request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.HOME_PAGE.getMediaType());
- final RestfulResponse<HomePageRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- }
-
- @Test
- public void missingHeader_returns200() throws Exception {
-
- final RestfulResponse<HomePageRepresentation> restfulResp = request.executeT();
-
- assertThat(restfulResp.getStatus(), is(HttpStatusCode.OK));
- }
-
- @Test
- public void applicationJson_profileIncorrect_returns406() throws Exception {
-
- request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.USER.getMediaType());
- final RestfulResponse<HomePageRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
- }
-
- @Test
- public void incorrectMediaType_returnsNotAcceptable() throws Exception {
-
- // given
- final ClientRequest clientRequest = client.getClientRequestFactory().createRelativeRequest("/");
- clientRequest.accept(MediaType.APPLICATION_ATOM_XML_TYPE);
-
- // when
- final ClientResponse<?> resp = clientRequest.get();
- final RestfulResponse<JsonRepresentation> restfulResp = RestfulResponse.of(resp);
-
- // then
- assertThat(restfulResp.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_representation.java
deleted file mode 100644
index b8221b1..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_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.resources.home;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
-import static org.hamcrest.CoreMatchers.endsWith;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status.Family;
-
-import org.apache.isis.viewer.restfulobjects.applib.Rel;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageResource;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class HomePageResourceTest_representation {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
- private HomePageResource resource;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
- resource = client.getHomePageResource();
- }
-
- @Test
- public void representation() throws Exception {
-
- // given
- final Response resp = resource.homePage();
-
- // when
- final RestfulResponse<HomePageRepresentation> restfulResponse = RestfulResponse.ofT(resp);
- assertThat(restfulResponse.getStatus().getFamily(), is(Family.SUCCESSFUL));
-
- // then
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
-
- final HomePageRepresentation repr = restfulResponse.getEntity();
- assertThat(repr, is(not(nullValue())));
- assertThat(repr, isMap());
-
- assertThat(repr.getSelf(), isLink(client)
- .rel(Rel.SELF)
- .href(endsWith(":39393/"))
- .httpMethod(RestfulHttpMethod.GET)
- .type(RepresentationType.HOME_PAGE.getMediaType())
- .returning(HttpStatusCode.OK)
- );
- assertThat(repr.getUser(), isLink(client)
- .rel(Rel.USER)
- .href(endsWith(":39393/user"))
- .httpMethod(RestfulHttpMethod.GET)
- .type(RepresentationType.USER.getMediaType())
- .returning(HttpStatusCode.OK)
- );
- assertThat(repr.getServices(), isLink(client)
- .rel(Rel.SERVICES)
- .href(endsWith(":39393/services"))
- .httpMethod(RestfulHttpMethod.GET)
- .type(RepresentationType.LIST.getMediaType())
- .returning(HttpStatusCode.OK)
- );
- assertThat(repr.getVersion(), isLink(client)
- .rel(Rel.VERSION)
- .href(endsWith(":39393/version"))
- .httpMethod(RestfulHttpMethod.GET)
- .type(RepresentationType.VERSION.getMediaType())
- .returning(HttpStatusCode.OK)
- );
-
- assertThat(repr.getLinks(), isArray());
- assertThat(repr.getExtensions(), isMap());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_responseHeaders.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_responseHeaders.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_responseHeaders.java
deleted file mode 100644
index f4d8231..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_responseHeaders.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.resources.home;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.CacheControl;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.Header;
-import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageResource;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class HomePageResourceTest_responseHeaders {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
- private HomePageResource resource;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
- resource = client.getHomePageResource();
- }
-
-
- @Test
- public void contentType_and_cacheControl() throws Exception {
- // given
- final Response resp = resource.homePage();
-
- // when
- final RestfulResponse<HomePageRepresentation> restfulResponse = RestfulResponse.ofT(resp);
-
- // then
- final MediaType contentType = restfulResponse.getHeader(Header.CONTENT_TYPE);
- assertThat(contentType, hasType("application"));
- assertThat(contentType, hasSubType("json"));
- assertThat(contentType, hasParameter("profile", "urn:org.restfulobjects:repr-types/homepage"));
- assertThat(contentType, is(RepresentationType.HOME_PAGE.getMediaType()));
-
- // then
- final CacheControl cacheControl = restfulResponse.getHeader(Header.CACHE_CONTROL);
- assertThat(cacheControl, hasMaxAge(24 * 60 * 60));
- assertThat(cacheControl.getMaxAge(), is(24 * 60 * 60));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_xrofollowlinks.java
deleted file mode 100644
index 4af1ad0..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_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.resources.home;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.Rel;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.RequestParameter;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class HomePageResourceTest_xrofollowlinks {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- private RestfulRequest request;
- private RestfulResponse<HomePageRepresentation> restfulResponse;
- private HomePageRepresentation repr;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
-
- }
-
- @Test
- public void noFollow() throws Exception {
- request = client.createRequest(RestfulHttpMethod.GET, "");
- restfulResponse = request.executeT();
- repr = restfulResponse.getEntity();
-
- assertThat(repr.getSelf().getValue(), is(nullValue()));
- assertThat(repr.getUser().getValue(), is(nullValue()));
- assertThat(repr.getVersion().getValue(), is(nullValue()));
- assertThat(repr.getServices().getValue(), is(nullValue()));
- }
-
- @Test
- public void self() throws Exception {
-
- repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.SELF.getName() + "]");
-
- assertThat(repr.getSelf().getValue(), is(not(nullValue())));
- }
-
- @Test
- public void user() throws Exception {
-
- repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.USER.getName() + "]");
-
- assertThat(repr.getUser().getValue(), is(not(nullValue())));
- }
-
- @Test
- public void services() throws Exception {
-
- repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.SERVICES.getName() + "]");
-
- assertThat(repr.getServices().getValue(), is(not(nullValue())));
- }
-
- @Test
- public void version() throws Exception {
-
- repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.VERSION.getName() + "]");
-
- assertThat(repr.getVersion().getValue(), is(not(nullValue())));
- }
-
- @Test
- public void multiple() throws Exception {
-
- repr = whenExecuteAndFollowLinksUsing("/",
- "links[rel=" + Rel.USER.getName() + "]," +
- "links[rel=" + Rel.SERVICES.getName() + "]," +
- "links[rel=" + Rel.VERSION.getName() + "]");
-
- assertThat(repr.getServices().getValue(), is(not(nullValue())));
- assertThat(repr.getUser().getValue(), is(not(nullValue())));
- assertThat(repr.getVersion().getValue(), is(not(nullValue())));
- }
-
- @Test
- public void allServices_Value() throws Exception {
-
- repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.SERVICES.getName() + "].value");
-
- final JsonRepresentation servicesValue = repr.getServices().getValue();
- assertThat(servicesValue, is(not(nullValue())));
- assertThat(servicesValue, isMap());
- final JsonRepresentation serviceLinkList = servicesValue.getArray("value");
- assertThat(serviceLinkList, isArray());
-
- JsonRepresentation service;
-
- service = serviceLinkList.getRepresentation("[rel=%s;serviceId=\"%s\"]", Rel.SERVICE.getName(), "JdkValuedEntities");
- assertThat(service, isMap());
- assertThat(service.getRepresentation("value"), is(not(nullValue())));
-
- service = serviceLinkList.getRepresentation("[rel=%s;serviceId=\"%s\"]", Rel.SERVICE.getName(), "WrapperValuedEntities");
- assertThat(service, isMap());
- assertThat(service.getRepresentation("value"), is(not(nullValue())));
- }
-
- @Test
- public void selectedService_Value() throws Exception {
-
- repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.SERVICES.getName() + "].value[rel=" + Rel.SERVICE.andParam("serviceId", "WrapperValuedEntities")+"]");
-
- final JsonRepresentation servicesValue = repr.getServices().getValue();
- assertThat(servicesValue, is(not(nullValue())));
- assertThat(servicesValue, isMap());
- final JsonRepresentation serviceLinkList = servicesValue.getArray("value");
- assertThat(serviceLinkList, isArray());
-
- JsonRepresentation service;
-
- service = serviceLinkList.getRepresentation("[rel=%s;serviceId=\"%s\"]", Rel.SERVICE.getName(), "WrapperValuedEntities");
- assertThat(service, isMap());
- assertThat(service.getRepresentation("value"), is(not(nullValue())));
-
- service = serviceLinkList.getRepresentation("[rel=%s;serviceId=\"%s\"]", Rel.SERVICE.getName(), "JdkValuedEntities");
- assertThat(service.getRepresentation("value"), is(nullValue()));
- }
-
- private HomePageRepresentation whenExecuteAndFollowLinksUsing(final String uriTemplate, final String followLinks) throws JsonParseException, JsonMappingException, IOException {
- request = client.createRequest(RestfulHttpMethod.GET, uriTemplate).withArg(RequestParameter.FOLLOW_LINKS, followLinks);
- restfulResponse = request.executeT();
- return restfulResponse.getEntity();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/object/DomainObjectResourceTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/object/DomainObjectResourceTest.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/object/DomainObjectResourceTest.java
deleted file mode 100644
index 23df8f8..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/object/DomainObjectResourceTest.java
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.restfulobjects.tck.resources.object;
-
-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.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 DomainObjectResourceTest {
-
- @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());
- }
-
- @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())));
- }
-
- @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()));
- }
-
- @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()));
- }
-
- @Test
- public void domainObjectRepresentation_hasTitle() throws Exception {
-
- // given, when
- final DomainObjectRepresentation domainObjectRepr = givenDomainObjectRepresentationFor("OID","32");
-
- // then
- assertThat(domainObjectRepr.getTitle(), is("parent 4 - child 2"));
- }
-
- @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"));
- }
-
- @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));
-
- }
-
- @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/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/invoke/DomainServiceResourceTest_invokeAction.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/invoke/DomainServiceResourceTest_invokeAction.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/invoke/DomainServiceResourceTest_invokeAction.java
deleted file mode 100644
index 913867e..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/invoke/DomainServiceResourceTest_invokeAction.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.restfulobjects.tck.resources.service.invoke;
-
-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 DomainServiceResourceTest_invokeAction {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- @SuppressWarnings("unused")
- private DomainServiceResource resource;
-
- @Before
- public void setUp() throws Exception {
- final WebServer webServer = webServerRule.getWebServer();
- client = new RestfulClient(webServer.getBase());
-
- resource = client.getDomainServiceResource();
- }
-
- @Ignore("TODO - fix broken test resulting from introduction of actionresult repr")
- @Test
- public void invokeQueryOnly_noArg_usingClientFollow() throws Exception {
-
- // given
- final JsonRepresentation givenAction = givenAction("simples", "list");
- final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
-
- // when
- final LinkRepresentation invokeLink = actionRepr.getInvoke();
-
- // then
- assertThat(invokeLink, is(not(nullValue())));
- final RestfulResponse<ListRepresentation> restfulResponse = client.followT(invokeLink);
- final ListRepresentation listRepr = restfulResponse.getEntity();
-
- assertThat(listRepr.getValue().size(), is(5));
- }
-
- @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/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_accept.java
deleted file mode 100644
index 730c0c2..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_accept.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.restfulobjects.tck.resources.service.serviceId;
-
-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.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.webserver.WebServer;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-
-public class DomainServiceResourceTest_serviceId_accept {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- @Before
- public void setUp() throws Exception {
- final WebServer webServer = webServerRule.getWebServer();
- client = new RestfulClient(webServer.getBase());
- }
-
- @Test
- public void applicationJson() throws Exception {
-
- final String href = givenLinkToService();
-
- final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, href).withHeader(RestfulRequest.Header.ACCEPT, MediaType.APPLICATION_JSON_TYPE);
- final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- }
-
- @Test
- public void applicationJson_profileList() throws Exception {
-
- final String href = givenLinkToService();
-
- final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, href).withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.DOMAIN_OBJECT.getMediaType());
- final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- }
-
- @Test
- public void applicationJson_invalid() throws Exception {
-
- final String href = givenLinkToService();
-
- final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, href).withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.USER.getMediaType());
- final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
- }
-
- private String givenLinkToService() throws JsonParseException, JsonMappingException, IOException {
- final DomainServiceResource resource = client.getDomainServiceResource();
- final Response response = resource.services();
- final ListRepresentation services = RestfulResponse.<ListRepresentation> ofT(response).getEntity();
-
- final String href = services.getRepresentation("values[id=%s]", "simples").asLink().getHref();
- return href;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_notFound.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_notFound.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_notFound.java
deleted file mode 100644
index 13b6aff..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_notFound.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.restfulobjects.tck.resources.service.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.core.webserver.WebServer;
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-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.tck.IsisWebServerRule;
-
-public class DomainServiceResourceTest_serviceId_notFound {
-
- @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 notFound() throws Exception {
-
- // when
- final Response resp = resource.service("nonExistentServiceId");
- final RestfulResponse<JsonRepresentation> jsonResp = RestfulResponse.of(resp);
-
- // then
- assertThat(jsonResp.getStatus(), is(HttpStatusCode.NOT_FOUND));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_representationAndHeaders.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_representationAndHeaders.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_representationAndHeaders.java
deleted file mode 100644
index b2cf19d..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_representationAndHeaders.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.restfulobjects.tck.resources.service.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.isFollowableLinkToSelf;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
-import static org.hamcrest.CoreMatchers.is;
-import static org.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.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.webserver.WebServer;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.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 DomainServiceResourceTest_serviceId_representationAndHeaders {
-
- @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 {
-
- // given
- final Response resp = resource.service("simples");
-
- // when
- final RestfulResponse<DomainObjectRepresentation> jsonResp = RestfulResponse.ofT(resp);
-
- // then
- assertThat(jsonResp.getStatus(), is(HttpStatusCode.OK));
-
- final DomainObjectRepresentation repr = jsonResp.getEntity();
-
- assertThat(repr, isMap());
-
- assertThat(repr.getSelf(), isLink().httpMethod(RestfulHttpMethod.GET));
- assertThat(repr.getOid(), matches("OID[:].+"));
- assertThat(repr.getTitle(), matches("Simples"));
-
- assertThat(repr.getMembers(), isArray());
-
- assertThat(repr.getLinks(), isArray());
- assertThat(repr.getExtensions(), isMap());
- }
-
- @Test
- public void headers() throws Exception {
- // given
- final Response resp = resource.service("simples");
-
- // 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()));
- assertThat(jsonResp.getHeader(RestfulResponse.Header.CACHE_CONTROL).getMaxAge(), is(24 * 60 * 60));
- }
-
- @Test
- public void self_isFollowable() throws Exception {
- // given
- final DomainObjectRepresentation repr = givenRepresentation("simples");
-
- // when, then
- assertThat(repr, isFollowableLinkToSelf(client));
- }
-
- @Test
- public void links() throws Exception {
- // given, when
- final DomainObjectRepresentation repr = givenRepresentation("simples");
-
- // then
- assertThat(repr.getLinks().size(), is(3));
- }
-
- private DomainObjectRepresentation givenRepresentation(final String serviceId) throws JsonParseException, JsonMappingException, IOException {
- final RestfulResponse<DomainObjectRepresentation> jsonResp = RestfulResponse.ofT(resource.service(serviceId));
- return jsonResp.getEntity();
- }
-
-}
[17/50] [abbrv] git commit: ISIS-233: domainservice.serviceId testing
of repr.
Posted by da...@apache.org.
ISIS-233: domainservice.serviceId testing of repr.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/c0e6f1d7
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/c0e6f1d7
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/c0e6f1d7
Branch: refs/heads/master
Commit: c0e6f1d763c90720f30a2cd06191f5f70e88d315
Parents: cfe2b10
Author: Dan Haywood <da...@apache.org>
Authored: Tue Mar 5 23:51:40 2013 +0000
Committer: Dan Haywood <da...@apache.org>
Committed: Sat Apr 27 18:57:40 2013 +0100
----------------------------------------------------------------------
...ainServiceTest_req_queryarg_xrofollowlinks.java | 5 +-
.../DomainServiceTest_resp_representation.java | 70 +++++++++++++--
.../tck/dom/busrules/BusRulesEntityRepository.java | 4 +-
3 files changed, 67 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/c0e6f1d7/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 7e655d7..4021e98 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
@@ -90,7 +90,7 @@ public class DomainServiceTest_req_queryarg_xrofollowlinks {
}
@Test
- public void toMembers() throws Exception {
+ 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());
@@ -139,7 +139,7 @@ public class DomainServiceTest_req_queryarg_xrofollowlinks {
}
@Test
- public void multipleMembers() throws Exception {
+ public void toMultipleMembersDetails() throws Exception {
final String href = givenHrefToService("WrapperValuedEntities");
@@ -164,7 +164,6 @@ public class DomainServiceTest_req_queryarg_xrofollowlinks {
}
-
private String givenHrefToService(final String serviceId) throws JsonParseException, JsonMappingException, IOException {
final DomainServiceResource resource = client.getDomainServiceResource();
http://git-wip-us.apache.org/repos/asf/isis/blob/c0e6f1d7/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 a58cfe4..fea89c7 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
@@ -23,11 +23,13 @@ import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.a
import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.CoreMatchers.endsWith;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
+import javax.ws.rs.HttpMethod;
import javax.ws.rs.core.Response;
import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
@@ -40,6 +42,7 @@ import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectMe
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.Ignore;
import org.junit.Rule;
@@ -125,23 +128,76 @@ public class DomainServiceTest_resp_representation {
}
- @Ignore("todo")
+
@Test
- public void disabledAction() throws Exception {
+ 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 {
- // has a disabledRead
+ // 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));
}
- @Ignore("todo")
@Test
- public void nonExistentAction() throws Exception {
+ public void invisibleAction() throws Exception {
+ // given
+ final Response resp = resource.service("BusinessRulesEntities");
- // eg...
- // DomainObjectMemberRepresentation listMemberRepr = repr.getAction("foobar");
+ // 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/c0e6f1d7/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/busrules/BusRulesEntityRepository.java
----------------------------------------------------------------------
diff --git a/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/busrules/BusRulesEntityRepository.java b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/busrules/BusRulesEntityRepository.java
index cc1a814..456f514 100644
--- a/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/busrules/BusRulesEntityRepository.java
+++ b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/busrules/BusRulesEntityRepository.java
@@ -49,14 +49,14 @@ public class BusRulesEntityRepository extends AbstractEntityRepository<BusRulesE
@ActionSemantics(Of.SAFE)
@MemberOrder(sequence = "1")
- public BusRulesEntity visibleAndInvokableAction(int id) {
+ public BusRulesEntity visibleAndInvocableAction(int id) {
return this.findById(id);
}
@Disabled
@ActionSemantics(Of.SAFE)
@MemberOrder(sequence = "1")
- public BusRulesEntity visibleButUninvokableAction(int id) {
+ public BusRulesEntity visibleButNotInvocableAction(int id) {
return this.findById(id);
}
[25/50] [abbrv] git commit: ISIS-233,
ISIS-361: validate non-parseable parameters, more tests for RO
Posted by da...@apache.org.
ISIS-233, ISIS-361: validate non-parseable parameters, more tests for RO
* validation of invalid arguments when invoking service actions.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/7bc86916
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/7bc86916
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/7bc86916
Branch: refs/heads/master
Commit: 7bc8691649c5f25960d6223d277a2121af34c56d
Parents: b4dd583
Author: Dan Haywood <da...@apache.org>
Authored: Thu Mar 14 09:35:58 2013 +0000
Committer: Dan Haywood <da...@apache.org>
Committed: Sat Apr 27 19:01:20 2013 +0100
----------------------------------------------------------------------
.../applib/client/RestfulResponse.java | 4 -
.../rendering/domainobjects/JsonValueEncoder.java | 7 +-
.../RestfulObjectsApplicationExceptionMapper.java | 34 ++--
.../server/resources/DomainResourceHelper.java | 36 +---
...stfulObjectsApplicationExceptionMapperTest.java | 36 ++--
.../server/util/UrlParserUtilsTest.java | 8 +-
...mainServiceTest_req_safe_arg_bad_malformed.java | 124 +++++++++++
...ServiceTest_req_safe_optionalarg_resp_list.java | 164 +++++++++++++++
.../DomainServiceTest_req_safe_refarg_bad.java | 36 ++--
..._req_safe_simplearg_fail_mandatory_missing.java | 137 ++++++++++++
.../specloader/specimpl/ObjectActionImpl.java | 3 -
.../specimpl/ObjectActionParameterAbstract.java | 65 ++++++
.../specimpl/ObjectActionParameterParseable.java | 69 ++-----
.../specimpl/OneToOneActionParameterImpl.java | 17 +-
.../MustSatisfySpecificationOnParameterFacet.java | 3 +
.../tck/dom/actions/ActionsEntityRepository.java | 22 ++
16 files changed, 616 insertions(+), 149 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/7bc86916/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java
index 758179c..c1869ac 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java
@@ -30,17 +30,13 @@ import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.Response.Status.Family;
import javax.ws.rs.core.Response.StatusType;
-import org.apache.isis.core.commons.lang.StringUtils;
import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ActionResultRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.errors.ErrorRepresentation;
import org.apache.isis.viewer.restfulobjects.applib.util.JsonMapper;
import org.apache.isis.viewer.restfulobjects.applib.util.Parser;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
-import com.google.common.base.Strings;
import com.google.common.collect.Maps;
public class RestfulResponse<T> {
http://git-wip-us.apache.org/repos/asf/isis/blob/7bc86916/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/JsonValueEncoder.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/JsonValueEncoder.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/JsonValueEncoder.java
index 6628dfc..1165c40 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/JsonValueEncoder.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/JsonValueEncoder.java
@@ -48,12 +48,15 @@ public final class JsonValueEncoder {
argRepr.mapPut("invalidReason", reason);
throw new IllegalArgumentException(reason);
}
- final JsonRepresentation argValueRepr = argRepr.getRepresentation("value");
- if(argValueRepr == null) {
+ if(!argRepr.mapHas("value")) {
String reason = "No 'value' key";
argRepr.mapPut("invalidReason", reason);
throw new IllegalArgumentException(reason);
}
+ final JsonRepresentation argValueRepr = argRepr.getRepresentation("value");
+ if(argValueRepr == null) {
+ return null;
+ }
if (!argValueRepr.isValue()) {
String reason = "Representation must be of a value";
argRepr.mapPut("invalidReason", reason);
http://git-wip-us.apache.org/repos/asf/isis/blob/7bc86916/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapper.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapper.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapper.java
index 524c43f..a2b7587 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapper.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapper.java
@@ -56,6 +56,23 @@ public class RestfulObjectsApplicationExceptionMapper implements ExceptionMapper
return builder.build();
}
+ static String bodyFor(final RestfulObjectsApplicationException ex) {
+ final JsonRepresentation jsonRepresentation = ex.getBody();
+ if (jsonRepresentation != null) {
+ return jsonRepresentation.toString();
+ }
+ Throwable cause = ex.getCause();
+ if(cause == null) {
+ return null;
+ }
+ try {
+ return JsonMapper.instance().write(ExceptionPojo.create(cause));
+ } catch (final Exception e) {
+ // fallback
+ return "{ \"exception\": \"" + ExceptionUtils.getFullStackTrace(cause) + "\" }";
+ }
+ }
+
private static class ExceptionPojo {
public static ExceptionPojo create(final Throwable ex) {
@@ -114,20 +131,5 @@ public class RestfulObjectsApplicationExceptionMapper implements ExceptionMapper
}
- static String bodyFor(final RestfulObjectsApplicationException ex) {
- final JsonRepresentation jsonRepresentation = ex.getBody();
- if (jsonRepresentation != null) {
- return jsonRepresentation.toString();
- }
- Throwable cause = ex.getCause();
- if(cause == null) {
- return null;
- }
- try {
- return JsonMapper.instance().write(ExceptionPojo.create(cause));
- } catch (final Exception e) {
- // fallback
- return "{ \"exception\": \"" + ExceptionUtils.getFullStackTrace(cause) + "\" }";
- }
- }
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/7bc86916/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
index 67d546d..74d7cdf 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
@@ -445,7 +445,7 @@ public final class DomainResourceHelper {
final List<ObjectAdapter> argAdapters = Lists.newArrayList();
final List<ObjectActionParameter> parameters = action.getParameters();
- final StringBuilder invalidReasonBuf = new StringBuilder();
+ boolean valid = true;
for (int i = 0; i < argList.size(); i++) {
final JsonRepresentation argRepr = argList.get(i);
final ObjectSpecification paramSpec = parameters.get(i).getSpecification();
@@ -455,22 +455,15 @@ public final class DomainResourceHelper {
// validate individual arg
final ObjectActionParameter parameter = parameters.get(i);
- if (argAdapter == null) {
- // can only happen if this is an optional parameter; nothing to
- // do
- continue;
- }
- if (argAdapter.getSpecification().containsFacet(ValueFacet.class)) {
- final Object argPojo = argAdapter.getObject();
- final String reasonNotValid = parameter.isValid(objectAdapter, argPojo, null);
- if (reasonNotValid != null) {
- argRepr.mapPut("invalidReason", reasonNotValid);
- appendReasonTo(invalidReasonBuf, "Validation failed, see body for details");
- }
+ final Object argPojo = argAdapter!=null?argAdapter.getObject():null;
+ final String reasonNotValid = parameter.isValid(objectAdapter, argPojo, null);
+ if (reasonNotValid != null) {
+ argRepr.mapPut("invalidReason", reasonNotValid);
+ valid = false;
}
} catch (final IllegalArgumentException e) {
- String reason = e.getMessage();
- appendReasonTo(invalidReasonBuf, reason);
+ argAdapters.add(null);
+ valid = false;
}
}
@@ -479,23 +472,16 @@ public final class DomainResourceHelper {
final Consent consent = action.isProposedArgumentSetValid(objectAdapter, argArray);
if (consent.isVetoed()) {
arguments.mapPut("x-ro-invalidReason", consent.getReason());
- appendReasonTo(invalidReasonBuf, "Validation failed, see body for details");
+ valid = false;
}
- if(invalidReasonBuf.length()>0) {
- throw RestfulObjectsApplicationException.createWithBody(HttpStatusCode.VALIDATION_FAILED, arguments, invalidReasonBuf.toString());
+ if(!valid) {
+ throw RestfulObjectsApplicationException.createWithBody(HttpStatusCode.VALIDATION_FAILED, arguments, "Validation failed, see body for details");
}
return argAdapters;
}
- private void appendReasonTo(final StringBuilder buf, String reason) {
- if(buf.length()>0) {
- buf.append("; ");
- }
- buf.append(reason);
- }
-
private static List<JsonRepresentation> argListFor(final ObjectAction action, final JsonRepresentation arguments) {
final List<JsonRepresentation> argList = Lists.newArrayList();
http://git-wip-us.apache.org/repos/asf/isis/blob/7bc86916/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapperTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapperTest.java b/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapperTest.java
index 6aa9834..3f68110 100644
--- a/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapperTest.java
+++ b/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapperTest.java
@@ -57,14 +57,7 @@ public class RestfulObjectsApplicationExceptionMapperTest {
// and then
final String entity = (String) response.getEntity();
- assertThat(entity, is(not(nullValue())));
- final JsonRepresentation jsonRepr = JsonMapper.instance().read(entity, JsonRepresentation.class);
-
- // then
- assertThat(jsonRepr.getString("message"), is(nullValue()));
- assertThat(jsonRepr.getArray("stackTrace"), is(not(nullValue())));
- assertThat(jsonRepr.getArray("stackTrace").size(), is(greaterThan(0)));
- assertThat(jsonRepr.getRepresentation("causedBy"), is(nullValue()));
+ assertThat(entity, is(nullValue()));
}
@Test
@@ -81,18 +74,34 @@ public class RestfulObjectsApplicationExceptionMapperTest {
// and then
final String entity = (String) response.getEntity();
+ assertThat(entity, is(nullValue()));
+ }
+
+ @Test
+ public void entity_forException() throws Exception {
+ // given
+ final Exception exception = new Exception("barfoo");
+ final RestfulObjectsApplicationException ex = RestfulObjectsApplicationException.createWithCauseAndMessage(HttpStatusCode.BAD_REQUEST, exception, "foobar");
+
+ // when
+ final Response response = exceptionMapper.toResponse(ex);
+ final String entity = (String) response.getEntity();
assertThat(entity, is(not(nullValue())));
final JsonRepresentation jsonRepr = JsonMapper.instance().read(entity, JsonRepresentation.class);
// then
- assertThat(jsonRepr.getString("message"), is(ex.getMessage()));
+ assertThat((String) response.getMetadata().get("Warning").get(0), is("199 RestfulObjects foobar"));
+ assertThat(jsonRepr.getString("message"), is("barfoo"));
+ final JsonRepresentation causedByRepr = jsonRepr.getRepresentation("causedBy");
+ assertThat(causedByRepr, is(nullValue()));
}
@Test
- public void entity_withCause() throws Exception {
+ public void entity_forExceptionWithCause() throws Exception {
// given
- final Exception cause = new Exception("barfoo");
- final RestfulObjectsApplicationException ex = RestfulObjectsApplicationException.createWithCauseAndMessage(HttpStatusCode.BAD_REQUEST, cause, "foobar");
+ final Exception cause = new Exception("bozfoz");
+ final Exception exception = new Exception("barfoo", cause);
+ final RestfulObjectsApplicationException ex = RestfulObjectsApplicationException.createWithCauseAndMessage(HttpStatusCode.BAD_REQUEST, exception, "foobar");
// when
final Response response = exceptionMapper.toResponse(ex);
@@ -101,7 +110,8 @@ public class RestfulObjectsApplicationExceptionMapperTest {
final JsonRepresentation jsonRepr = JsonMapper.instance().read(entity, JsonRepresentation.class);
// then
- assertThat(jsonRepr.getString("message"), is(ex.getMessage()));
+ assertThat((String) response.getMetadata().get("Warning").get(0), is("199 RestfulObjects foobar"));
+ assertThat(jsonRepr.getString("message"), is("barfoo"));
final JsonRepresentation causedByRepr = jsonRepr.getRepresentation("causedBy");
assertThat(causedByRepr, is(not(nullValue())));
assertThat(causedByRepr.getString("message"), is(cause.getMessage()));
http://git-wip-us.apache.org/repos/asf/isis/blob/7bc86916/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/util/UrlParserUtilsTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/util/UrlParserUtilsTest.java b/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/util/UrlParserUtilsTest.java
index f564834..47c5686 100644
--- a/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/util/UrlParserUtilsTest.java
+++ b/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/util/UrlParserUtilsTest.java
@@ -28,7 +28,7 @@ public class UrlParserUtilsTest {
@Test
public void oidFromLink() throws Exception {
final JsonRepresentation link = JsonRepresentation.newMap();
- link.mapPut("href", "http://localhost/objects/OID:1");
+ link.mapPut("href", "http://localhost/objects/OID/1");
final String oidFromHref = UrlParserUtils.encodedOidFromLink(link);
assertEquals("OID:1", oidFromHref);
}
@@ -36,7 +36,7 @@ public class UrlParserUtilsTest {
@Test
public void domainTypeFromLink() throws Exception {
final JsonRepresentation link = JsonRepresentation.newMap();
- link.mapPut("href", "http://localhost/domainTypes/com.mycompany.myapp.Customer");
+ link.mapPut("href", "http://localhost/domain-types/com.mycompany.myapp.Customer");
final String oidFromHref = UrlParserUtils.domainTypeFrom(link);
assertEquals("com.mycompany.myapp.Customer", oidFromHref);
}
@@ -44,7 +44,7 @@ public class UrlParserUtilsTest {
@Test
public void domainTypeFromLinkTrailingSlash() throws Exception {
final JsonRepresentation link = JsonRepresentation.newMap();
- link.mapPut("href", "http://localhost/domainTypes/com.mycompany.myapp.Customer/");
+ link.mapPut("href", "http://localhost/domain-types/com.mycompany.myapp.Customer/");
final String oidFromHref = UrlParserUtils.domainTypeFrom(link);
assertEquals("com.mycompany.myapp.Customer", oidFromHref);
}
@@ -52,7 +52,7 @@ public class UrlParserUtilsTest {
@Test
public void domainTypeFromLinkFollowingStuff() throws Exception {
final JsonRepresentation link = JsonRepresentation.newMap();
- link.mapPut("href", "http://localhost/domainTypes/com.mycompany.myapp.Customer/otherStuffHere");
+ link.mapPut("href", "http://localhost/domain-types/com.mycompany.myapp.Customer/otherStuffHere");
final String oidFromHref = UrlParserUtils.domainTypeFrom(link);
assertEquals("com.mycompany.myapp.Customer", oidFromHref);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/7bc86916/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
new file mode 100644
index 0000000..6196072
--- /dev/null
+++ 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
@@ -0,0 +1,124 @@
+/*
+ * 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.*;
+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.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 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_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/7bc86916/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
new file mode 100644
index 0000000..56195dc
--- /dev/null
+++ 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
@@ -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.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/7bc86916/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
index d31ca0e..c93b407 100644
--- 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
@@ -20,6 +20,7 @@ package org.apache.isis.viewer.restfulobjects.tck.domainservice.serviceId.action
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;
@@ -82,26 +83,10 @@ public class DomainServiceTest_req_safe_refarg_bad {
RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+ // 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("'href' does not reference a known entity"));
-
- // 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"));
- }
-
-
@Test
public void usingResourceProxy() throws Exception {
@@ -117,8 +102,25 @@ public class DomainServiceTest_req_safe_refarg_bad {
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/7bc86916/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
new file mode 100644
index 0000000..2116f54
--- /dev/null
+++ 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
@@ -0,0 +1,137 @@
+/*
+ * 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_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.mapPut("from.value", (Integer)null);
+ args.mapPut("to.value", 0);
+
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ // then
+ thenResponseIsErrorWithInvalidReason(restfulResponse);
+ }
+
+ @Ignore("to write")
+ @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("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/7bc86916/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionImpl.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionImpl.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionImpl.java
index cc5e5b7..4bb5fd1 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionImpl.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionImpl.java
@@ -379,9 +379,6 @@ public class ObjectActionImpl extends ObjectMemberAbstract implements ObjectActi
final InteractionResultSet resultSet = new InteractionResultSet();
final List<ObjectActionParameter> actionParameters = getParameters();
if (proposedArguments != null) {
- // TODO: doesn't seem to be used...
- // ObjectAdapter[] params = realParameters(object,
- // proposedArguments);
for (int i = 0; i < proposedArguments.length; i++) {
final ValidityContext<?> ic = actionParameters.get(i).createProposedArgumentInteractionContext(getAuthenticationSession(), invocationMethod, object, proposedArguments, i);
InteractionUtils.isValidResultSet(getParameter(i), ic, resultSet);
http://git-wip-us.apache.org/repos/asf/isis/blob/7bc86916/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionParameterAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionParameterAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionParameterAbstract.java
index ea86b46..75951be 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionParameterAbstract.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionParameterAbstract.java
@@ -25,6 +25,7 @@ import com.google.common.collect.Lists;
import org.apache.isis.applib.Identifier;
import org.apache.isis.applib.filter.Filter;
+import org.apache.isis.applib.profiles.Localization;
import org.apache.isis.applib.query.Query;
import org.apache.isis.applib.query.QueryFindAllInstances;
import org.apache.isis.core.commons.authentication.AuthenticationSession;
@@ -36,6 +37,7 @@ import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
import org.apache.isis.core.metamodel.consent.Allow;
import org.apache.isis.core.metamodel.consent.Consent;
import org.apache.isis.core.metamodel.consent.InteractionInvocationMethod;
+import org.apache.isis.core.metamodel.consent.InteractionResultSet;
import org.apache.isis.core.metamodel.deployment.DeploymentCategory;
import org.apache.isis.core.metamodel.facetapi.Facet;
import org.apache.isis.core.metamodel.facetapi.MultiTypedFacet;
@@ -44,9 +46,12 @@ import org.apache.isis.core.metamodel.facets.describedas.DescribedAsFacet;
import org.apache.isis.core.metamodel.facets.mandatory.MandatoryFacet;
import org.apache.isis.core.metamodel.facets.named.NamedFacet;
import org.apache.isis.core.metamodel.facets.object.bounded.BoundedFacetUtils;
+import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
import org.apache.isis.core.metamodel.facets.param.choices.ActionParameterChoicesFacet;
import org.apache.isis.core.metamodel.facets.param.defaults.ActionParameterDefaultsFacet;
import org.apache.isis.core.metamodel.interactions.ActionArgumentContext;
+import org.apache.isis.core.metamodel.interactions.InteractionUtils;
+import org.apache.isis.core.metamodel.interactions.ValidityContext;
import org.apache.isis.core.metamodel.spec.DomainModelException;
import org.apache.isis.core.metamodel.spec.ObjectSpecification;
import org.apache.isis.core.metamodel.spec.SpecificationLoader;
@@ -307,6 +312,66 @@ public abstract class ObjectActionParameterAbstract implements ObjectActionParam
return getAuthenticationSessionProvider().getAuthenticationSession();
}
+
+
+ // /////////////////////////////////////////////////////////////
+ // Validation
+ // /////////////////////////////////////////////////////////////
+
+ @Override
+ public String isValid(final ObjectAdapter adapter, final Object proposedValue, final Localization localization) {
+
+ ObjectAdapter proposedValueAdapter = null;
+ ObjectSpecification proposedValueSpec;
+ if(proposedValue != null) {
+ proposedValueAdapter = getAdapterMap().adapterFor(proposedValue);
+ proposedValueSpec = proposedValueAdapter.getSpecification();
+ if(!proposedValueSpec.isOfType(proposedValueSpec)) {
+ proposedValueAdapter = doCoerceProposedValue(adapter, proposedValue, localization);
+ }
+
+ // check has been coerced into correct type; otherwise give up
+ if(proposedValueAdapter == null) {
+ return null;
+ }
+ proposedValueSpec = proposedValueAdapter.getSpecification();
+ if(!proposedValueSpec.isOfType(proposedValueSpec)) {
+ return null;
+ }
+ }
+
+
+ final ValidityContext<?> ic = createProposedArgumentInteractionContext(getAuthenticationSession(), InteractionInvocationMethod.BY_USER, adapter, arguments(proposedValueAdapter), getNumber());
+
+ final InteractionResultSet buf = new InteractionResultSet();
+ InteractionUtils.isValidResultSet(this, ic, buf);
+ if (buf.isVetoed()) {
+ return buf.getInteractionResult().getReason();
+ }
+ return null;
+
+ }
+
+ /**
+ * Optional hook for parsing.
+ */
+ protected ObjectAdapter doCoerceProposedValue(ObjectAdapter adapter, Object proposedValue, final Localization localization) {
+ return null;
+ }
+
+ /**
+ * TODO: this is not ideal, because we can only populate the array for
+ * single argument, rather than the entire argument set. Instead, we ought
+ * to do this in two passes, one to build up the argument set as a single
+ * unit, and then validate each in turn.
+ */
+ private ObjectAdapter[] arguments(final ObjectAdapter proposedValue) {
+ final int parameterCount = getAction().getParameterCount();
+ final ObjectAdapter[] arguments = new ObjectAdapter[parameterCount];
+ arguments[getNumber()] = proposedValue;
+ return arguments;
+ }
+
// /////////////////////////////////////////////////////////////
// Dependencies (from parent)
// /////////////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/isis/blob/7bc86916/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionParameterParseable.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionParameterParseable.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionParameterParseable.java
index 44de1c9..b976b9c 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionParameterParseable.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionParameterParseable.java
@@ -67,67 +67,24 @@ public class ObjectActionParameterParseable extends ObjectActionParameterAbstrac
final TypicalLengthFacet facet = getFacet(TypicalLengthFacet.class);
return facet.value();
}
-
- /**
- * Invoked when tab away, disables the OK button.
- *
- * <p>
- * Assumed to be invoked {@link InteractionInvocationMethod#BY_USER by user}.
- */
- @Override
- public String isValid(final ObjectAdapter adapter, final Object proposedValue, final Localization localization) {
-
-
- final ObjectActionParameter parameter = getAction().getParameters().get(getNumber());
- final ObjectSpecification parameterSpecification = parameter.getSpecification();
- if(proposedValue == null) {
+
+ protected ObjectAdapter doCoerceProposedValue(ObjectAdapter adapter, Object proposedValue, final Localization localization) {
+ // try to parse
+ if (!(proposedValue instanceof String)) {
return null;
}
-
- ObjectAdapter proposedValueAdapter = getAdapterMap().adapterFor(proposedValue);
- final ObjectSpecification proposedValueSpec = proposedValueAdapter.getSpecification();
- if(proposedValueSpec.isOfType(proposedValueSpec)) {
- // nothing to do
- } else {
- // try to parse
- if (!(parameter instanceof ParseableEntryActionParameter)) {
- return null;
- }
- if (!(proposedValue instanceof String)) {
- return null;
- }
- final String proposedString = (String) proposedValue;
-
- final ParseableFacet p = parameterSpecification.getFacet(ParseableFacet.class);
- proposedValueAdapter = p.parseTextEntry(null, proposedString, localization);
- }
-
- final ValidityContext<?> ic = parameter.createProposedArgumentInteractionContext(getAuthenticationSession(), InteractionInvocationMethod.BY_USER, adapter, arguments(proposedValueAdapter), getNumber());
-
- final InteractionResultSet buf = new InteractionResultSet();
- InteractionUtils.isValidResultSet(parameter, ic, buf);
- if (buf.isVetoed()) {
- return buf.getInteractionResult().getReason();
+ final String proposedString = (String) proposedValue;
+
+ final ObjectSpecification parameterSpecification = getSpecification();
+ final ParseableFacet p = parameterSpecification.getFacet(ParseableFacet.class);
+ try {
+ final ObjectAdapter parsedAdapter = p.parseTextEntry(null, proposedString, localization);
+ return parsedAdapter;
+ } catch(Exception ex) {
+ return null;
}
- return null;
-
}
- /**
- * TODO: this is not ideal, because we can only populate the array for
- * single argument, rather than the entire argument set. Instead, we ought
- * to do this in two passes, one to build up the argument set as a single
- * unit, and then validate each in turn.
- *
- * @param proposedValue
- * @return
- */
- private ObjectAdapter[] arguments(final ObjectAdapter proposedValue) {
- final int parameterCount = getAction().getParameterCount();
- final ObjectAdapter[] arguments = new ObjectAdapter[parameterCount];
- arguments[getNumber()] = proposedValue;
- return arguments;
- }
// /////////////////////////////////////////////////////////////
// getInstance
http://git-wip-us.apache.org/repos/asf/isis/blob/7bc86916/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/OneToOneActionParameterImpl.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/OneToOneActionParameterImpl.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/OneToOneActionParameterImpl.java
index 325e2f6..88e69d7 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/OneToOneActionParameterImpl.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/OneToOneActionParameterImpl.java
@@ -22,10 +22,18 @@ package org.apache.isis.core.metamodel.specloader.specimpl;
import org.apache.isis.applib.profiles.Localization;
import org.apache.isis.core.metamodel.adapter.MutableProposedHolder;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.consent.InteractionInvocationMethod;
+import org.apache.isis.core.metamodel.consent.InteractionResultSet;
import org.apache.isis.core.metamodel.facetapi.FeatureType;
import org.apache.isis.core.metamodel.facets.TypedHolder;
+import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
+import org.apache.isis.core.metamodel.interactions.InteractionUtils;
+import org.apache.isis.core.metamodel.interactions.ValidityContext;
import org.apache.isis.core.metamodel.spec.Instance;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
import org.apache.isis.core.metamodel.spec.feature.OneToOneActionParameter;
+import org.apache.isis.core.metamodel.spec.feature.ParseableEntryActionParameter;
public class OneToOneActionParameterImpl extends ObjectActionParameterAbstract implements OneToOneActionParameter {
@@ -43,15 +51,6 @@ public class OneToOneActionParameterImpl extends ObjectActionParameterAbstract i
return true;
}
- /**
- * TODO: need to be able to validate parameters individually, eg if have
- * <tt>RegEx</tt> annotation; should delegate to the Check framework
- * instead.
- */
- @Override
- public String isValid(final ObjectAdapter adapter, final Object proposedValue, final Localization localization) {
- return null;
- }
// /////////////////////////////////////////////////////////////
// getInstance
http://git-wip-us.apache.org/repos/asf/isis/blob/7bc86916/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/validate/perspec/MustSatisfySpecificationOnParameterFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/validate/perspec/MustSatisfySpecificationOnParameterFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/validate/perspec/MustSatisfySpecificationOnParameterFacet.java
index 6b7e667..e09b2ca 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/validate/perspec/MustSatisfySpecificationOnParameterFacet.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/param/validate/perspec/MustSatisfySpecificationOnParameterFacet.java
@@ -52,6 +52,9 @@ public class MustSatisfySpecificationOnParameterFacet extends FacetAbstract impl
}
final ProposedHolder proposedHolder = (ProposedHolder) validityContext;
final ObjectAdapter targetNO = proposedHolder.getProposed();
+ if(targetNO == null) {
+ return null;
+ }
final Object targetObject = targetNO.getObject();
final ReasonBuffer buf = new ReasonBuffer();
for (final Specification specification : specifications) {
http://git-wip-us.apache.org/repos/asf/isis/blob/7bc86916/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java
----------------------------------------------------------------------
diff --git a/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java
index 1c89a73..a517b9a 100644
--- a/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java
+++ b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java
@@ -27,6 +27,7 @@ import org.apache.isis.applib.annotation.MemberOrder;
import org.apache.isis.applib.annotation.MustSatisfy;
import org.apache.isis.applib.annotation.Named;
import org.apache.isis.applib.annotation.ObjectType;
+import org.apache.isis.applib.annotation.Optional;
import org.apache.isis.applib.query.Query;
import org.apache.isis.applib.query.QueryDefault;
import org.apache.isis.applib.spec.Specification;
@@ -84,4 +85,25 @@ public class ActionsEntityRepository extends AbstractEntityRepository<ActionsEnt
return integer.intValue() < 0? "Cannot be less than zero": null;
}
}
+
+
+ @ActionSemantics(Of.SAFE)
+ @MemberOrder(sequence = "1")
+ public List<ActionsEntity> subListWithOptionalRange(
+ @Optional
+ @MustSatisfy(IntegerCannotBeNegative.class)
+ @Named("from") Integer from,
+ @Optional
+ @MustSatisfy(IntegerCannotBeNegative.class)
+ @Named("to") Integer to) {
+ return subList(valueElseDefault(from, 0), valueElseDefault(to, Integer.MAX_VALUE));
+ }
+
+ public String validateSubListWithOptionalRange(final Integer from, final Integer to) {
+ return validateSubList(valueElseDefault(from, 0), valueElseDefault(to, Integer.MAX_VALUE));
+ }
+
+ private static int valueElseDefault(Integer value, int i) {
+ return value != null? value: i;
+ }
}
[30/50] [abbrv] ISIS-233: adding new test stubs (TODOs)
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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())));
- }
-
-}
[42/50] [abbrv] git commit: ISIS-233: more stub test cases.
Posted by da...@apache.org.
ISIS-233: more stub test cases.
Reckon that's pretty close; time to start writing them, now!
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/cf0bc337
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/cf0bc337
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/cf0bc337
Branch: refs/heads/master
Commit: cf0bc337fc5d7d83edd16354322e134866a9011f
Parents: be2b3ec
Author: Dan Haywood <da...@apache.org>
Authored: Thu Apr 18 09:57:17 2013 +0100
Committer: Dan Haywood <da...@apache.org>
Committed: Sat Apr 27 19:01:32 2013 +0100
----------------------------------------------------------------------
.../viewer/restfulobjects/tck/README-testcases.txt | 63 ++++++
.../oid/Delete_thenResponseCode_205_bad_TODO.java | 5 -
.../oid/Delete_thenResponseCode_405_bad_TODO.java | 5 +
...enHiddenMembers_thenRepresentation_ok_TODO.java | 5 +
..._thenResponseHeaders_ContentLength_ok_TODO.java | 61 ++++++
...et_thenResponseHeaders_ContentType_ok_TODO.java | 61 ++++++
...enDoesntExistOid_thenResponseCode_404_TODO.java | 5 +
.../Get_whenQueryArg_xRoDomainModel_ok_TODO.java | 5 +
.../oid/Post_thenResponseCode_205_bad_TODO.java | 5 -
.../oid/Post_thenResponseCode_405_bad_TODO.java | 5 +
...ut_givenDisabled_thenResponseCode_203_TODO.java | 5 +
...venEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java | 5 +
...tag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java | 5 +
.../oid/Put_thenRepresentation_TODO.java | 5 +
.../oid/Put_thenResponseCode_200_ok_TODO.java | 5 +
...t_thenResponseHeaders_CacheControl_ok_TODO.java | 61 ++++++
..._thenResponseHeaders_ContentLength_ok_TODO.java | 61 ++++++
...ut_thenResponseHeaders_ContentType_ok_TODO.java | 61 ++++++
.../oid/Put_thenResponseHeaders_eTag_ok_TODO.java | 5 +
...IsHrefAndLinksToNonExistentEntity_bad_TODO.java | 5 +
..._andQueryArg_XRoValidateOnly_then_4xx_TODO.java | 5 +
..._andQueryArg_XRoValidateOnly_then_2xx_TODO.java | 5 +
.../Put_whenArgMandatoryButMissing_bad_TODO.java | 5 +
.../oid/Put_whenArgValueIsInvalid_bad_TODO.java | 5 +
...nArgsValid_thenMultiplePropertyUpdate_TODO.java | 5 +
...enDoesntExistOid_thenResponseCode_404_TODO.java | 5 +
.../oid/Put_whenMultiplePropertyUpdate_TODO.java | 5 -
...te_givenDisabled_thenResponseCode_203_TODO.java | 5 +
...lete_givenHidden_thenResponseCode_404_TODO.java | 5 +
.../Delete_thenResponseCode_200_ok_TODO.java | 5 +
...e_thenResponseHeaders_CacheControl_ok_TODO.java | 61 ++++++
..._thenResponseHeaders_ContentLength_ok_TODO.java | 61 ++++++
...te_thenResponseHeaders_ContentType_ok_TODO.java | 61 ++++++
.../Delete_thenResponseHeaders_eTag_ok_TODO.java | 5 +
...rgHrefAndLinksToEntityOfWrongType_bad_TODO.java | 5 +
...tityThatExistsButIsNotInCollection_ok_TODO.java | 5 +
...rgHrefAndLinksToNonExistentEntity_bad_TODO.java | 5 +
.../Delete_whenArgIsMalformed_bad_TODO.java | 5 +
...Delete_whenArgMandatoryButMissing_bad_TODO.java | 5 +
...id_thenEntityRemovedFromCollection_ok_TODO.java | 5 +
...valid_andQueryArg_XRoValidateOnly_4xx_TODO.java | 5 +
.../Delete_whenArgValueIsInvalid_bad_TODO.java | 5 +
...Valid_andQueryArg_XRoValidateOnly_2xx_TODO.java | 5 +
...nDoesntExistColl_thenResponseCode_404_TODO.java | 5 +
...enDoesntExistOid_thenResponseCode_404_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 -
.../Get_thenResponseCode_200_ok_TODO.java | 5 +
..._thenResponseHeaders_ContentLength_ok_TODO.java | 61 ++++++
...et_thenResponseHeaders_ContentType_ok_TODO.java | 61 ++++++
.../Get_thenResponseHeaders_eTag_ok_TODO.java | 5 +
.../Get_whenArg_thenResponseCode_205_bad_TODO.java | 5 +
...nDoesntExistColl_thenResponseCode_404_TODO.java | 5 +
...enDoesntExistOid_thenResponseCode_404_TODO.java | 5 +
.../oid/collection/Get_whenHrefArg_bad_TODO.java | 5 -
..._whenHrefArg_thenResponseCode_205_bad_TODO.java | 5 -
.../Get_whenQueryArg_xRoDomainModel_ok_TODO.java | 5 +
...st_givenDisabled_thenResponseCode_203_TODO.java | 5 +
...tion_whenArgIsHrefAndLinksToEntity_ok_TODO.java | 5 +
...ollection_whenHrefArgLinksToEntity_ok_TODO.java | 5 -
...venEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java | 5 +
...tag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java | 5 +
...Post_givenHidden_thenResponseCode_404_TODO.java | 5 +
.../Post_thenResponseCode_200_ok_TODO.java | 5 +
...t_thenResponseHeaders_CacheControl_ok_TODO.java | 61 ++++++
..._thenResponseHeaders_ContentLength_ok_TODO.java | 61 ++++++
...st_thenResponseHeaders_ContentType_ok_TODO.java | 61 ++++++
.../Post_thenResponseHeaders_eTag_ok_TODO.java | 5 +
...IsHrefAndLinksToEntityOfWrongType_bad_TODO.java | 5 +
...IsHrefAndLinksToNonExistentEntity_bad_TODO.java | 5 +
.../Post_whenArgIsMalformed_bad_TODO.java | 5 +
.../Post_whenArgMandatoryButMissing_bad_TODO.java | 5 +
...gValid_thenEntityAddedToCollection_ok_TODO.java | 5 +
...valid_andQueryArg_XRoValidateOnly_4xx_TODO.java | 5 +
.../Post_whenArgValueIsInvalid_bad_TODO.java | 5 +
...Valid_andQueryArg_XRoValidateOnly_2xx_TODO.java | 5 +
...nDoesntExistColl_thenResponseCode_404_TODO.java | 5 +
...enDoesntExistOid_thenResponseCode_404_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 -
...ut_givenDisabled_thenResponseCode_203_TODO.java | 5 +
...lection_whenArgsValid_thenNoChange_ok_TODO.java | 5 +
...llection_whenHrefArgLinksToEntity_bad_TODO.java | 5 -
...alid_thenEntityAddedFromCollection_ok_TODO.java | 5 +
...venEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java | 5 +
...tag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java | 5 +
.../Put_givenHidden_thenResponseCode_404_TODO.java | 5 +
.../Put_thenResponseCode_200_ok_TODO.java | 5 +
...t_thenResponseHeaders_CacheControl_ok_TODO.java | 61 ++++++
..._thenResponseHeaders_ContentLength_ok_TODO.java | 61 ++++++
...ut_thenResponseHeaders_ContentType_ok_TODO.java | 61 ++++++
.../Put_thenResponseHeaders_eTag_ok_TODO.java | 5 +
...IsHrefAndLinksToEntityOfWrongType_bad_TODO.java | 5 +
...IsHrefAndLinksToNonExistentEntity_bad_TODO.java | 5 +
.../Put_whenArgIsMalformed_bad_TODO.java | 5 +
.../Put_whenArgMandatoryButMissing_bad_TODO.java | 5 +
...gValid_thenEntityAddedToCollection_ok_TODO.java | 5 +
...valid_andQueryArg_XRoValidateOnly_4xx_TODO.java | 5 +
.../Put_whenArgValueIsInvalid_bad_TODO.java | 5 +
...Valid_andQueryArg_XRoValidateOnly_2xx_TODO.java | 5 +
...nDoesntExistColl_thenResponseCode_404_TODO.java | 5 +
...enDoesntExistOid_thenResponseCode_404_TODO.java | 5 +
.../collection/Put_whenInvalidArg_bad_TODO.java | 5 -
.../oid/collection/Put_whenNoArg_bad_TODO.java | 5 -
...te_givenDisabled_thenResponseCode_203_TODO.java | 5 +
...lete_givenHidden_thenResponseCode_404_TODO.java | 5 +
.../Delete_thenPropertyValueCleared_ok_TODO.java | 5 +
.../Delete_thenResponseCode_200_ok_TODO.java | 5 +
...e_thenResponseHeaders_CacheControl_ok_TODO.java | 61 ++++++
..._thenResponseHeaders_ContentLength_ok_TODO.java | 61 ++++++
...te_thenResponseHeaders_ContentType_ok_TODO.java | 61 ++++++
.../Delete_thenResponseHeaders_eTag_ok_TODO.java | 5 +
.../Delete_whenArgs_thenResponseCode_4xx_TODO.java | 5 +
...enDoesntExistOid_thenResponseCode_404_TODO.java | 5 +
...nDoesntExistProp_thenResponseCode_404_TODO.java | 5 +
.../oid/property/Delete_whenNoArg_bad_TODO.java | 5 -
...t_givenDisabled_thenRepresentation_ok_TODO.java | 5 +
.../property/Get_thenResponseCode_200_ok_TODO.java | 5 +
...t_thenResponseHeaders_CacheControl_ok_TODO.java | 61 ++++++
..._thenResponseHeaders_ContentLength_ok_TODO.java | 61 ++++++
...et_thenResponseHeaders_ContentType_ok_TODO.java | 61 ++++++
.../Get_thenResponseHeaders_eTag_ok_TODO.java | 5 +
.../Get_whenArg_thenResponseCode_205_bad_TODO.java | 5 +
...enDoesntExistOid_thenResponseCode_404_TODO.java | 5 +
...nDoesntExistProp_thenResponseCode_404_TODO.java | 5 +
..._whenHrefArg_thenResponseCode_205_bad_TODO.java | 5 -
.../Get_whenQueryArg_xRoDomainModel_ok_TODO.java | 5 +
..._whenResponseHeaders_ContentLength_ok_TODO.java | 61 ++++++
...et_whenResponseHeaders_ContentType_ok_TODO.java | 61 ++++++
...ut_givenDisabled_thenResponseCode_203_TODO.java | 5 +
.../property/Put_thenResponseCode_200_ok_TODO.java | 5 +
...t_thenResponseHeaders_CacheControl_ok_TODO.java | 61 ++++++
..._thenResponseHeaders_ContentLength_ok_TODO.java | 61 ++++++
...ut_thenResponseHeaders_ContentType_ok_TODO.java | 61 ++++++
.../Put_thenResponseHeaders_eTag_ok_TODO.java | 5 +
...IsHrefAndLinksToEntityOfWrongType_bad_TODO.java | 5 +
...IsHrefAndLinksToNonExistentEntity_bad_TODO.java | 5 +
.../property/Put_whenArgIsMalformed_bad_TODO.java | 5 +
.../Put_whenArgMandatoryButMissing_bad_TODO.java | 5 +
...t_whenArgValid_thenPropertyUpdated_ok_TODO.java | 5 +
...enDoesntExistOid_thenResponseCode_404_TODO.java | 5 +
...nDoesntExistProp_thenResponseCode_404_TODO.java | 5 +
.../oid/property/Put_whenNoArg_bad_TODO.java | 5 -
...et_givenDisabled_thenResponseCode_203_TODO.java | 5 +
.../Get_givenHidden_thenResponseCode_404_TODO.java | 5 +
.../action/Get_thenResponseCode_200_ok_TODO.java | 5 +
..._thenResponseHeaders_ContentLength_ok_TODO.java | 61 ++++++
...et_thenResponseHeaders_ContentType_ok_TODO.java | 61 ++++++
.../Get_thenResponseHeaders_eTag_ok_TODO.java | 5 +
.../Get_whenCallWithWrongHttpMethod_bad_TODO.java | 5 -
...nDoesntExistActn_thenResponseCode_404_TODO.java | 5 +
...et_whenDoesntExistOid_thenResponseCode_404.java | 70 ++++++
.../id/action/Get_whenNotFound_bad.java | 70 ------
.../Get_whenQueryArg_xRoDomainModel_ok_TODO.java | 5 +
.../Get_givenDisabled_thenResponseCode_203.java | 122 +++++++++++
.../id/action/invoke/Get_givenForbidden_bad.java | 122 -----------
...leArgs_whenQueryArgXroValidateOnly_ok_TODO.java | 20 --
...eArgs_whenQueryArg_XroValidateOnly_ok_TODO.java | 20 ++
...enArgIsHrefAndLinksToNonExistentEntity_bad.java | 126 +++++++++++
...nRefArg_whenArgLinkToNonExistentEntity_bad.java | 126 -----------
...gIsHrefAndLinksToEntityOfWrongType_ok_TODO.java | 20 ++
...enQueryArgXroValidateOnly_andArgFails_TODO.java | 20 --
...eryArgXroValidateOnly_andArgPasses_ok_TODO.java | 20 --
..._and_thenQueryArg_XroValidateOnly_2xx_TODO.java | 20 ++
..._andQueryArg_XroValidateOnly_then_4xx_TODO.java | 20 ++
..._thenResponseHeaders_ContentLength_ok_TODO.java | 13 ++
...st_thenResponseHeaders_ContentType_ok_TODO.java | 13 ++
..._thenResponseHeaders_ContentLength_ok_TODO.java | 13 ++
...ct_thenResponseHeaders_ContentType_ok_TODO.java | 13 ++
.../Get_whenQueryArg_xRoFollowLinks_ok_TODO.java | 5 +
...enRequestHeaders_Accept_isInvalid_bad_TODO.java | 5 +
.../Get_whenRequestHeaders_Accept_ok_TODO.java | 5 +
..._thenResponseHeaders_ContentLength_ok_TODO.java | 13 ++
...ar_thenResponseHeaders_ContentType_ok_TODO.java | 13 ++
..._thenResponseHeaders_ContentLength_ok_TODO.java | 13 ++
...id_thenResponseHeaders_ContentType_ok_TODO.java | 13 ++
.../root/Delete_thenResponseCode_205_bad_TODO.java | 5 +
..._thenResponseHeaders_ContentLength_ok_TODO.java | 5 +
.../Get_whenCallWithWrongHttpMethod_bad_TODO.java | 5 -
.../Get_whenQueryArg_xRoDomainModel_ok_TODO.java | 5 +
.../root/Post_thenResponseCode_205_bad_TODO.java | 5 +
.../root/Put_thenResponseCode_205_bad_TODO.java | 5 +
.../Get_ResponseHeaders_CacheControl_ok.java | 63 ------
...enHiddenMembers_thenRepresentation_ok_TODO.java | 5 +
.../Get_thenResponseHeaders_CacheControl_ok.java | 63 ++++++
..._thenResponseHeaders_ContentLength_ok_TODO.java | 5 +
.../serviceId/Get_thenResponseHeaders_Etag_ok.java | 65 ------
.../serviceId/Get_thenResponseHeaders_eTag_ok.java | 65 ++++++
.../Get_whenCallWithWrongHttpMethod_bad_TODO.java | 5 -
...Get_whenDoesntExistId_thenResponseCode_404.java | 70 ++++++
.../serviceId/Get_whenNotFound_bad.java | 70 ------
.../Get_whenQueryArg_xRoFollowLinks_ok.java | 169 +++++++++++++++
...ryArg_xRoFollowLinks_thenRepresentation_ok.java | 169 ---------------
.../root/Get_thenResponseCode_200_TODO.java | 5 +
..._thenResponseHeaders_ContentLength_ok_TODO.java | 5 +
.../Get_whenQueryArg_xRoDomainModel_ok_TODO.java | 5 +
.../root/Get_whenQueryArg_xRoFollowLinks_ok.java | 168 ++++++++++++++
...ryArg_xRoFollowLinks_thenRepresentation_ok.java | 168 --------------
.../Get_whenRequestHeaders_Accept_ok_TODO.java | 5 +
.../Get_ResponseHeaders_CacheControl_ok_TOFIX.java | 61 ------
.../Get_thenResponseCode_205_bad_TODO.java | 5 +
.../Post_thenResponseCode_201_ok_TODO.java | 5 +
...t_thenResponseHeaders_CacheControl_ok_TODO.java | 61 ++++++
..._thenResponseHeaders_ContentLength_ok_TODO.java | 61 ++++++
...st_thenResponseHeaders_ContentType_ok_TODO.java | 61 ++++++
.../Post_thenResponseHeaders_Location_ok_TODO.java | 5 +
.../Post_thenResponseHeaders_eTag_ok_TODO.java | 5 +
...IsHrefAndLinksToEntityOfWrongType_bad_TODO.java | 5 +
...IsHrefAndLinksToNonExistentEntity_bad_TODO.java | 5 +
.../objectsoftype/Post_whenArgValid_ok_TODO.java | 5 -
.../Post_whenArgsMandatoryButMissing_bad_TODO.java | 5 +
.../Post_whenArgsMissing_bad_TODO.java | 5 -
...Post_whenArgsRefNonExistentEntity_bad_TODO.java | 5 -
...t_whenArgsValid_thenPersistsObject_ok_TODO.java | 5 +
..._thenResponseHeaders_ContentLength_ok_TODO.java | 5 +
.../Get_whenQueryArg_xRoDomainModel_ok_TODO.java | 5 +
..._thenResponseHeaders_ContentLength_ok_TODO.java | 61 ++++++
.../Get_whenQueryArg_xRoDomainModel_ok_TODO.java | 5 +
224 files changed, 3763 insertions(+), 1114 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/README-testcases.txt
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/README-testcases.txt b/component/viewer/restfulobjects/tck/README-testcases.txt
new file mode 100644
index 0000000..6a14866
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/README-testcases.txt
@@ -0,0 +1,63 @@
+
+
+
+
+
+[incorrect]_thenResponseCode_405_bad
+
+Get_whenQueryArg_xRoFollowLinks_ok
+Get_whenQueryArg_xRoDomainModel_ok
+
+Get_whenRequestHeaders_Accept_isInvalid_bad
+Get_whenRequestHeaders_Accept_ok
+
+
+[modifying]_givenDisabled_thenResponseCode_203_TODO
+
+[modifying]_givenEtag_whenIfMatchHeaderDoesMatch_ok
+[modifying]_givenEtag_whenIfMatchHeaderDoesNotMatch_bad
+
+[modifying]_givenXxx_whenArgsValid_thenXxx_ok_TODO
+
+
+[modifying]_whenArgsMandatoryButMissing_bad_TODO
+rename from
+[modifying]_whenNoArg_bad_TODO
+
+
+[modifying]_then[PostConditionsHappyCase]_TODO
+
+[modifying]_whenArgIsHrefAndLinksToNonExistentEntity_bad_TODO
+[modifying]_whenArgIsHrefAndLinksToEntityOfWrongType_bad_TODO
+
+[modifying]_whenArgValueIsValid_andQueryArg_XRoValidateOnly_2xx_TODO
+[modifying]_whenArgValueIsInvalid_andQueryArg_XRoValidateOnly_4xx_TODO
+[modifying]_whenArgValueIsInvalid_bad_TODO
+
+[modifying]_whenArgIsMalformed_bad_TODO
+
+[anyValid]_whenDoesntExistOid_thenResponseCode_404_TODO
+[anyValid]_whenDoesntExistMember_thenResponseCode_404_TODO
+[anyValid]_givenHidden_thenResponseCode_404_TODO
+
+[anyValid]_thenRepresentation_ok_TODO
+[anyValid]_thenResponseCode_200_ok
+[anyValid]_thenResponseHeaders_ContentType_ok
+[anyValid]_thenResponseHeaders_ContentLength_ok
+[anyValid]_thenResponseHeaders_CacheControl_ok
+[anyValid]_thenResponseHeaders_eTag_ok
+
+
+
+
+
+
+
+Delete_whenLinkToEntityThatExistsButIsNotInCollection_ok_TODO
+Delete_whenHrefArgLinksToEntityInCollection_ok_TODO
+Put_whenArgsValid_thenMultiplePropertyUpdate_TODO
+
+Put_givenEntityAlreadyInCollection_whenArgsValid_thenNoChange_ok_TODO
+Put_givenEntityNotInCollection_whenArgsValid_thenEntityAddedFromCollection_ok_TODO
+
+Get_givenHiddenMembers_thenRepresentation_ok_TODO
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/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
deleted file mode 100644
index 2e44167..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Delete_thenResponseCode_205_bad_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Delete_thenResponseCode_405_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Delete_thenResponseCode_405_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Delete_thenResponseCode_405_bad_TODO.java
new file mode 100644
index 0000000..639de06
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Delete_thenResponseCode_405_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+
+public class Delete_thenResponseCode_405_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenHiddenMembers_thenRepresentation_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenHiddenMembers_thenRepresentation_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenHiddenMembers_thenRepresentation_ok_TODO.java
new file mode 100644
index 0000000..cffd03b
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenHiddenMembers_thenRepresentation_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+
+public class Get_givenHiddenMembers_thenRepresentation_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseHeaders_ContentLength_ok_TODO.java
new file mode 100644
index 0000000..cd78084
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseHeaders_ContentLength_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_ContentLength_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseHeaders_ContentType_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseHeaders_ContentType_ok_TODO.java
new file mode 100644
index 0000000..ff00479
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseHeaders_ContentType_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_ContentType_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenDoesntExistOid_thenResponseCode_404_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenDoesntExistOid_thenResponseCode_404_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenDoesntExistOid_thenResponseCode_404_TODO.java
new file mode 100644
index 0000000..82258f9
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenDoesntExistOid_thenResponseCode_404_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+
+public class Get_whenDoesntExistOid_thenResponseCode_404_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenQueryArg_xRoDomainModel_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenQueryArg_xRoDomainModel_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenQueryArg_xRoDomainModel_ok_TODO.java
new file mode 100644
index 0000000..1521f3e
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenQueryArg_xRoDomainModel_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+
+public class Get_whenQueryArg_xRoDomainModel_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/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
deleted file mode 100644
index 3d1c005..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Post_thenResponseCode_205_bad_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Post_thenResponseCode_405_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Post_thenResponseCode_405_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Post_thenResponseCode_405_bad_TODO.java
new file mode 100644
index 0000000..09031dd
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Post_thenResponseCode_405_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+
+public class Post_thenResponseCode_405_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_givenDisabled_thenResponseCode_203_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_givenDisabled_thenResponseCode_203_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_givenDisabled_thenResponseCode_203_TODO.java
new file mode 100644
index 0000000..147cde4
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_givenDisabled_thenResponseCode_203_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+
+public class Put_givenDisabled_thenResponseCode_203_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java
new file mode 100644
index 0000000..d824964
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+
+public class Put_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java
new file mode 100644
index 0000000..cef6f88
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+
+public class Put_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenRepresentation_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenRepresentation_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenRepresentation_TODO.java
new file mode 100644
index 0000000..b67db78
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenRepresentation_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+
+public class Put_thenRepresentation_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseCode_200_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseCode_200_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseCode_200_ok_TODO.java
new file mode 100644
index 0000000..353b450
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseCode_200_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+
+public class Put_thenResponseCode_200_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_CacheControl_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_CacheControl_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_CacheControl_ok_TODO.java
new file mode 100644
index 0000000..b4dd379
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_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 Put_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_ContentLength_ok_TODO.java
new file mode 100644
index 0000000..ce54469
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_ContentLength_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 Put_thenResponseHeaders_ContentLength_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_ContentType_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_ContentType_ok_TODO.java
new file mode 100644
index 0000000..89fc0bc
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_ContentType_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 Put_thenResponseHeaders_ContentType_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_eTag_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_eTag_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_eTag_ok_TODO.java
new file mode 100644
index 0000000..1c332e4
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_eTag_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+
+public class Put_thenResponseHeaders_eTag_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenArgIsHrefAndLinksToNonExistentEntity_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenArgIsHrefAndLinksToNonExistentEntity_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenArgIsHrefAndLinksToNonExistentEntity_bad_TODO.java
new file mode 100644
index 0000000..ec164ac
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenArgIsHrefAndLinksToNonExistentEntity_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+
+public class Put_whenArgIsHrefAndLinksToNonExistentEntity_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenArgIsInvalid_andQueryArg_XRoValidateOnly_then_4xx_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenArgIsInvalid_andQueryArg_XRoValidateOnly_then_4xx_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenArgIsInvalid_andQueryArg_XRoValidateOnly_then_4xx_TODO.java
new file mode 100644
index 0000000..9606c1e
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenArgIsInvalid_andQueryArg_XRoValidateOnly_then_4xx_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+
+public class Put_whenArgIsInvalid_andQueryArg_XRoValidateOnly_then_4xx_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenArgIsValid_andQueryArg_XRoValidateOnly_then_2xx_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenArgIsValid_andQueryArg_XRoValidateOnly_then_2xx_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenArgIsValid_andQueryArg_XRoValidateOnly_then_2xx_TODO.java
new file mode 100644
index 0000000..b5b0e27
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenArgIsValid_andQueryArg_XRoValidateOnly_then_2xx_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+
+public class Put_whenArgIsValid_andQueryArg_XRoValidateOnly_then_2xx_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenArgMandatoryButMissing_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenArgMandatoryButMissing_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenArgMandatoryButMissing_bad_TODO.java
new file mode 100644
index 0000000..c14015f
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenArgMandatoryButMissing_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+
+public class Put_whenArgMandatoryButMissing_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenArgValueIsInvalid_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenArgValueIsInvalid_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenArgValueIsInvalid_bad_TODO.java
new file mode 100644
index 0000000..00075e1
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenArgValueIsInvalid_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+
+public class Put_whenArgValueIsInvalid_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenArgsValid_thenMultiplePropertyUpdate_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenArgsValid_thenMultiplePropertyUpdate_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenArgsValid_thenMultiplePropertyUpdate_TODO.java
new file mode 100644
index 0000000..c6a5c43
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenArgsValid_thenMultiplePropertyUpdate_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+
+public class Put_whenArgsValid_thenMultiplePropertyUpdate_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenDoesntExistOid_thenResponseCode_404_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenDoesntExistOid_thenResponseCode_404_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenDoesntExistOid_thenResponseCode_404_TODO.java
new file mode 100644
index 0000000..292fecd
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenDoesntExistOid_thenResponseCode_404_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+
+public class Put_whenDoesntExistOid_thenResponseCode_404_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/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
deleted file mode 100644
index bf4280e..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_whenMultiplePropertyUpdate_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
-
-public class Put_whenMultiplePropertyUpdate_TODO {
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_givenDisabled_thenResponseCode_203_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_givenDisabled_thenResponseCode_203_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_givenDisabled_thenResponseCode_203_TODO.java
new file mode 100644
index 0000000..4256934
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_givenDisabled_thenResponseCode_203_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Delete_givenDisabled_thenResponseCode_203_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_givenHidden_thenResponseCode_404_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_givenHidden_thenResponseCode_404_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_givenHidden_thenResponseCode_404_TODO.java
new file mode 100644
index 0000000..4227296
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_givenHidden_thenResponseCode_404_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Delete_givenHidden_thenResponseCode_404_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseCode_200_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseCode_200_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseCode_200_ok_TODO.java
new file mode 100644
index 0000000..6261d5d
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseCode_200_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Delete_thenResponseCode_200_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_CacheControl_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_CacheControl_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_CacheControl_ok_TODO.java
new file mode 100644
index 0000000..e7e021f
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_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 Delete_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_ContentLength_ok_TODO.java
new file mode 100644
index 0000000..d83e7f6
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_ContentLength_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 Delete_thenResponseHeaders_ContentLength_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_ContentType_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_ContentType_ok_TODO.java
new file mode 100644
index 0000000..1dd8a73
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_ContentType_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 Delete_thenResponseHeaders_ContentType_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_eTag_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_eTag_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_eTag_ok_TODO.java
new file mode 100644
index 0000000..5642977
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_eTag_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Delete_thenResponseHeaders_eTag_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgHrefAndLinksToEntityOfWrongType_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgHrefAndLinksToEntityOfWrongType_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgHrefAndLinksToEntityOfWrongType_bad_TODO.java
new file mode 100644
index 0000000..9745df4
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgHrefAndLinksToEntityOfWrongType_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Delete_whenArgHrefAndLinksToEntityOfWrongType_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgHrefAndLinksToEntityThatExistsButIsNotInCollection_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgHrefAndLinksToEntityThatExistsButIsNotInCollection_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgHrefAndLinksToEntityThatExistsButIsNotInCollection_ok_TODO.java
new file mode 100644
index 0000000..0274836
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgHrefAndLinksToEntityThatExistsButIsNotInCollection_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Delete_whenArgHrefAndLinksToEntityThatExistsButIsNotInCollection_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgHrefAndLinksToNonExistentEntity_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgHrefAndLinksToNonExistentEntity_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgHrefAndLinksToNonExistentEntity_bad_TODO.java
new file mode 100644
index 0000000..7ee38ed
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgHrefAndLinksToNonExistentEntity_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Delete_whenArgHrefAndLinksToNonExistentEntity_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgIsMalformed_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgIsMalformed_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgIsMalformed_bad_TODO.java
new file mode 100644
index 0000000..fddff73
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgIsMalformed_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Delete_whenArgIsMalformed_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgMandatoryButMissing_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgMandatoryButMissing_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgMandatoryButMissing_bad_TODO.java
new file mode 100644
index 0000000..3bfb0a5
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgMandatoryButMissing_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Delete_whenArgMandatoryButMissing_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgValid_thenEntityRemovedFromCollection_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgValid_thenEntityRemovedFromCollection_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgValid_thenEntityRemovedFromCollection_ok_TODO.java
new file mode 100644
index 0000000..42a1db7
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgValid_thenEntityRemovedFromCollection_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Delete_whenArgValid_thenEntityRemovedFromCollection_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgValueIsInvalid_andQueryArg_XRoValidateOnly_4xx_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgValueIsInvalid_andQueryArg_XRoValidateOnly_4xx_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgValueIsInvalid_andQueryArg_XRoValidateOnly_4xx_TODO.java
new file mode 100644
index 0000000..f16fa79
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgValueIsInvalid_andQueryArg_XRoValidateOnly_4xx_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Delete_whenArgValueIsInvalid_andQueryArg_XRoValidateOnly_4xx_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgValueIsInvalid_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgValueIsInvalid_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgValueIsInvalid_bad_TODO.java
new file mode 100644
index 0000000..d0b0b60
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgValueIsInvalid_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Delete_whenArgValueIsInvalid_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgValueIsValid_andQueryArg_XRoValidateOnly_2xx_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgValueIsValid_andQueryArg_XRoValidateOnly_2xx_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgValueIsValid_andQueryArg_XRoValidateOnly_2xx_TODO.java
new file mode 100644
index 0000000..271c161
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenArgValueIsValid_andQueryArg_XRoValidateOnly_2xx_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Delete_whenArgValueIsValid_andQueryArg_XRoValidateOnly_2xx_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenDoesntExistColl_thenResponseCode_404_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenDoesntExistColl_thenResponseCode_404_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenDoesntExistColl_thenResponseCode_404_TODO.java
new file mode 100644
index 0000000..bc3dea9
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenDoesntExistColl_thenResponseCode_404_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Delete_whenDoesntExistColl_thenResponseCode_404_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenDoesntExistOid_thenResponseCode_404_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenDoesntExistOid_thenResponseCode_404_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenDoesntExistOid_thenResponseCode_404_TODO.java
new file mode 100644
index 0000000..f1c9ccb
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenDoesntExistOid_thenResponseCode_404_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Delete_whenDoesntExistOid_thenResponseCode_404_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/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
deleted file mode 100644
index 740d5b4..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenHrefArgLinkToNonExistentEntity_bad_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-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/cf0bc337/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
deleted file mode 100644
index b2afedd..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenHrefArgLinksToEntityInCollection_ok_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-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/cf0bc337/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
deleted file mode 100644
index 1bc5feb..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenLinkToEntityThatExistsButIsNotInCollection_ok_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-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/cf0bc337/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
deleted file mode 100644
index b0df563..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_whenNoArg_bad_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseCode_200_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseCode_200_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseCode_200_ok_TODO.java
new file mode 100644
index 0000000..41f1ab6
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseCode_200_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Get_thenResponseCode_200_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseHeaders_ContentLength_ok_TODO.java
new file mode 100644
index 0000000..aa30ae8
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseHeaders_ContentLength_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_ContentLength_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseHeaders_ContentType_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseHeaders_ContentType_ok_TODO.java
new file mode 100644
index 0000000..7ff97a0
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseHeaders_ContentType_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_ContentType_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseHeaders_eTag_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseHeaders_eTag_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseHeaders_eTag_ok_TODO.java
new file mode 100644
index 0000000..6d22306
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseHeaders_eTag_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Get_thenResponseHeaders_eTag_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenArg_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_whenArg_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenArg_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..b1607a4
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenArg_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Get_whenArg_thenResponseCode_205_bad_TODO {
+
+}
[40/50] [abbrv] ISIS-233: more stub test cases.
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_CacheControl_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_CacheControl_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_CacheControl_ok_TODO.java
new file mode 100644
index 0000000..eeb6ea1
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/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.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_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_ContentLength_ok_TODO.java
new file mode 100644
index 0000000..a7f8bd4
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_ContentLength_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_thenResponseHeaders_ContentLength_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_ContentType_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_ContentType_ok_TODO.java
new file mode 100644
index 0000000..6fa75c7
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_ContentType_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_thenResponseHeaders_ContentType_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_eTag_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_eTag_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_eTag_ok_TODO.java
new file mode 100644
index 0000000..a0bc345
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_eTag_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Get_thenResponseHeaders_eTag_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenArg_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_whenArg_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenArg_thenResponseCode_205_bad_TODO.java
new file mode 100644
index 0000000..8b1156e
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenArg_thenResponseCode_205_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Get_whenArg_thenResponseCode_205_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenDoesntExistOid_thenResponseCode_404_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenDoesntExistOid_thenResponseCode_404_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenDoesntExistOid_thenResponseCode_404_TODO.java
new file mode 100644
index 0000000..ef52c22
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenDoesntExistOid_thenResponseCode_404_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Get_whenDoesntExistOid_thenResponseCode_404_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenDoesntExistProp_thenResponseCode_404_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenDoesntExistProp_thenResponseCode_404_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenDoesntExistProp_thenResponseCode_404_TODO.java
new file mode 100644
index 0000000..4eb690f
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenDoesntExistProp_thenResponseCode_404_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Get_whenDoesntExistProp_thenResponseCode_404_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/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
deleted file mode 100644
index 1a479fc..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenHrefArg_thenResponseCode_205_bad_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenQueryArg_xRoDomainModel_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenQueryArg_xRoDomainModel_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenQueryArg_xRoDomainModel_ok_TODO.java
new file mode 100644
index 0000000..c166fc0
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenQueryArg_xRoDomainModel_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Get_whenQueryArg_xRoDomainModel_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenResponseHeaders_ContentLength_ok_TODO.java
new file mode 100644
index 0000000..a59b276
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenResponseHeaders_ContentLength_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_ContentLength_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenResponseHeaders_ContentType_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenResponseHeaders_ContentType_ok_TODO.java
new file mode 100644
index 0000000..59572fb
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenResponseHeaders_ContentType_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_ContentType_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_givenDisabled_thenResponseCode_203_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_givenDisabled_thenResponseCode_203_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_givenDisabled_thenResponseCode_203_TODO.java
new file mode 100644
index 0000000..62b3875
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_givenDisabled_thenResponseCode_203_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Put_givenDisabled_thenResponseCode_203_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseCode_200_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseCode_200_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseCode_200_ok_TODO.java
new file mode 100644
index 0000000..5ab1497
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseCode_200_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Put_thenResponseCode_200_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_CacheControl_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_CacheControl_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_CacheControl_ok_TODO.java
new file mode 100644
index 0000000..6023482
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_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.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 Put_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_ContentLength_ok_TODO.java
new file mode 100644
index 0000000..098594d
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_ContentLength_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 Put_thenResponseHeaders_ContentLength_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_ContentType_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_ContentType_ok_TODO.java
new file mode 100644
index 0000000..9788f94
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_ContentType_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 Put_thenResponseHeaders_ContentType_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_eTag_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_eTag_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_eTag_ok_TODO.java
new file mode 100644
index 0000000..5ca2000
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_eTag_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Put_thenResponseHeaders_eTag_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenArgIsHrefAndLinksToEntityOfWrongType_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenArgIsHrefAndLinksToEntityOfWrongType_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenArgIsHrefAndLinksToEntityOfWrongType_bad_TODO.java
new file mode 100644
index 0000000..9520349
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenArgIsHrefAndLinksToEntityOfWrongType_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Put_whenArgIsHrefAndLinksToEntityOfWrongType_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenArgIsHrefAndLinksToNonExistentEntity_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenArgIsHrefAndLinksToNonExistentEntity_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenArgIsHrefAndLinksToNonExistentEntity_bad_TODO.java
new file mode 100644
index 0000000..2cce34b
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenArgIsHrefAndLinksToNonExistentEntity_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Put_whenArgIsHrefAndLinksToNonExistentEntity_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenArgIsMalformed_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenArgIsMalformed_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenArgIsMalformed_bad_TODO.java
new file mode 100644
index 0000000..2c4e2df
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenArgIsMalformed_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Put_whenArgIsMalformed_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenArgMandatoryButMissing_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenArgMandatoryButMissing_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenArgMandatoryButMissing_bad_TODO.java
new file mode 100644
index 0000000..f3417b5
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenArgMandatoryButMissing_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Put_whenArgMandatoryButMissing_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenArgValid_thenPropertyUpdated_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenArgValid_thenPropertyUpdated_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenArgValid_thenPropertyUpdated_ok_TODO.java
new file mode 100644
index 0000000..18d1f7c
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenArgValid_thenPropertyUpdated_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Put_whenArgValid_thenPropertyUpdated_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenDoesntExistOid_thenResponseCode_404_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenDoesntExistOid_thenResponseCode_404_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenDoesntExistOid_thenResponseCode_404_TODO.java
new file mode 100644
index 0000000..1a11ee0
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenDoesntExistOid_thenResponseCode_404_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Put_whenDoesntExistOid_thenResponseCode_404_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenDoesntExistProp_thenResponseCode_404_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenDoesntExistProp_thenResponseCode_404_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenDoesntExistProp_thenResponseCode_404_TODO.java
new file mode 100644
index 0000000..886c834
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenDoesntExistProp_thenResponseCode_404_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Put_whenDoesntExistProp_thenResponseCode_404_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/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
deleted file mode 100644
index 4b53185..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenNoArg_bad_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_givenDisabled_thenResponseCode_203_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_givenDisabled_thenResponseCode_203_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_givenDisabled_thenResponseCode_203_TODO.java
new file mode 100644
index 0000000..722cc04
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_givenDisabled_thenResponseCode_203_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action;
+
+public class Get_givenDisabled_thenResponseCode_203_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_givenHidden_thenResponseCode_404_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_givenHidden_thenResponseCode_404_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_givenHidden_thenResponseCode_404_TODO.java
new file mode 100644
index 0000000..3dcfffa
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_givenHidden_thenResponseCode_404_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action;
+
+public class Get_givenHidden_thenResponseCode_404_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/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/Get_thenResponseCode_200_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenResponseCode_200_ok_TODO.java
new file mode 100644
index 0000000..e7e8f56
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenResponseCode_200_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action;
+
+public class Get_thenResponseCode_200_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenResponseHeaders_ContentLength_ok_TODO.java
new file mode 100644
index 0000000..00d1d50
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenResponseHeaders_ContentLength_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_ContentLength_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenResponseHeaders_ContentType_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenResponseHeaders_ContentType_ok_TODO.java
new file mode 100644
index 0000000..261e4b2
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenResponseHeaders_ContentType_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_ContentType_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenResponseHeaders_eTag_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenResponseHeaders_eTag_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenResponseHeaders_eTag_ok_TODO.java
new file mode 100644
index 0000000..967c892
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenResponseHeaders_eTag_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action;
+
+public class Get_thenResponseHeaders_eTag_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/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
deleted file mode 100644
index 9c731b6..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenCallWithWrongHttpMethod_bad_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenDoesntExistActn_thenResponseCode_404_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenDoesntExistActn_thenResponseCode_404_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenDoesntExistActn_thenResponseCode_404_TODO.java
new file mode 100644
index 0000000..d38b48e
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenDoesntExistActn_thenResponseCode_404_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action;
+
+public class Get_whenDoesntExistActn_thenResponseCode_404_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenDoesntExistOid_thenResponseCode_404.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenDoesntExistOid_thenResponseCode_404.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenDoesntExistOid_thenResponseCode_404.java
new file mode 100644
index 0000000..82b4d9f
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenDoesntExistOid_thenResponseCode_404.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_whenDoesntExistOid_thenResponseCode_404 {
+
+ @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/cf0bc337/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
deleted file mode 100644
index b85790b..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenNotFound_bad.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.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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenQueryArg_xRoDomainModel_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenQueryArg_xRoDomainModel_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenQueryArg_xRoDomainModel_ok_TODO.java
new file mode 100644
index 0000000..a292d3e
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_whenQueryArg_xRoDomainModel_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action;
+
+public class Get_whenQueryArg_xRoDomainModel_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenDisabled_thenResponseCode_203.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenDisabled_thenResponseCode_203.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenDisabled_thenResponseCode_203.java
new file mode 100644
index 0000000..891b947
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenDisabled_thenResponseCode_203.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_givenDisabled_thenResponseCode_203 {
+
+ @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/cf0bc337/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
deleted file mode 100644
index 2348041..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenForbidden_bad.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.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/cf0bc337/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
deleted file mode 100644
index 30dd0fe..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenNoValidatableArgs_whenQueryArgXroValidateOnly_ok_TODO.java
+++ /dev/null
@@ -1,20 +0,0 @@
-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
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenNoValidatableArgs_whenQueryArg_XroValidateOnly_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_whenQueryArg_XroValidateOnly_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenNoValidatableArgs_whenQueryArg_XroValidateOnly_ok_TODO.java
new file mode 100644
index 0000000..cd56d2b
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenNoValidatableArgs_whenQueryArg_XroValidateOnly_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_whenQueryArg_XroValidateOnly_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenRefArg_whenArgIsHrefAndLinksToNonExistentEntity_bad.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenRefArg_whenArgIsHrefAndLinksToNonExistentEntity_bad.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenRefArg_whenArgIsHrefAndLinksToNonExistentEntity_bad.java
new file mode 100644
index 0000000..d9020e3
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenRefArg_whenArgIsHrefAndLinksToNonExistentEntity_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_whenArgIsHrefAndLinksToNonExistentEntity_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/cf0bc337/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
deleted file mode 100644
index 2b1b9c2..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenRefArg_whenArgLinkToNonExistentEntity_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.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"));
- }
-
-
-
-}
[13/50] [abbrv] ISIS-233-ro: more on domainservice.serviceId
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/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
new file mode 100644
index 0000000..0a25822
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/HomePageTest_req_header_accept.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.homepage.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/5e01f688/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
new file mode 100644
index 0000000..6431cc7
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/HomePageTest_req_queryargs_xrofollowlinks.java
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.homepage.root;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.RequestParameter;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class 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/5e01f688/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
new file mode 100644
index 0000000..22eefc4
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/HomePageTest_resp_headers.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.homepage.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.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/5e01f688/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
new file mode 100644
index 0000000..f8600c3
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/root/HomePageTest_resp_representation.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.homepage.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.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/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_request_header_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_request_header_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_request_header_accept.java
deleted file mode 100644
index 2a24d26..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_request_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;
-
-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 UserResourceTest_root_request_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/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_request_queryargs_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_request_queryargs_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_request_queryargs_xrofollowlinks.java
deleted file mode 100644
index ddd4b5d..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_request_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;
-
-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 UserResourceTest_root_request_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/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_response_headers.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_response_headers.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_response_headers.java
deleted file mode 100644
index f01180d..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_response_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;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isFollowableLinkToSelf;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
-import static org.hamcrest.CoreMatchers.endsWith;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.CacheControl;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status.Family;
-
-import org.apache.isis.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 UserResourceTest_root_response_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/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_response_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_response_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_response_representation.java
deleted file mode 100644
index c6b1da2..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_response_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;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
-import static org.hamcrest.CoreMatchers.endsWith;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status.Family;
-
-import org.apache.isis.viewer.restfulobjects.applib.Rel;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.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 UserResourceTest_root_response_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/5e01f688/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
new file mode 100644
index 0000000..6276557
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/UserTest_req_header_accept.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.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/5e01f688/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
new file mode 100644
index 0000000..e47b8c9
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/UserTest_req_queryargs_xrofollowlinks.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 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/5e01f688/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
new file mode 100644
index 0000000..33fbf4e
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/UserTest_resp_headers.java
@@ -0,0 +1,96 @@
+/*
+ * 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.RepresentationMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isFollowableLinkToSelf;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.hamcrest.CoreMatchers.endsWith;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.CacheControl;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status.Family;
+
+import org.apache.isis.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/5e01f688/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
new file mode 100644
index 0000000..a637373
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/root/UserTest_resp_representation.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.RepresentationMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.hamcrest.CoreMatchers.endsWith;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status.Family;
+
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.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/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_request_header_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_request_header_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_request_header_accept.java
deleted file mode 100644
index 213ce80..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_request_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 VersionResourceTest_root_request_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/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_request_queryargs_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_request_queryargs_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_request_queryargs_xrofollowlinks.java
deleted file mode 100644
index ab966f2..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_request_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 VersionResourceTest_root_request_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())));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_response_headers.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_response_headers.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_response_headers.java
deleted file mode 100644
index 10d1cbe..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_response_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.RepresentationMatchers.hasMaxAge;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.CacheControl;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.apache.isis.core.webserver.WebServer;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.Header;
-import org.apache.isis.viewer.restfulobjects.applib.version.VersionRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.version.VersionResource;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class VersionResourceTest_root_response_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/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_response_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_response_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_response_representation.java
deleted file mode 100644
index 4dfa56e..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_response_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.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
-import static org.hamcrest.CoreMatchers.endsWith;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status.Family;
-
-import org.apache.isis.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 VersionResourceTest_root_response_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/5e01f688/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
new file mode 100644
index 0000000..cdb445c
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionTest_req_header_accept.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.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));
+ }
+}
[09/50] [abbrv] git commit: ISIS-233-ro: testing
domainservices_services resource
Posted by da...@apache.org.
ISIS-233-ro: testing domainservices_services resource
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/1b9a2a74
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/1b9a2a74
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/1b9a2a74
Branch: refs/heads/master
Commit: 1b9a2a741233d6449c39055e702b3e1657a8b0b7
Parents: 5491a13
Author: Dan Haywood <da...@apache.org>
Authored: Mon Feb 25 23:16:38 2013 +0000
Committer: Dan Haywood <da...@apache.org>
Committed: Sat Apr 27 18:57:30 2013 +0100
----------------------------------------------------------------------
.../isis/viewer/restfulobjects/applib/Rel.java | 94 ++--
.../restfulobjects/applib/RelDefinition.java | 53 ++
.../restfulobjects/applib/RepresentationType.java | 25 +
.../applib/client/RestfulRequest.java | 2 +-
.../applib/client/RestfulResponse.java | 22 +-
.../viewer/restfulobjects/applib/util/Parser.java | 1 -
.../RestfulRequestDomainModelTest_parser.java | 39 --
...RestfulRequestRequestParameterTest_valueOf.java | 91 ----
.../RestfulRequest_DomainModelTest_parser.java | 39 ++
...equestParameterTest_valueOf_xrodomainmodel.java | 55 ++
...equestParameterTest_valueOf_xrofollowlinks.java | 93 ++++
.../client/RestfulResponse_HeaderTest_Warning.java | 43 ++
.../restfulobjects/rendering/ReprRenderer.java | 4 +-
.../rendering/ReprRendererAbstract.java | 30 +-
.../AbstractObjectMemberReprRenderer.java | 2 +
.../domainobjects/DomainObjectReprRenderer.java | 4 +
.../DomainServicesListReprRenderer.java | 54 --
.../rendering/domainobjects/ListReprRenderer.java | 13 +-
.../domainobjects/ScalarValueReprRenderer.java | 6 +-
.../AbstractTypeMemberReprRenderer.java | 2 +-
.../domaintypes/TypeActionResultReprRenderer.java | 5 +
.../rendering/LinkFollowSpecsTest_follow.java | 1 -
.../restfulobjects/server/ResourceContext.java | 94 ++--
.../RestfulObjectsApplicationExceptionMapper.java | 4 +-
.../resources/DomainServiceResourceServerside.java | 10 +-
.../resources/DomainServicesListReprRenderer.java | 70 +++
.../resources/DomainTypeResourceServerside.java | 1 +
.../server/resources/ResourceAbstract.java | 6 +-
.../restfulobjects/tck/RepresentationMatchers.java | 12 +-
...Test_serverSideException_exceptionHandling.java | 65 +++
...sourceTest_serviceId_request_header_accept.java | 110 ++++
..._serviceId_request_queryarg_xrodomainmodel.java | 75 +++
..._serviceId_request_queryarg_xrofollowlinks.java | 99 ++++
...iceResourceTest_serviceId_response_headers.java | 66 +++
...urceTest_serviceId_response_representation.java | 88 ++++
...viceResourceTest_serviceId_status_notFound.java | 70 +++
...ServiceResourceTest_services_header_accept.java | 105 ++++
...ourceTest_services_queryarg_xrofollowlinks.java | 152 ++++++
...viceResourceTest_services_response_headers.java | 82 +++
...ourceTest_services_response_representation.java | 128 +++++
.../restfulobjects/tck/domainservice/Util.java | 49 ++
.../HomePageResourceTest_root_header_accept.java | 106 ++++
...ResourceTest_root_queryargs_xrofollowlinks.java | 168 ++++++
...HomePageResourceTest_root_response_headers.java | 79 +++
...eResourceTest_root_response_representation.java | 111 ++++
...Test_serverSideException_exceptionHandling.java | 72 ---
...nServiceResourceTest_services_acceptHeader.java | 106 ----
...erviceResourceTest_services_representation.java | 137 -----
...rviceResourceTest_services_responseHeaders.java | 82 ---
...erviceResourceTest_services_xrofollowlinks.java | 122 -----
.../home/HomePageResourceTest_acceptHeader.java | 106 ----
.../home/HomePageResourceTest_representation.java | 111 ----
.../home/HomePageResourceTest_responseHeaders.java | 79 ---
.../home/HomePageResourceTest_xrofollowlinks.java | 168 ------
.../resources/object/DomainObjectResourceTest.java | 401 ---------------
.../DomainServiceResourceTest_invokeAction.java | 265 ----------
...DomainServiceResourceTest_serviceId_accept.java | 102 ----
...mainServiceResourceTest_serviceId_notFound.java | 65 ---
...rceTest_serviceId_representationAndHeaders.java | 129 -----
...rviceResourceTest_serviceId_xrofollowlinks.java | 97 ----
.../user/UserResourceTest_acceptHeader.java | 105 ----
.../user/UserResourceTest_representation.java | 104 ----
.../user/UserResourceTest_responseHeaders.java | 96 ----
.../user/UserResourceTest_xrofollowlinks.java | 92 ----
.../version/VersionResourceTest_acceptHeader.java | 110 ----
.../VersionResourceTest_representation.java | 113 ----
.../VersionResourceTest_responseHeaders.java | 82 ---
.../VersionResourceTest_xrofollowlinks.java | 88 ----
.../restfulobjects/tck/stories/UserStoryTest.java | 86 ---
...serResourceTest_root_request_header_accept.java | 105 ++++
...Test_root_request_queryargs_xrofollowlinks.java | 92 ++++
.../UserResourceTest_root_response_headers.java | 96 ++++
...rResourceTest_root_response_representation.java | 104 ++++
...ionResourceTest_root_request_header_accept.java | 110 ++++
...Test_root_request_queryargs_xrofollowlinks.java | 88 ++++
.../VersionResourceTest_root_response_headers.java | 82 +++
...nResourceTest_root_response_representation.java | 113 ++++
...nstanceid_get_response_header_cacheControl.java | 61 +++
...est_instanceid_get_response_representation.java | 401 +++++++++++++++
...ServiceResourceTest_serviceId_invokeAction.java | 265 ++++++++++
...rceTest_serviceId_invokeAction_returnsList.java | 13 +
...eTest_serviceId_invokeAction_returnsObject.java | 13 +
...eTest_serviceId_invokeAction_returnsScalar.java | 13 +
...rceTest_serviceId_invokeAction_returnsVoid.java | 13 +
...rceTest_serviceId_invokeAction_throwsError.java | 13 +
...bjectsOfTypeResourceTest_domainTypeId_post.java | 13 +
.../tck/zzztodo/stories/UserStoryTest.java | 86 +++
87 files changed, 3806 insertions(+), 3221 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/Rel.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/Rel.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/Rel.java
index 7184f59..c52b49a 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/Rel.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/Rel.java
@@ -19,71 +19,67 @@
package org.apache.isis.viewer.restfulobjects.applib;
public enum Rel {
-
- // IANA registered
- SELF("self"),
- DESCRIBEDBY("describedby"),
- UP("up"),
- PREVIOUS("previous"),
- NEXT("next"),
- HELP("help"),
- ICON("icon"),
+
+ SELF(RelDefinition.IANA, "self"),
+ DESCRIBEDBY(RelDefinition.IANA, "describedby"),
+ UP(RelDefinition.IANA,"up"),
+ PREVIOUS(RelDefinition.IANA,"previous"),
+ NEXT(RelDefinition.IANA,"next"),
+ HELP(RelDefinition.IANA,"help"),
+ ICON(RelDefinition.IANA,"icon"),
// Restful Objects namespace
- ACTION(Spec.REL_PREFIX + "action"),
- ACTION_PARAM(Spec.REL_PREFIX + "action-param"),
- ADD_TO(Spec.REL_PREFIX + "add-to"),
- ATTACHMENT(Spec.REL_PREFIX + "attachment"),
- CHOICE(Spec.REL_PREFIX + "choice"),
- CLEAR(Spec.REL_PREFIX + "clear"),
- COLLECTION(Spec.REL_PREFIX + "collection"),
- DEFAULT(Spec.REL_PREFIX + "default"),
- DELETE(Spec.REL_PREFIX + "delete"),
- DETAILS(Spec.REL_PREFIX + "details"),
- DOMAIN_TYPE(Spec.REL_PREFIX + "domain-type"),
- DOMAIN_TYPES(Spec.REL_PREFIX + "domain-types"),
- ELEMENT(Spec.REL_PREFIX + "element"),
- ELEMENT_TYPE(Spec.REL_PREFIX + "element-type"),
- INVOKE(Spec.REL_PREFIX + "invoke"),
- MODIFY(Spec.REL_PREFIX + "modify"),
- PERSIST(Spec.REL_PREFIX + "persist"),
- PROPERTY(Spec.REL_PREFIX + "property"),
- REMOVE_FROM(Spec.REL_PREFIX + "remove-from"),
- RETURN_TYPE(Spec.REL_PREFIX + "return-type"),
- SERVICE(Spec.REL_PREFIX + "service"),
- SERVICES(Spec.REL_PREFIX + "services"),
- UPDATE(Spec.REL_PREFIX + "update"),
- USER(Spec.REL_PREFIX + "user"),
- VALUE(Spec.REL_PREFIX + "value"),
- VERSION(Spec.REL_PREFIX + "version"),
+ ACTION(RelDefinition.RO_SPEC, "action"),
+ ACTION_PARAM(RelDefinition.RO_SPEC, "action-param"),
+ ADD_TO(RelDefinition.RO_SPEC, "add-to"),
+ ATTACHMENT(RelDefinition.RO_SPEC, "attachment"),
+ CHOICE(RelDefinition.RO_SPEC, "choice"),
+ CLEAR(RelDefinition.RO_SPEC, "clear"),
+ COLLECTION(RelDefinition.RO_SPEC, "collection"),
+ DEFAULT(RelDefinition.RO_SPEC, "default"),
+ DELETE(RelDefinition.RO_SPEC, "delete"),
+ DETAILS(RelDefinition.RO_SPEC, "details"),
+ DOMAIN_TYPE(RelDefinition.RO_SPEC, "domain-type"),
+ DOMAIN_TYPES(RelDefinition.RO_SPEC, "domain-types"),
+ ELEMENT(RelDefinition.RO_SPEC, "element"),
+ ELEMENT_TYPE(RelDefinition.RO_SPEC, "element-type"),
+ INVOKE(RelDefinition.RO_SPEC, "invoke"),
+ MODIFY(RelDefinition.RO_SPEC, "modify"),
+ PERSIST(RelDefinition.RO_SPEC, "persist"),
+ PROPERTY(RelDefinition.RO_SPEC, "property"),
+ REMOVE_FROM(RelDefinition.RO_SPEC, "remove-from"),
+ RETURN_TYPE(RelDefinition.RO_SPEC, "return-type"),
+ SERVICE(RelDefinition.RO_SPEC, "service"),
+ SERVICES(RelDefinition.RO_SPEC, "services"),
+ UPDATE(RelDefinition.RO_SPEC, "update"),
+ USER(RelDefinition.RO_SPEC, "user"),
+ VALUE(RelDefinition.RO_SPEC, "value"),
+ VERSION(RelDefinition.RO_SPEC, "version"),
// implementation specific
- CONTRIBUTED_BY(Impl.REL_PREFIX + "contributed-by");
+ CONTRIBUTED_BY(RelDefinition.IMPL, "contributed-by");
- private final String name;
+ private final RelDefinition relDef;
+ private final String relSuffix;
- private Rel(final String name) {
- this.name = name;
+ private Rel(final RelDefinition relDef, final String name) {
+ this.relDef = relDef;
+ this.relSuffix = name;
}
public String getName() {
- return name;
+ return relDef.nameOf(relSuffix);
}
/**
* For those {@link Rel}s that also take a param
*/
public String andParam(String paramName, String paramValue) {
- return name + ";" + paramName + "=" + "\"" + paramValue + "\"";
- }
-
- private static class Spec {
- final static String REL_PREFIX = "urn:org.restfulobjects:rels/";
- }
-
- private static class Impl {
- final static String REL_PREFIX = "urn:org.apache.isis.restfulobjects:rels/";
+ return getName() +
+ (relDef.canAddParams()
+ ?";" + paramName + "=" + "\"" + paramValue + "\""
+ :"");
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/RelDefinition.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/RelDefinition.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/RelDefinition.java
new file mode 100644
index 0000000..efb269e
--- /dev/null
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/RelDefinition.java
@@ -0,0 +1,53 @@
+/*
+ * 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.applib;
+
+/**
+ * Enumerates the organization that defined a {@link Rel}.
+ */
+public enum RelDefinition {
+
+ /**
+ * {@link Rel} defined by IANA.
+ */
+ IANA(null, false),
+ /**
+ * {@link Rel} defined by the Restful Objects spec.
+ */
+ RO_SPEC("urn:org.restfulobjects:rels/", true),
+ /**
+ * Proprietary rel defined by implementation.
+ */
+ IMPL("urn:org.apache.isis.restfulobjects:rels/", true);
+
+ private final String relPrefix;
+ private final boolean addParams;
+
+ private RelDefinition(String relPrefix, boolean canAddParams) {
+ this.relPrefix = relPrefix;
+ this.addParams = canAddParams;
+ }
+
+ public String nameOf(String relSuffix) {
+ return (relPrefix != null? relPrefix:"") +relSuffix;
+ }
+ public boolean canAddParams() {
+ return addParams;
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationType.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationType.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationType.java
index c0fd7f9..1a2a005 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationType.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationType.java
@@ -19,6 +19,9 @@
package org.apache.isis.viewer.restfulobjects.applib;
+import java.util.Collections;
+import java.util.Map;
+
import javax.ws.rs.core.MediaType;
import org.apache.isis.applib.util.Enums;
@@ -41,6 +44,8 @@ import org.apache.isis.viewer.restfulobjects.applib.user.UserRepresentation;
import org.apache.isis.viewer.restfulobjects.applib.util.Parser;
import org.apache.isis.viewer.restfulobjects.applib.version.VersionRepresentation;
+import com.google.common.collect.Maps;
+
public enum RepresentationType {
HOME_PAGE(RestfulMediaType.APPLICATION_JSON_HOME_PAGE, HomePageRepresentation.class),
@@ -84,6 +89,24 @@ public enum RepresentationType {
return mediaType;
}
+ /**
+ * Clones the (immutable) {@link #getMediaType() media type}, adding in one additional
+ * parameter value.
+ */
+ public MediaType getMediaType(String parameter, String paramValue) {
+ return getMediaType(Collections.singletonMap(parameter, paramValue));
+ }
+
+ /**
+ * Clones the (immutable) {@link #getMediaType() media type}, adding all provided
+ * parameters.
+ */
+ public MediaType getMediaType(Map<String, String> mediaTypeParams) {
+ Map<String, String> parameters = Maps.newHashMap(mediaType.getParameters());
+ parameters.putAll(mediaTypeParams);
+ return new MediaType(mediaType.getType(), mediaType.getSubtype(), parameters);
+ }
+
public String getMediaTypeProfile() {
return getMediaType().getParameters().get("profile");
}
@@ -124,4 +147,6 @@ public enum RepresentationType {
};
}
+
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulRequest.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulRequest.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulRequest.java
index fa3f0e1..22e7bea 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulRequest.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulRequest.java
@@ -64,7 +64,7 @@ public final class RestfulRequest {
public static RequestParameter<Integer> PAGE = new RequestParameter<Integer>("x-ro-page", Parser.forInteger(), 1);
public static RequestParameter<Integer> PAGE_SIZE = new RequestParameter<Integer>("x-ro-page-size", Parser.forInteger(), 25);
public static RequestParameter<List<String>> SORT_BY = new RequestParameter<List<String>>("x-ro-sort-by", Parser.forListOfStrings(), Collections.<String> emptyList());
- public static RequestParameter<DomainModel> DOMAIN_MODEL = new RequestParameter<DomainModel>("x-ro-domain-model", DomainModel.parser(), DomainModel.SIMPLE);
+ public static RequestParameter<DomainModel> DOMAIN_MODEL = new RequestParameter<DomainModel>("x-ro-domain-model", DomainModel.parser(), DomainModel.FORMAL);
public static RequestParameter<Boolean> VALIDATE_ONLY = new RequestParameter<Boolean>("x-ro-validate-only", Parser.forBoolean(), false);
private final String name;
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java
index 17b8818..6c96b1e 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java
@@ -30,6 +30,7 @@ import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.Response.Status.Family;
import javax.ws.rs.core.Response.StatusType;
+import org.apache.isis.core.commons.lang.StringUtils;
import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
import org.apache.isis.viewer.restfulobjects.applib.util.JsonMapper;
@@ -37,6 +38,7 @@ import org.apache.isis.viewer.restfulobjects.applib.util.Parser;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
+import com.google.common.base.Strings;
import com.google.common.collect.Maps;
public class RestfulResponse<T> {
@@ -239,7 +241,7 @@ public class RestfulResponse<T> {
public static class Header<X> {
- public final static Header<String> WARNING = new Header<String>("Warning", Parser.forString());
+ public final static Header<String> WARNING = new Header<String>("Warning", warningParser());
public final static Header<Date> LAST_MODIFIED = new Header<Date>("Last-Modified", Parser.forDate());
public final static Header<CacheControl> CACHE_CONTROL = new Header<CacheControl>("Cache-Control", Parser.forCacheControl());
public final static Header<MediaType> CONTENT_TYPE = new Header<MediaType>("Content-Type", Parser.forJaxRsMediaType());
@@ -260,6 +262,24 @@ public class RestfulResponse<T> {
return parser.valueOf(value);
}
+ private static Parser<String> warningParser() {
+ return new Parser<String>(){
+ private static final String PREFIX = "199 RestfulObjects ";
+
+ @Override
+ public String valueOf(String str) {
+ return stripPrefix(str, PREFIX);
+ }
+
+ @Override
+ public String asString(String str) {
+ return PREFIX + str;
+ }
+ private String stripPrefix(String str, String prefix) {
+ return str.startsWith(prefix) ? str.substring(prefix.length()) : str;
+ }
+ };
+ }
}
private final Response response;
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/Parser.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/Parser.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/Parser.java
index 706de82..846e0ea 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/Parser.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/Parser.java
@@ -164,7 +164,6 @@ public abstract class Parser<T> {
public String asString(final com.google.common.net.MediaType t) {
return t.toString();
}
-
};
}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulRequestDomainModelTest_parser.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulRequestDomainModelTest_parser.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulRequestDomainModelTest_parser.java
deleted file mode 100644
index 7a547e0..0000000
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulRequestDomainModelTest_parser.java
+++ /dev/null
@@ -1,39 +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.applib.client;
-
-import static org.junit.Assert.assertSame;
-
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.DomainModel;
-import org.apache.isis.viewer.restfulobjects.applib.util.Parser;
-import org.junit.Test;
-
-public class RestfulRequestDomainModelTest_parser {
-
- @Test
- public void parser_roundtrips() {
- final Parser<DomainModel> parser = RestfulRequest.DomainModel.parser();
- for (final DomainModel domainModel : DomainModel.values()) {
- final String asString = parser.asString(domainModel);
- final DomainModel roundtripped = parser.valueOf(asString);
- assertSame(roundtripped, domainModel);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulRequestRequestParameterTest_valueOf.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulRequestRequestParameterTest_valueOf.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulRequestRequestParameterTest_valueOf.java
deleted file mode 100644
index 30e5cd2..0000000
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulRequestRequestParameterTest_valueOf.java
+++ /dev/null
@@ -1,91 +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.applib.client;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.util.List;
-
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.RequestParameter;
-import org.junit.Before;
-import org.junit.Test;
-
-public class RestfulRequestRequestParameterTest_valueOf {
-
- private final RequestParameter<List<List<String>>> requestParameter = RestfulRequest.RequestParameter.FOLLOW_LINKS;
-
- private JsonRepresentation repr;
-
- @Before
- public void setUp() throws Exception {
- repr = JsonRepresentation.newMap();
- }
-
- @Test
- public void mapContainsList() {
- repr.mapPut("x-ro-follow-links", "a,b.c");
- final List<List<String>> valueOf = requestParameter.valueOf(repr);
-
- assertThat(valueOf.size(), is(2));
- assertThat(valueOf.get(0).size(), is(1));
- assertThat(valueOf.get(0).get(0), is("a"));
- assertThat(valueOf.get(1).size(), is(2));
- assertThat(valueOf.get(1).get(0), is("b"));
- assertThat(valueOf.get(1).get(1), is("c"));
- }
-
- @Test
- public void mapHasNoKey() {
- repr.mapPut("something-else", "a,b.c");
- final List<List<String>> valueOf = requestParameter.valueOf(repr);
-
- assertThat(valueOf.size(), is(0));
- }
-
- @Test
- public void mapIsEmpty() {
- final List<List<String>> valueOf = requestParameter.valueOf(repr);
-
- assertThat(valueOf.size(), is(0));
- }
-
- @Test
- public void mapIsNull() {
- final List<List<String>> valueOf = requestParameter.valueOf(null);
-
- assertThat(valueOf.size(), is(0));
- }
-
- @Test
- public void mapContainsCommaSeparatedList() {
-
- repr.mapPut("x-ro-follow-links", "a,b.c");
- final List<List<String>> valueOf = requestParameter.valueOf(repr);
-
- assertThat(valueOf.size(), is(2));
- assertThat(valueOf.get(0).size(), is(1));
- assertThat(valueOf.get(0).get(0), is("a"));
- assertThat(valueOf.get(1).size(), is(2));
- assertThat(valueOf.get(1).get(0), is("b"));
- assertThat(valueOf.get(1).get(1), is("c"));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulRequest_DomainModelTest_parser.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulRequest_DomainModelTest_parser.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulRequest_DomainModelTest_parser.java
new file mode 100644
index 0000000..594b9b7
--- /dev/null
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulRequest_DomainModelTest_parser.java
@@ -0,0 +1,39 @@
+/*
+ * 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.applib.client;
+
+import static org.junit.Assert.assertSame;
+
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.DomainModel;
+import org.apache.isis.viewer.restfulobjects.applib.util.Parser;
+import org.junit.Test;
+
+public class RestfulRequest_DomainModelTest_parser {
+
+ @Test
+ public void parser_roundtrips() {
+ final Parser<DomainModel> parser = RestfulRequest.DomainModel.parser();
+ for (final DomainModel domainModel : DomainModel.values()) {
+ final String asString = parser.asString(domainModel);
+ final DomainModel roundtripped = parser.valueOf(asString);
+ assertSame(roundtripped, domainModel);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulRequest_RequestParameterTest_valueOf_xrodomainmodel.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulRequest_RequestParameterTest_valueOf_xrodomainmodel.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulRequest_RequestParameterTest_valueOf_xrodomainmodel.java
new file mode 100644
index 0000000..3d4da4a
--- /dev/null
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulRequest_RequestParameterTest_valueOf_xrodomainmodel.java
@@ -0,0 +1,55 @@
+/*
+ * 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.applib.client;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.DomainModel;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.RequestParameter;
+import org.junit.Before;
+import org.junit.Test;
+
+public class RestfulRequest_RequestParameterTest_valueOf_xrodomainmodel {
+
+ private final RequestParameter<DomainModel> requestParameter = RestfulRequest.RequestParameter.DOMAIN_MODEL;
+
+ private JsonRepresentation repr;
+
+ @Before
+ public void setUp() throws Exception {
+ repr = JsonRepresentation.newMap();
+ }
+
+ @Test
+ public void simple() {
+ repr.mapPut("x-ro-domain-model", "simple");
+ final DomainModel valueOf = requestParameter.valueOf(repr);
+
+ assertThat(valueOf, is(DomainModel.SIMPLE));
+ }
+
+ @Test
+ public void whenNone() {
+ final DomainModel valueOf = requestParameter.valueOf(repr);
+
+ assertThat(valueOf, is(DomainModel.FORMAL));
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulRequest_RequestParameterTest_valueOf_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulRequest_RequestParameterTest_valueOf_xrofollowlinks.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulRequest_RequestParameterTest_valueOf_xrofollowlinks.java
new file mode 100644
index 0000000..62e8d7f
--- /dev/null
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulRequest_RequestParameterTest_valueOf_xrofollowlinks.java
@@ -0,0 +1,93 @@
+/*
+ * 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.applib.client;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.util.List;
+
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.RequestParameter;
+import org.junit.Before;
+import org.junit.Test;
+
+public class RestfulRequest_RequestParameterTest_valueOf_xrofollowlinks {
+
+ private final RequestParameter<List<List<String>>> requestParameter = RestfulRequest.RequestParameter.FOLLOW_LINKS;
+
+ private JsonRepresentation repr;
+
+ @Before
+ public void setUp() throws Exception {
+ repr = JsonRepresentation.newMap();
+ }
+
+ @Test
+ public void mapContainsList() {
+ repr.mapPut("x-ro-follow-links", "a,b.c");
+ final List<List<String>> valueOf = requestParameter.valueOf(repr);
+
+ assertThat(valueOf.size(), is(2));
+ assertThat(valueOf.get(0).size(), is(1));
+ assertThat(valueOf.get(0).get(0), is("a"));
+ assertThat(valueOf.get(1).size(), is(2));
+ assertThat(valueOf.get(1).get(0), is("b"));
+ assertThat(valueOf.get(1).get(1), is("c"));
+ }
+
+ @Test
+ public void mapHasNoKey() {
+ repr.mapPut("something-else", "a,b.c");
+ final List<List<String>> valueOf = requestParameter.valueOf(repr);
+
+ assertThat(valueOf.size(), is(0));
+ }
+
+ @Test
+ public void mapIsEmpty() {
+ final List<List<String>> valueOf = requestParameter.valueOf(repr);
+
+ assertThat(valueOf.size(), is(0));
+ }
+
+ @Test
+ public void mapIsNull() {
+ final List<List<String>> valueOf = requestParameter.valueOf(null);
+
+ assertThat(valueOf.size(), is(0));
+ }
+
+ @Test
+ public void mapContainsCommaSeparatedList() {
+
+ repr.mapPut("x-ro-follow-links", "a,b.c");
+ final List<List<String>> valueOf = requestParameter.valueOf(repr);
+
+ assertThat(valueOf.size(), is(2));
+ assertThat(valueOf.get(0).size(), is(1));
+ assertThat(valueOf.get(0).get(0), is("a"));
+ assertThat(valueOf.get(1).size(), is(2));
+ assertThat(valueOf.get(1).get(0), is("b"));
+ assertThat(valueOf.get(1).get(1), is("c"));
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse_HeaderTest_Warning.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse_HeaderTest_Warning.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse_HeaderTest_Warning.java
new file mode 100644
index 0000000..294cab7
--- /dev/null
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse_HeaderTest_Warning.java
@@ -0,0 +1,43 @@
+/*
+ * 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.applib.client;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.junit.Test;
+
+public class RestfulResponse_HeaderTest_Warning {
+
+
+ @Test
+ public void nonEmptyString() throws Exception {
+ assertThat(RestfulResponse.Header.WARNING.parse("199 RestfulObjects abc"), is("abc"));
+ }
+
+ @Test
+ public void emptyString() throws Exception {
+ assertThat(RestfulResponse.Header.WARNING.parse("199 RestfulObjects "), is(""));
+ }
+
+ @Test
+ public void noPrefix() throws Exception {
+ assertThat(RestfulResponse.Header.WARNING.parse("199 RestfulObject prefix is missing an 's'"), is("199 RestfulObject prefix is missing an 's'"));
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/ReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/ReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/ReprRenderer.java
index 81a03da..d0633ad 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/ReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/ReprRenderer.java
@@ -18,12 +18,14 @@
*/
package org.apache.isis.viewer.restfulobjects.rendering;
+import javax.ws.rs.core.MediaType;
+
import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
public interface ReprRenderer<R extends ReprRenderer<R, T>, T> {
- RepresentationType getRepresentationType();
+ MediaType getMediaType();
R with(T t);
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/ReprRendererAbstract.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/ReprRendererAbstract.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/ReprRendererAbstract.java
index fe57485..155eb96 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/ReprRendererAbstract.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/ReprRendererAbstract.java
@@ -19,8 +19,10 @@
package org.apache.isis.viewer.restfulobjects.rendering;
import java.util.List;
+import java.util.Map;
+
+import javax.ws.rs.core.MediaType;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.metamodel.spec.ObjectSpecification;
import org.apache.isis.core.runtime.system.context.IsisContext;
@@ -31,12 +33,15 @@ import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
import org.apache.isis.viewer.restfulobjects.rendering.domainobjects.DomainObjectReprRenderer;
import org.apache.isis.viewer.restfulobjects.rendering.domaintypes.DomainTypeReprRenderer;
+import com.google.common.collect.Maps;
+
public abstract class ReprRendererAbstract<R extends ReprRendererAbstract<R, T>, T> implements ReprRenderer<R, T> {
protected final RendererContext rendererContext;
private final LinkFollowSpecs linkFollower;
private final RepresentationType representationType;
protected final JsonRepresentation representation;
+ private final Map<String,String> mediaTypeParams = Maps.newLinkedHashMap();
protected boolean includesSelf;
@@ -63,8 +68,12 @@ public abstract class ReprRendererAbstract<R extends ReprRendererAbstract<R, T>,
}
@Override
- public RepresentationType getRepresentationType() {
- return representationType;
+ public MediaType getMediaType() {
+ return representationType.getMediaType(mediaTypeParams);
+ }
+
+ protected void addMediaTypeParams(String param, String paramValue) {
+ mediaTypeParams.put(param, paramValue);
}
@SuppressWarnings("unchecked")
@@ -73,10 +82,6 @@ public abstract class ReprRendererAbstract<R extends ReprRendererAbstract<R, T>,
return (R) this;
}
- public R withSelf(final JsonRepresentation link) {
- return withLink(Rel.SELF, link);
- }
-
public R withLink(final Rel rel, final String href) {
if (href != null) {
getLinks().arrayAdd(LinkBuilder.newBuilder(rendererContext, rel.getName(), representationType, href).build());
@@ -113,7 +118,16 @@ public abstract class ReprRendererAbstract<R extends ReprRendererAbstract<R, T>,
return;
}
final LinkBuilder linkBuilder = DomainTypeReprRenderer.newLinkToBuilder(getRendererContext(), rel, objectSpec);
- getLinks().arrayAdd(linkBuilder.build());
+ JsonRepresentation link = linkBuilder.build();
+ getLinks().arrayAdd(link);
+
+ final LinkFollowSpecs linkFollower = getLinkFollowSpecs().follow("links");
+ if (linkFollower.matches(link)) {
+ final DomainTypeReprRenderer renderer = new DomainTypeReprRenderer(getRendererContext(), linkFollower, JsonRepresentation.newMap())
+ .with(objectSpec);
+ link.mapPut("value", renderer.render());
+ }
+
}
/**
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/AbstractObjectMemberReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/AbstractObjectMemberReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/AbstractObjectMemberReprRenderer.java
index d824d6a..47357d4 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/AbstractObjectMemberReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/AbstractObjectMemberReprRenderer.java
@@ -16,6 +16,8 @@
*/
package org.apache.isis.viewer.restfulobjects.rendering.domainobjects;
+import javax.ws.rs.core.MediaType;
+
import org.apache.isis.applib.annotation.Where;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.metamodel.consent.Consent;
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java
index 65aef76..e8e8454 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java
@@ -46,6 +46,8 @@ import org.apache.isis.viewer.restfulobjects.rendering.util.OidUtils;
public class DomainObjectReprRenderer extends ReprRendererAbstract<DomainObjectReprRenderer, ObjectAdapter> {
+ private static final String X_RO_DOMAIN_TYPE = "x-ro-domain-type";
+
public static LinkBuilder newLinkToBuilder(final RendererContext rendererContext, final Rel rel, final ObjectAdapter objectAdapter) {
String domainType = OidUtils.getDomainType(objectAdapter);
String instanceId = OidUtils.getInstanceId(rendererContext, objectAdapter);
@@ -104,9 +106,11 @@ public class DomainObjectReprRenderer extends ReprRendererAbstract<DomainObjectR
@Override
public DomainObjectReprRenderer with(final ObjectAdapter objectAdapter) {
this.objectAdapter = objectAdapter;
+ addMediaTypeParams(X_RO_DOMAIN_TYPE, objectAdapter.getSpecification().getFullIdentifier());
return this;
}
+
@Override
public JsonRepresentation render() {
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainServicesListReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainServicesListReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainServicesListReprRenderer.java
deleted file mode 100644
index 2cf08ae..0000000
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainServicesListReprRenderer.java
+++ /dev/null
@@ -1,54 +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.rendering.domainobjects;
-
-import java.util.Collection;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-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.rendering.LinkFollowSpecs;
-import org.apache.isis.viewer.restfulobjects.rendering.RendererContext;
-import org.apache.isis.viewer.restfulobjects.rendering.ReprRendererAbstract;
-
-public class DomainServicesListReprRenderer extends ListReprRenderer {
-
- private ObjectAdapterLinkTo linkTo;
- private Collection<ObjectAdapter> objectAdapters;
- private ObjectSpecification elementType;
- private ObjectSpecification returnType;
-
- public DomainServicesListReprRenderer(final RendererContext resourceContext, final LinkFollowSpecs linkFollower, final JsonRepresentation representation) {
- super(resourceContext, linkFollower, representation);
- }
-
- @Override
- public JsonRepresentation render() {
- super.render();
-
- addLink(Rel.RETURN_TYPE, returnType);
- addLink(Rel.ELEMENT_TYPE, elementType);
-
- getExtensions();
-
- return representation;
- }
-
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ListReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ListReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ListReprRenderer.java
index 94e1e65..8896243 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ListReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ListReprRenderer.java
@@ -64,8 +64,8 @@ public class ListReprRenderer extends ReprRendererAbstract<ListReprRenderer, Col
public JsonRepresentation render() {
addValue();
- addLink(Rel.RETURN_TYPE, returnType);
- addLink(Rel.ELEMENT_TYPE, elementType);
+ addLinkToReturnType();
+ addLinkToElementType();
getExtensions();
@@ -97,4 +97,13 @@ public class ListReprRenderer extends ReprRendererAbstract<ListReprRenderer, Col
representation.mapPut("value", values);
}
+
+ protected void addLinkToReturnType() {
+ addLink(Rel.RETURN_TYPE, returnType);
+ }
+
+ protected void addLinkToElementType() {
+ addLink(Rel.ELEMENT_TYPE, elementType);
+ }
+
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ScalarValueReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ScalarValueReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ScalarValueReprRenderer.java
index f549211..f5eb48a 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ScalarValueReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ScalarValueReprRenderer.java
@@ -16,6 +16,8 @@
*/
package org.apache.isis.viewer.restfulobjects.rendering.domainobjects;
+import javax.ws.rs.core.MediaType;
+
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.metamodel.facets.object.encodeable.EncodableFacet;
import org.apache.isis.core.metamodel.spec.ObjectSpecification;
@@ -43,8 +45,8 @@ public class ScalarValueReprRenderer extends ReprRendererAbstract<ScalarValueRep
* In case I forget in the future that scalar values don't have a representation.
*/
@Override
- public RepresentationType getRepresentationType() {
- throw new UnsupportedOperationException("no representationType defined for scalar values");
+ public MediaType getMediaType() {
+ throw new UnsupportedOperationException("no mediaType defined for scalar values");
}
@Override
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/AbstractTypeMemberReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/AbstractTypeMemberReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/AbstractTypeMemberReprRenderer.java
index 904b278..b449ddf 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/AbstractTypeMemberReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/AbstractTypeMemberReprRenderer.java
@@ -68,7 +68,7 @@ public abstract class AbstractTypeMemberReprRenderer<R extends ReprRendererAbstr
}
final ObjectMember objectMember = getObjectFeature();
- final LinkBuilder linkBuilder = LinkBuilder.newBuilder(getRendererContext(), Rel.SELF.getName(), getRepresentationType(), "domainTypes/%s/%s%s", getParentSpecification().getFullIdentifier(), getMemberType().getUrlPart(), objectMember.getId());
+ final LinkBuilder linkBuilder = LinkBuilder.newBuilder(getRendererContext(), Rel.SELF.getName(), getMediaType(), "domainTypes/%s/%s%s", getParentSpecification().getFullIdentifier(), getMemberType().getUrlPart(), objectMember.getId());
getLinks().arrayAdd(linkBuilder.build());
}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/TypeActionResultReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/TypeActionResultReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/TypeActionResultReprRenderer.java
index 62d69fc..1da62ab 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/TypeActionResultReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/TypeActionResultReprRenderer.java
@@ -19,6 +19,7 @@ package org.apache.isis.viewer.restfulobjects.rendering.domaintypes;
import org.apache.isis.core.metamodel.spec.ObjectSpecification;
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.rendering.LinkFollowSpecs;
import org.apache.isis.viewer.restfulobjects.rendering.RendererContext;
@@ -45,6 +46,10 @@ public class TypeActionResultReprRenderer extends ReprRendererAbstract<TypeActio
return this;
}
+ public TypeActionResultReprRenderer withSelf(final JsonRepresentation link) {
+ return withLink(Rel.SELF, link);
+ }
+
@Override
public JsonRepresentation render() {
if (includesSelf && selfLink != null) {
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/rendering/src/test/java/org/apache/isis/viewer/restfulobjects/rendering/LinkFollowSpecsTest_follow.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/test/java/org/apache/isis/viewer/restfulobjects/rendering/LinkFollowSpecsTest_follow.java b/component/viewer/restfulobjects/rendering/src/test/java/org/apache/isis/viewer/restfulobjects/rendering/LinkFollowSpecsTest_follow.java
index fab909e..3ad5e90 100644
--- a/component/viewer/restfulobjects/rendering/src/test/java/org/apache/isis/viewer/restfulobjects/rendering/LinkFollowSpecsTest_follow.java
+++ b/component/viewer/restfulobjects/rendering/src/test/java/org/apache/isis/viewer/restfulobjects/rendering/LinkFollowSpecsTest_follow.java
@@ -22,7 +22,6 @@ import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import java.util.List;
-import java.util.Map;
import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
import org.apache.isis.viewer.restfulobjects.applib.util.Parser;
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/ResourceContext.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/ResourceContext.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/ResourceContext.java
index e5c0ebd..016002d 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/ResourceContext.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/ResourceContext.java
@@ -39,6 +39,7 @@ import org.apache.isis.core.metamodel.spec.SpecificationLoader;
import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.DomainModel;
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.rendering.RendererContext;
@@ -68,21 +69,13 @@ public class ResourceContext implements RendererContext {
private List<List<String>> followLinks;
- private final static Predicate<MediaType> MEDIA_TYPE_NOT_GENERIC_APPLICATION_JSON = new Predicate<MediaType>() {
- @Override
- public boolean apply(final MediaType mediaType) {
- return !mediaType.equals(MediaType.APPLICATION_JSON_TYPE);
- }
- };
- private final static Predicate<MediaType> MEDIA_TYPE_CONTAINS_PROFILE = new Predicate<MediaType>() {
- @Override
- public boolean apply(final MediaType mediaType) {
- return mediaType.getParameters().containsKey("profile");
- }
- };
private final Where where;
private JsonRepresentation readQueryStringAsMap;
+ //////////////////////////////////////////////////////////////////
+ // constructor and init
+ //////////////////////////////////////////////////////////////////
+
public ResourceContext(
final RepresentationType representationType,
final HttpHeaders httpHeaders, final UriInfo uriInfo,
@@ -112,9 +105,47 @@ public class ResourceContext implements RendererContext {
void init(final RepresentationType representationType) {
ensureCompatibleAcceptHeader(representationType);
+ ensureDomainModelQueryParamSupported();
+
this.followLinks = Collections.unmodifiableList(getArg(RequestParameter.FOLLOW_LINKS));
}
+ private void ensureDomainModelQueryParamSupported() {
+ final DomainModel domainModel = getArg(RequestParameter.DOMAIN_MODEL);
+ if(domainModel != DomainModel.FORMAL) {
+ throw RestfulObjectsApplicationException.create(HttpStatusCode.BAD_REQUEST,
+ "x-ro-domain-model of '%s' is not supported", domainModel);
+ }
+ }
+
+ private void ensureCompatibleAcceptHeader(final RepresentationType representationType) {
+ if (representationType == null) {
+ return;
+ }
+
+ // RestEasy will check the basic media types...
+ // ... so we just need to check the profile paramter
+ final String producedProfile = representationType.getMediaTypeProfile();
+ if(producedProfile != null) {
+ for (MediaType mediaType : httpHeaders.getAcceptableMediaTypes()) {
+ String acceptedProfileValue = mediaType.getParameters().get("profile");
+ if(acceptedProfileValue == null) {
+ continue;
+ }
+ if(!producedProfile.equals(acceptedProfileValue)) {
+ throw RestfulObjectsApplicationException.create(HttpStatusCode.NOT_ACCEPTABLE);
+ }
+ }
+ }
+ }
+
+
+
+ //////////////////////////////////////////////////////////////////
+ //
+ //////////////////////////////////////////////////////////////////
+
+
public HttpHeaders getHttpHeaders() {
return httpHeaders;
}
@@ -155,39 +186,13 @@ public class ResourceContext implements RendererContext {
return securityContext;
}
- private void ensureCompatibleAcceptHeader(final RepresentationType representationType) {
- if (representationType == null) {
- return;
- }
-
- // RestEasy will check the basic media types...
- // ... so we just need to check the profile paramter
- final String producedProfile = representationType.getMediaTypeProfile();
- if(producedProfile != null) {
- for (MediaType mediaType : httpHeaders.getAcceptableMediaTypes()) {
- String acceptedProfileValue = mediaType.getParameters().get("profile");
- if(acceptedProfileValue == null) {
- continue;
- }
- if(!producedProfile.equals(acceptedProfileValue)) {
- throw RestfulObjectsApplicationException.create(HttpStatusCode.NOT_ACCEPTABLE);
- }
- }
- }
- }
-
- protected boolean contains(final com.google.common.net.MediaType producedType, final List<MediaType> acceptableMediaTypes) {
- return acceptableMediaTypes.contains(producedType);
- }
public List<List<String>> getFollowLinks() {
return followLinks;
}
- public String urlFor(final String url) {
- return getUriInfo().getBaseUri().toString() + url;
- }
+
public Localization getLocalization() {
return localization;
}
@@ -215,5 +220,14 @@ public class ResourceContext implements RendererContext {
public Where getWhere() {
return where;
}
-
+
+
+ //////////////////////////////////////////////////////////////////
+ //
+ //////////////////////////////////////////////////////////////////
+
+ public String urlFor(final String url) {
+ return getUriInfo().getBaseUri().toString() + url;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapper.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapper.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapper.java
index b36aa1d..72a9f1b 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapper.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapper.java
@@ -38,12 +38,14 @@ import com.google.common.collect.Lists;
@Provider
public class RestfulObjectsApplicationExceptionMapper implements ExceptionMapper<RestfulObjectsApplicationException> {
+ private static final String WARNING_HEADER_PREFIX = "199 RestfulObjects ";
+
@Override
public Response toResponse(final RestfulObjectsApplicationException ex) {
final ResponseBuilder builder = Response.status(ex.getHttpStatusCode().getJaxrsStatusType()).type(RestfulMediaType.APPLICATION_JSON_ERROR).entity(jsonFor(ex));
final String message = ex.getMessage();
if (message != null) {
- builder.header(RestfulResponse.Header.WARNING.getName(), message);
+ builder.header(RestfulResponse.Header.WARNING.getName(), WARNING_HEADER_PREFIX + message);
}
return builder.build();
}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java
index c537b7b..9913481 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java
@@ -32,13 +32,14 @@ import javax.ws.rs.core.Response;
import org.apache.isis.applib.annotation.Where;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
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.RestfulMediaType;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.DomainModel;
+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.DomainServiceResource;
import org.apache.isis.viewer.restfulobjects.rendering.domainobjects.DomainObjectReprRenderer;
import org.apache.isis.viewer.restfulobjects.rendering.domainobjects.DomainServiceLinkTo;
-import org.apache.isis.viewer.restfulobjects.rendering.domainobjects.ListReprRenderer;
import org.apache.isis.viewer.restfulobjects.server.resources.DomainResourceHelper.MemberMode;
@Path("/services")
@@ -50,12 +51,13 @@ public class DomainServiceResourceServerside extends ResourceAbstract implements
@Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_LIST, RestfulMediaType.APPLICATION_JSON_ERROR })
public Response services() {
init(RepresentationType.LIST, Where.STANDALONE_TABLES);
+
final List<ObjectAdapter> serviceAdapters = getResourceContext().getServiceAdapters();
- final ListReprRenderer renderer = new ListReprRenderer(getResourceContext(), null, JsonRepresentation.newMap());
+ final DomainServicesListReprRenderer renderer = new DomainServicesListReprRenderer(getResourceContext(), null, JsonRepresentation.newMap());
renderer.usingLinkToBuilder(new DomainServiceLinkTo())
- .withLink(Rel.SELF, "services")
+ .includesSelf()
.with(serviceAdapters);
return responseOfOk(renderer, Caching.ONE_DAY).build();
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServicesListReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServicesListReprRenderer.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServicesListReprRenderer.java
new file mode 100644
index 0000000..815aba4
--- /dev/null
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServicesListReprRenderer.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.server.resources;
+
+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.rendering.LinkBuilder;
+import org.apache.isis.viewer.restfulobjects.rendering.LinkFollowSpecs;
+import org.apache.isis.viewer.restfulobjects.rendering.RendererContext;
+import org.apache.isis.viewer.restfulobjects.rendering.domainobjects.ListReprRenderer;
+
+public class DomainServicesListReprRenderer extends ListReprRenderer {
+
+ public DomainServicesListReprRenderer(final RendererContext resourceContext, final LinkFollowSpecs linkFollower, final JsonRepresentation representation) {
+ super(resourceContext, linkFollower, representation);
+ }
+
+
+ @Override
+ public JsonRepresentation render() {
+ super.render();
+ if (includesSelf) {
+ addLinkToSelf();
+ addLinkToUp();
+ }
+ getExtensions();
+ return representation;
+ }
+
+
+ private void addLinkToSelf() {
+ final JsonRepresentation link = LinkBuilder.newBuilder(getRendererContext(), Rel.SELF.getName(), RepresentationType.LIST, "services").build();
+
+ final LinkFollowSpecs linkFollower = getLinkFollowSpecs().follow("links");
+ if (linkFollower.matches(link)) {
+ final DomainServicesListReprRenderer renderer = new DomainServicesListReprRenderer(getRendererContext(), linkFollower, JsonRepresentation.newMap());
+ renderer.with(getServiceAdapters());
+ link.mapPut("value", renderer.render());
+ }
+
+ getLinks().arrayAdd(link);
+ }
+
+ private void addLinkToUp() {
+ final JsonRepresentation link = LinkBuilder.newBuilder(rendererContext, Rel.UP.getName(), RepresentationType.HOME_PAGE, "").build();
+
+ final LinkFollowSpecs linkFollower = getLinkFollowSpecs().follow("links");
+ if (linkFollower.matches(link)) {
+ final HomePageReprRenderer renderer = new HomePageReprRenderer(getRendererContext(), linkFollower, JsonRepresentation.newMap());
+ link.mapPut("value", renderer.render());
+ }
+ getLinks().arrayAdd(link);
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainTypeResourceServerside.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainTypeResourceServerside.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainTypeResourceServerside.java
index 7835356..4bfcbef 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainTypeResourceServerside.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainTypeResourceServerside.java
@@ -237,6 +237,7 @@ public class DomainTypeResourceServerside extends ResourceAbstract implements Do
return responseOfOk(renderer, Caching.ONE_DAY).build();
}
+
@Override
@GET
@Path("/{domainType}/typeactions/isSupertypeOf/invoke")
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java
index 5a8d4ca..5d1e6fb 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java
@@ -191,12 +191,12 @@ public abstract class ResourceAbstract {
}
public static ResponseBuilder responseOfOk(final ReprRenderer<?, ?> renderer, final Caching caching, final Version version) {
- final RepresentationType representationType = renderer.getRepresentationType();
- final ResponseBuilder response = responseOf(HttpStatusCode.OK).type(representationType.getMediaType()).cacheControl(caching.getCacheControl()).entity(jsonFor(renderer.render()));
+ final MediaType mediaType = renderer.getMediaType();
+ final ResponseBuilder response = responseOf(HttpStatusCode.OK).type(mediaType).cacheControl(caching.getCacheControl()).entity(jsonFor(renderer.render()));
return addLastModifiedAndETagIfAvailable(response, version);
}
- private static ResponseBuilder responseOf(final HttpStatusCode httpStatusCode) {
+ protected static ResponseBuilder responseOf(final HttpStatusCode httpStatusCode) {
return Response.status(httpStatusCode.getJaxrsStatusType()).type(MediaType.APPLICATION_JSON_TYPE);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/RepresentationMatchers.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/RepresentationMatchers.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/RepresentationMatchers.java
index 117dc1f..b8a0c2c 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/RepresentationMatchers.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/RepresentationMatchers.java
@@ -254,6 +254,10 @@ public class RepresentationMatchers {
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("'");
}
@@ -292,7 +296,7 @@ public class RepresentationMatchers {
description.appendText(" and");
}
if (selfHref != null) {
- description.appendText(" an response whose self.href is " + selfHref);
+ description.appendText(" has a response whose self.href is " + selfHref);
}
}
}
@@ -306,7 +310,7 @@ public class RepresentationMatchers {
if (rel != null && !rel.equals(link.getRel())) {
return false;
}
- if (relNameMatcher != null && !relNameMatcher.matches(link.getHref())) {
+ if (relNameMatcher != null && !relNameMatcher.matches(link.getRel())) {
return false;
}
if (href != null && !href.equals(link.getHref())) {
@@ -331,7 +335,7 @@ public class RepresentationMatchers {
if (novalue != null && novalue && link.getValue() != null) {
return false;
}
- if (valueMatcher != null && !valueMatcher.matches(link)) {
+ if (valueMatcher != null && !valueMatcher.matches(link.getValue())) {
return false;
}
@@ -364,7 +368,7 @@ public class RepresentationMatchers {
if(entity == null) {
return false;
}
- LinkRepresentation selfLink = entity.getLink("self");
+ LinkRepresentation selfLink = entity.getLink("links[rel=self]");
if(selfLink == null) {
return false;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/any/AnyResourceTest_serverSideException_exceptionHandling.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/any/AnyResourceTest_serverSideException_exceptionHandling.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/any/AnyResourceTest_serverSideException_exceptionHandling.java
new file mode 100644
index 0000000..f71fc48
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/any/AnyResourceTest_serverSideException_exceptionHandling.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.any;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.Header;
+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.util.Parser;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class AnyResourceTest_serverSideException_exceptionHandling {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ }
+
+ @Test
+ public void runtimeException_isMapped() throws Exception {
+
+ // given
+ final RestfulRequest restfulReq = client.createRequest(RestfulHttpMethod.GET, "version");
+ final Header<Boolean> header = new Header<Boolean>("X-FAIL", Parser.forBoolean());
+ restfulReq.withHeader(header, true);
+
+ // when
+ final RestfulResponse<JsonRepresentation> jsonResp = restfulReq.execute();
+
+ // then
+ assertThat(jsonResp.getStatus(), is(HttpStatusCode.METHOD_FAILURE));
+ }
+}
[49/50] [abbrv] git commit: ISIS-233: more tck tests
Posted by da...@apache.org.
ISIS-233: more tck tests
- making tests for some of the 404 resp codes pass.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/de415353
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/de415353
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/de415353
Branch: refs/heads/master
Commit: de415353065d37ed88885eaca70f29b42e26c07b
Parents: 430e8b3
Author: Dan Haywood <da...@apache.org>
Authored: Sat Apr 27 18:38:51 2013 +0100
Committer: Dan Haywood <da...@apache.org>
Committed: Sat Apr 27 19:01:46 2013 +0100
----------------------------------------------------------------------
.../restfulobjects/rendering/RendererContext.java | 4 +
.../EventSerializerRendererContext.java | 9 ++-
.../server/resources/DomainResourceHelper.java | 36 ++++++-
.../restfulobjects/server/util/OidUtils.java | 3 +-
...et_whenDoesntExistOid_thenResponseCode_404.java | 68 ++++++++++++++
...enDoesntExistOid_thenResponseCode_404_TODO.java | 72 ---------------
...et_whenDoesntExistOid_thenResponseCode_404.java | 50 ++++++++++
...enDoesntExistOid_thenResponseCode_404_TODO.java | 5 -
...t_whenDoesntExistProp_thenResponseCode_404.java | 50 ++++++++++
...nDoesntExistProp_thenResponseCode_404_TODO.java | 5 -
10 files changed, 212 insertions(+), 90 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/de415353/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/RendererContext.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/RendererContext.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/RendererContext.java
index 22d702d..99db6c9 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/RendererContext.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/RendererContext.java
@@ -6,6 +6,7 @@ import org.apache.isis.applib.annotation.Where;
import org.apache.isis.applib.profiles.Localization;
import org.apache.isis.core.commons.authentication.AuthenticationSession;
import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
public interface RendererContext {
@@ -15,9 +16,12 @@ public interface RendererContext {
public AdapterManager getAdapterManager();
+ public PersistenceSession getPersistenceSession();
+
public List<List<String>> getFollowLinks();
public Where getWhere();
public Localization getLocalization();
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/de415353/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/eventserializer/EventSerializerRendererContext.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/eventserializer/EventSerializerRendererContext.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/eventserializer/EventSerializerRendererContext.java
index 98b6711..4beba68 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/eventserializer/EventSerializerRendererContext.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/eventserializer/EventSerializerRendererContext.java
@@ -8,6 +8,7 @@ import org.apache.isis.applib.profiles.Localization;
import org.apache.isis.core.commons.authentication.AuthenticationSession;
import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
import org.apache.isis.viewer.restfulobjects.rendering.RendererContext;
public class EventSerializerRendererContext implements RendererContext {
@@ -31,8 +32,13 @@ public class EventSerializerRendererContext implements RendererContext {
}
@Override
+ public PersistenceSession getPersistenceSession() {
+ return IsisContext.getPersistenceSession();
+ }
+
+ @Override
public AdapterManager getAdapterManager() {
- return IsisContext.getPersistenceSession().getAdapterManager();
+ return getPersistenceSession().getAdapterManager();
}
@Override
@@ -50,4 +56,5 @@ public class EventSerializerRendererContext implements RendererContext {
return IsisContext.getLocalization();
}
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/de415353/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
index 22312c9..0e0450d 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
@@ -366,31 +366,55 @@ public final class DomainResourceHelper {
protected OneToOneAssociation getPropertyThatIsVisibleForIntent(final String propertyId, final Intent intent, Where where) {
- final ObjectAssociation association = objectAdapter.getSpecification().getAssociation(propertyId);
+ final ObjectAssociation association;
+ try {
+ final ObjectSpecification specification = objectAdapter.getSpecification();
+ association = specification.getAssociation(propertyId);
+ } catch(Exception ex) {
+ // fall through
+ throwNotFoundException(propertyId, MemberType.PROPERTY);
+ return null; // to keep compiler happy.
+ }
+
if (association == null || !association.isOneToOneAssociation()) {
throwNotFoundException(propertyId, MemberType.PROPERTY);
}
+
final OneToOneAssociation property = (OneToOneAssociation) association;
return memberThatIsVisibleForIntent(property, MemberType.PROPERTY, intent, where);
}
protected OneToManyAssociation getCollectionThatIsVisibleForIntent(final String collectionId, final Intent intent, Where where) {
- final ObjectAssociation association = objectAdapter.getSpecification().getAssociation(collectionId);
- if (association == null || !association.isOneToManyAssociation()) {
+ final ObjectAssociation association;
+ try {
+ final ObjectSpecification specification = objectAdapter.getSpecification();
+ association = specification.getAssociation(collectionId);
+ } catch(Exception ex) {
+ // fall through
throwNotFoundException(collectionId, MemberType.COLLECTION);
+ return null; // to keep compiler happy.
}
+ if (association == null || !association.isOneToManyAssociation()) {
+ throwNotFoundException(collectionId, MemberType.COLLECTION);
+ }
final OneToManyAssociation collection = (OneToManyAssociation) association;
return memberThatIsVisibleForIntent(collection, MemberType.COLLECTION, intent, where);
}
protected ObjectAction getObjectActionThatIsVisibleForIntent(final String actionId, final Intent intent, Where where) {
- final ObjectAction action = objectAdapter.getSpecification().getObjectAction(actionId);
- if (action == null) {
+ final ObjectAction action;
+ try {
+ final ObjectSpecification specification = objectAdapter.getSpecification();
+ action = specification.getObjectAction(actionId);
+ } catch(Exception ex) {
throwNotFoundException(actionId, MemberType.ACTION);
+ return null; // to keep compiler happy.
}
-
+ if (action == null) {
+ throwNotFoundException(actionId, MemberType.ACTION);
+ }
return memberThatIsVisibleForIntent(action, MemberType.ACTION, intent, where);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/de415353/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/util/OidUtils.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/util/OidUtils.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/util/OidUtils.java
index 9785adf..c10424b 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/util/OidUtils.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/util/OidUtils.java
@@ -89,7 +89,8 @@ public final class OidUtils {
private static ObjectAdapter getObjectAdapterForUnencodedElseThrowNotFound(final RendererContext resourceContext, final String oidStr) {
final RootOid rootOid = RootOidDefault.deStringEncoded(oidStr, getOidMarshaller());
- return resourceContext.getAdapterManager().adapterFor(rootOid);
+ //return resourceContext.getAdapterManager().adapterFor(rootOid);
+ return resourceContext.getPersistenceSession().loadObject(rootOid);
}
private static OidMarshaller getOidMarshaller() {
http://git-wip-us.apache.org/repos/asf/isis/blob/de415353/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenDoesntExistOid_thenResponseCode_404.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenDoesntExistOid_thenResponseCode_404.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenDoesntExistOid_thenResponseCode_404.java
new file mode 100644
index 0000000..d32d67b
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenDoesntExistOid_thenResponseCode_404.java
@@ -0,0 +1,68 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+
+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.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.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.DomainObjectResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+
+public class Get_whenDoesntExistOid_thenResponseCode_404 {
+
+ @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());
+ }
+
+ @Test
+ public void usingClientFollow() throws Exception {
+
+ // given
+ final LinkRepresentation link = Util.domainObjectLink(client, "PrimitiveValuedEntities");
+ link.withHref("http://localhost:39393/objects/PRMV/nonExistent");
+
+ // when
+ final RestfulResponse<JsonRepresentation> restfulResp = client.follow(link);
+
+ // then
+ then(restfulResp);
+
+ }
+
+ @Test
+ public void usingResourceProxy() throws Exception {
+
+ // when
+ final DomainObjectResource objectResource = client.getDomainObjectResource();
+
+ final Response response = objectResource.object("PRMV", "nonExistent");
+ RestfulResponse<JsonRepresentation> restfulResp = RestfulResponse.of(response);
+
+ then(restfulResp);
+
+ }
+
+ private void then(final RestfulResponse<JsonRepresentation> restfulResp) {
+ assertThat(restfulResp.getStatus(), is(HttpStatusCode.NOT_FOUND));
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/de415353/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenDoesntExistOid_thenResponseCode_404_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenDoesntExistOid_thenResponseCode_404_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenDoesntExistOid_thenResponseCode_404_TODO.java
deleted file mode 100644
index e434b2a..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenDoesntExistOid_thenResponseCode_404_TODO.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
-
-import static org.hamcrest.CoreMatchers.*;
-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.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.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.DomainObjectResource;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.apache.isis.viewer.restfulobjects.tck.Util;
-
-public class Get_whenDoesntExistOid_thenResponseCode_404_TODO {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- protected RestfulClient client;
-
- private DomainObjectRepresentation domainObjectRepr;
-
- @Before
- public void setUp() throws Exception {
- final WebServer webServer = webServerRule.getWebServer();
- client = new RestfulClient(webServer.getBase());
- }
-
- @Test
- public void usingClientFollow() throws Exception {
-
- // given
- final LinkRepresentation link = Util.domainObjectLink(client, "PrimitiveValuedEntities");
- link.mapPut("href", "http://localhost:39393/objects/PRMV/nonExistent");
-
- // when
- final RestfulResponse<JsonRepresentation> restfulResp = client.follow(link);
-
- // then
- then(restfulResp);
-
- }
-
- @Test
- public void usingResourceProxy() throws Exception {
-
- // when
- final DomainObjectResource objectResource = client.getDomainObjectResource();
-
- final Response response = objectResource.object("PRMV", "nonExistent");
- RestfulResponse<JsonRepresentation> restfulResp = RestfulResponse.of(response);
-
- then(restfulResp);
-
- }
-
- private void then(final RestfulResponse<JsonRepresentation> restfulResp) {
- assertThat(restfulResp.getStatus(), is(HttpStatusCode.NOT_FOUND));
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/de415353/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenDoesntExistOid_thenResponseCode_404.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenDoesntExistOid_thenResponseCode_404.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenDoesntExistOid_thenResponseCode_404.java
new file mode 100644
index 0000000..2f33548
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenDoesntExistOid_thenResponseCode_404.java
@@ -0,0 +1,50 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+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.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.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.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+
+public class Get_whenDoesntExistOid_thenResponseCode_404 {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+
+ private LinkRepresentation link;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+
+ link = new LinkRepresentation();
+ }
+
+ @Test
+ public void whenObjectDoesntExist() throws Exception {
+
+ // given
+ link.withHref("http://localhost:39393/objects/PRMV/nonExistent/properties/booleanProperty");
+
+ // when
+ final RestfulResponse<JsonRepresentation> restfulResp = client.follow(link);
+
+ // then
+ assertThat(restfulResp.getStatus(), is(HttpStatusCode.NOT_FOUND));
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/de415353/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenDoesntExistOid_thenResponseCode_404_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenDoesntExistOid_thenResponseCode_404_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenDoesntExistOid_thenResponseCode_404_TODO.java
deleted file mode 100644
index ef52c22..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenDoesntExistOid_thenResponseCode_404_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
-
-public class Get_whenDoesntExistOid_thenResponseCode_404_TODO {
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/de415353/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenDoesntExistProp_thenResponseCode_404.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenDoesntExistProp_thenResponseCode_404.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenDoesntExistProp_thenResponseCode_404.java
new file mode 100644
index 0000000..be86b0c
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenDoesntExistProp_thenResponseCode_404.java
@@ -0,0 +1,50 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+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.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.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.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+
+public class Get_whenDoesntExistProp_thenResponseCode_404 {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+
+ private LinkRepresentation link;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+
+ link = new LinkRepresentation();
+ }
+
+ @Test
+ public void whenPropertyDoesntExist() throws Exception {
+
+ // given
+ final LinkRepresentation linkToExistingObject = Util.domainObjectLink(client, "PrimitiveValuedEntities");
+ link.withHref(linkToExistingObject.getHref() + "/properties/nonExistentProperty");
+
+ // when
+ final RestfulResponse<JsonRepresentation> restfulResp = client.follow(link);
+
+ // then
+ assertThat(restfulResp.getStatus(), is(HttpStatusCode.NOT_FOUND));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/de415353/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenDoesntExistProp_thenResponseCode_404_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenDoesntExistProp_thenResponseCode_404_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenDoesntExistProp_thenResponseCode_404_TODO.java
deleted file mode 100644
index 4eb690f..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenDoesntExistProp_thenResponseCode_404_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
-
-public class Get_whenDoesntExistProp_thenResponseCode_404_TODO {
-
-}
[15/50] [abbrv] git commit: ISIS-233-ro: more on
domainservice.serviceId
Posted by da...@apache.org.
ISIS-233-ro: more on domainservice.serviceId
* and lots of renaming of existing test classes.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/5e01f688
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/5e01f688
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/5e01f688
Branch: refs/heads/master
Commit: 5e01f688329c8a6769966558a5a39ed8c344dcb7
Parents: 771d1ab
Author: Dan Haywood <da...@apache.org>
Authored: Wed Feb 27 00:14:52 2013 +0000
Committer: Dan Haywood <da...@apache.org>
Committed: Sat Apr 27 18:57:35 2013 +0100
----------------------------------------------------------------------
.../applib/domaintypes/DomainTypeResource.java | 2 +-
.../AbstractTypeMemberReprRenderer.java | 4 +-
.../domaintypes/ActionDescriptionReprRenderer.java | 4 +-
.../ActionParameterDescriptionReprRenderer.java | 4 +-
.../CollectionDescriptionReprRenderer.java | 4 +-
.../domaintypes/DomainTypeReprRenderer.java | 6 +-
.../PropertyDescriptionReprRenderer.java | 4 +-
.../domaintypes/TypeListReprRenderer.java | 4 +-
.../resources/DomainTypeResourceServerside.java | 23 +-
.../server/resources/HomePageReprRenderer.java | 4 +-
...Test_serverSideException_exceptionHandling.java | 65 ---
.../AnyResourceTest_serverSideException.java | 63 +++
...sourceTest_serviceId_request_header_accept.java | 110 ----
..._serviceId_request_queryarg_xrodomainmodel.java | 75 ---
..._serviceId_request_queryarg_xrofollowlinks.java | 119 -----
...iceResourceTest_serviceId_response_headers.java | 70 ---
...urceTest_serviceId_response_representation.java | 163 ------
...viceResourceTest_serviceId_status_notFound.java | 70 ---
...ServiceResourceTest_services_header_accept.java | 105 ----
...ourceTest_services_queryarg_xrofollowlinks.java | 152 ------
...viceResourceTest_services_response_headers.java | 82 ---
...ourceTest_services_response_representation.java | 128 -----
.../restfulobjects/tck/domainservice/Util.java | 49 --
.../root/DomainServiceTest_req_header_accept.java | 105 ++++
...ainServiceTest_req_queryarg_xrofollowlinks.java | 152 ++++++
.../root/DomainServiceTest_resp_headers.java | 82 +++
.../DomainServiceTest_resp_representation.java | 128 +++++
.../DomainServiceTest_req_header_accept.java | 110 ++++
...ainServiceTest_req_queryarg_xrodomainmodel.java | 75 +++
...ainServiceTest_req_queryarg_xrofollowlinks.java | 119 +++++
.../serviceId/DomainServiceTest_resp_headers.java | 70 +++
.../DomainServiceTest_resp_representation.java | 148 ++++++
.../serviceId/DomainServiceTest_when_notFound.java | 70 +++
.../tck/domainservice/serviceId/Util.java | 49 ++
.../HomePageResourceTest_root_header_accept.java | 106 ----
...ResourceTest_root_queryargs_xrofollowlinks.java | 168 ------
...HomePageResourceTest_root_response_headers.java | 79 ---
...eResourceTest_root_response_representation.java | 111 ----
.../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 ++++
...serResourceTest_root_request_header_accept.java | 105 ----
...Test_root_request_queryargs_xrofollowlinks.java | 92 ----
.../UserResourceTest_root_response_headers.java | 96 ----
...rResourceTest_root_response_representation.java | 104 ----
.../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 ++++
...ionResourceTest_root_request_header_accept.java | 110 ----
...Test_root_request_queryargs_xrofollowlinks.java | 88 ---
.../VersionResourceTest_root_response_headers.java | 82 ---
...nResourceTest_root_response_representation.java | 113 ----
.../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 ++
...nstanceid_get_response_header_cacheControl.java | 61 ---
...est_instanceid_get_response_representation.java | 401 --------------
...ainObjectTest_get_resp_header_cacheControl.java | 61 +++
.../DomainObjectTest_get_resp_representation.java | 408 +++++++++++++++
...ServiceResourceTest_serviceId_invokeAction.java | 265 ----------
...rceTest_serviceId_invokeAction_returnsList.java | 13 -
...eTest_serviceId_invokeAction_returnsObject.java | 13 -
...eTest_serviceId_invokeAction_returnsScalar.java | 13 -
...rceTest_serviceId_invokeAction_returnsVoid.java | 13 -
...rceTest_serviceId_invokeAction_throwsError.java | 13 -
.../DomainServiceTest_invoke_TOREFACTOR.java | 265 ++++++++++
...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 +
78 files changed, 3353 insertions(+), 3262 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domaintypes/DomainTypeResource.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domaintypes/DomainTypeResource.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domaintypes/DomainTypeResource.java
index 90c1b70..638023c 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domaintypes/DomainTypeResource.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domaintypes/DomainTypeResource.java
@@ -29,7 +29,7 @@ import javax.ws.rs.core.Response;
import org.apache.isis.viewer.restfulobjects.applib.RestfulMediaType;
import org.jboss.resteasy.annotations.ClientResponseType;
-@Path("/domainTypes")
+@Path("/domain-types")
public interface DomainTypeResource {
// /////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/AbstractTypeMemberReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/AbstractTypeMemberReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/AbstractTypeMemberReprRenderer.java
index 70ec60a..19e6627 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/AbstractTypeMemberReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/AbstractTypeMemberReprRenderer.java
@@ -68,7 +68,9 @@ public abstract class AbstractTypeMemberReprRenderer<R extends ReprRendererAbstr
}
final ObjectMember objectMember = getObjectFeature();
- final LinkBuilder linkBuilder = LinkBuilder.newBuilder(getRendererContext(), Rel.SELF.getName(), getMediaType(), "domainTypes/%s/%s%s", getParentSpecification().getFullIdentifier(), getMemberType().getUrlPart(), objectMember.getId());
+ final LinkBuilder linkBuilder = LinkBuilder.newBuilder(
+ getRendererContext(), Rel.SELF.getName(), getMediaType(),
+ "domain-types/%s/%s%s", getParentSpecification().getSpecId().asString(), getMemberType().getUrlPart(), objectMember.getId());
getLinks().arrayAdd(linkBuilder.build());
}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/ActionDescriptionReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/ActionDescriptionReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/ActionDescriptionReprRenderer.java
index 8227c88..86901ff 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/ActionDescriptionReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/ActionDescriptionReprRenderer.java
@@ -32,9 +32,9 @@ import org.apache.isis.viewer.restfulobjects.rendering.RendererContext;
public class ActionDescriptionReprRenderer extends AbstractTypeMemberReprRenderer<ActionDescriptionReprRenderer, ObjectAction> {
public static LinkBuilder newLinkToBuilder(final RendererContext resourceContext, final Rel rel, final ObjectSpecification objectSpecification, final ObjectAction objectAction) {
- final String typeFullName = objectSpecification.getFullIdentifier();
+ final String domainType = objectSpecification.getSpecId().asString();
final String actionId = objectAction.getId();
- final String url = "domain-types/" + typeFullName + "/actions/" + actionId;
+ final String url = "domain-types/" + domainType + "/actions/" + actionId;
return LinkBuilder.newBuilder(resourceContext, rel.getName(), RepresentationType.ACTION_DESCRIPTION, url);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/ActionParameterDescriptionReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/ActionParameterDescriptionReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/ActionParameterDescriptionReprRenderer.java
index b703b4d..2132b0f 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/ActionParameterDescriptionReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/ActionParameterDescriptionReprRenderer.java
@@ -30,11 +30,11 @@ import org.apache.isis.viewer.restfulobjects.rendering.RendererContext;
public class ActionParameterDescriptionReprRenderer extends AbstractTypeFeatureReprRenderer<ActionParameterDescriptionReprRenderer, ObjectActionParameter> {
public static LinkBuilder newLinkToBuilder(final RendererContext resourceContext, final Rel rel, final ObjectSpecification objectSpecification, final ObjectActionParameter objectActionParameter) {
- final String typeFullName = objectSpecification.getFullIdentifier();
+ final String domainType = objectSpecification.getSpecId().asString();
final ObjectAction objectAction = objectActionParameter.getAction();
final String actionId = objectAction.getId();
final String paramName = objectActionParameter.getName();
- final String url = String.format("domain-types/%s/actions/%s/params/%s", typeFullName, actionId, paramName);
+ final String url = String.format("domain-types/%s/actions/%s/params/%s", domainType, actionId, paramName);
return LinkBuilder.newBuilder(resourceContext, rel.andParam("id", deriveId(objectActionParameter)), RepresentationType.ACTION_PARAMETER_DESCRIPTION, url);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/CollectionDescriptionReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/CollectionDescriptionReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/CollectionDescriptionReprRenderer.java
index 46e4eaf..56ff75e 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/CollectionDescriptionReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/CollectionDescriptionReprRenderer.java
@@ -28,9 +28,9 @@ import org.apache.isis.viewer.restfulobjects.rendering.RendererContext;
public class CollectionDescriptionReprRenderer extends AbstractTypeMemberReprRenderer<CollectionDescriptionReprRenderer, OneToManyAssociation> {
public static LinkBuilder newLinkToBuilder(final RendererContext resourceContext, final Rel rel, final ObjectSpecification objectSpecification, final OneToManyAssociation collection) {
- final String typeFullName = objectSpecification.getFullIdentifier();
+ final String domainType = objectSpecification.getSpecId().asString();
final String collectionId = collection.getId();
- final String url = "domain-types/" + typeFullName + "/collections/" + collectionId;
+ final String url = "domain-types/" + domainType + "/collections/" + collectionId;
return LinkBuilder.newBuilder(resourceContext, rel.getName(), RepresentationType.COLLECTION_DESCRIPTION, url);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/DomainTypeReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/DomainTypeReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/DomainTypeReprRenderer.java
index e36f82b..5d54d61 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/DomainTypeReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/DomainTypeReprRenderer.java
@@ -117,7 +117,7 @@ public class DomainTypeReprRenderer extends ReprRendererAbstract<DomainTypeReprR
}
private JsonRepresentation linkToIsSubtypeOf() {
- final String url = "domainTypes/" + objectSpecification.getFullIdentifier() + "/typeactions/isSubtypeOf/invoke";
+ final String url = "domain-types/" + objectSpecification.getSpecId().asString() + "/type-actions/isSubtypeOf/invoke";
final LinkBuilder linkBuilder = LinkBuilder.newBuilder(getRendererContext(), Rel.INVOKE.andParam("typeaction", "isSubtypeOf"), RepresentationType.TYPE_ACTION_RESULT, url);
final JsonRepresentation arguments = argumentsTo(getRendererContext(), "supertype", null);
@@ -126,7 +126,7 @@ public class DomainTypeReprRenderer extends ReprRendererAbstract<DomainTypeReprR
}
private JsonRepresentation linkToIsSupertypeOf() {
- final String url = "domainTypes/" + objectSpecification.getFullIdentifier() + "/typeactions/isSupertypeOf/invoke";
+ final String url = "domain-types/" + objectSpecification.getSpecId().asString() + "/type-actions/isSupertypeOf/invoke";
final LinkBuilder linkBuilder = LinkBuilder.newBuilder(getRendererContext(), Rel.INVOKE.andParam("typeaction", "isSupertypeOf"), RepresentationType.TYPE_ACTION_RESULT, url);
final JsonRepresentation arguments = argumentsTo(getRendererContext(), "subtype", null);
@@ -139,7 +139,7 @@ public class DomainTypeReprRenderer extends ReprRendererAbstract<DomainTypeReprR
final JsonRepresentation link = JsonRepresentation.newMap();
arguments.mapPut(paramName, link);
if (objectSpec != null) {
- link.mapPut("href", resourceContext.urlFor("domainTypes/" + objectSpec.getFullIdentifier()));
+ link.mapPut("href", resourceContext.urlFor("domain-types/" + objectSpec.getSpecId().asString()));
} else {
link.mapPut("href", NullNode.instance);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/PropertyDescriptionReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/PropertyDescriptionReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/PropertyDescriptionReprRenderer.java
index da6494b..8d9db0a 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/PropertyDescriptionReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/PropertyDescriptionReprRenderer.java
@@ -29,9 +29,9 @@ import org.apache.isis.viewer.restfulobjects.rendering.RendererContext;
public class PropertyDescriptionReprRenderer extends AbstractTypeMemberReprRenderer<PropertyDescriptionReprRenderer, OneToOneAssociation> {
public static LinkBuilder newLinkToBuilder(final RendererContext resourceContext, final Rel rel, final ObjectSpecification objectSpecification, final OneToOneAssociation property) {
- final String typeFullName = objectSpecification.getFullIdentifier();
+ final String domainType = objectSpecification.getSpecId().asString();
final String propertyId = property.getId();
- final String url = "domain-types/" + typeFullName + "/properties/" + propertyId;
+ final String url = "domain-types/" + domainType + "/properties/" + propertyId;
return LinkBuilder.newBuilder(resourceContext, rel.getName(), RepresentationType.PROPERTY_DESCRIPTION, url);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/TypeListReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/TypeListReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/TypeListReprRenderer.java
index 974be69..cd7c70c 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/TypeListReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domaintypes/TypeListReprRenderer.java
@@ -48,12 +48,12 @@ public class TypeListReprRenderer extends ReprRendererAbstract<TypeListReprRende
// self
if (includesSelf) {
- withLink(Rel.SELF, "domainTypes");
+ withLink(Rel.SELF, "domain-types");
}
final JsonRepresentation specList = JsonRepresentation.newArray();
for (final ObjectSpecification objectSpec : specifications) {
- final LinkBuilder linkBuilder = LinkBuilder.newBuilder(getRendererContext(), Rel.DOMAIN_TYPE.getName(), RepresentationType.DOMAIN_TYPE, "domainTypes/%s", objectSpec.getFullIdentifier());
+ final LinkBuilder linkBuilder = LinkBuilder.newBuilder(getRendererContext(), Rel.DOMAIN_TYPE.getName(), RepresentationType.DOMAIN_TYPE, "domain-types/%s", objectSpec.getSpecId().asString());
specList.arrayAdd(linkBuilder.build());
}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainTypeResourceServerside.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainTypeResourceServerside.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainTypeResourceServerside.java
index 0c8824b..839b84f 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainTypeResourceServerside.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainTypeResourceServerside.java
@@ -29,6 +29,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.core.metamodel.spec.ObjectSpecId;
import org.apache.isis.core.metamodel.spec.ObjectSpecification;
import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
@@ -90,7 +91,7 @@ public class DomainTypeResourceServerside extends ResourceAbstract implements Do
init(RepresentationType.DOMAIN_TYPE, Where.ANYWHERE);
- final ObjectSpecification objectSpec = getSpecificationLoader().loadSpecification(domainType);
+ final ObjectSpecification objectSpec = getSpecificationLoader().lookupBySpecId(ObjectSpecId.of(domainType));
final DomainTypeReprRenderer renderer = new DomainTypeReprRenderer(getResourceContext(), null, JsonRepresentation.newMap());
renderer.with(objectSpec).includesSelf();
@@ -106,7 +107,7 @@ public class DomainTypeResourceServerside extends ResourceAbstract implements Do
final RepresentationType representationType = RepresentationType.PROPERTY_DESCRIPTION;
init(representationType, Where.ANYWHERE);
- final ObjectSpecification parentSpec = getSpecificationLoader().loadSpecification(domainType);
+ final ObjectSpecification parentSpec = getSpecificationLoader().lookupBySpecId(ObjectSpecId.of(domainType));
if (parentSpec == null) {
throw RestfulObjectsApplicationException.create(HttpStatusCode.NOT_FOUND);
}
@@ -131,7 +132,7 @@ public class DomainTypeResourceServerside extends ResourceAbstract implements Do
final RepresentationType representationType = RepresentationType.COLLECTION_DESCRIPTION;
init(representationType, Where.ANYWHERE);
- final ObjectSpecification parentSpec = getSpecificationLoader().loadSpecification(domainType);
+ final ObjectSpecification parentSpec = getSpecificationLoader().lookupBySpecId(ObjectSpecId.of(domainType));
if (parentSpec == null) {
throw RestfulObjectsApplicationException.create(HttpStatusCode.NOT_FOUND);
}
@@ -156,7 +157,7 @@ public class DomainTypeResourceServerside extends ResourceAbstract implements Do
final RepresentationType representationType = RepresentationType.ACTION_DESCRIPTION;
init(representationType, Where.ANYWHERE);
- final ObjectSpecification parentSpec = getSpecificationLoader().loadSpecification(domainType);
+ final ObjectSpecification parentSpec = getSpecificationLoader().lookupBySpecId(ObjectSpecId.of(domainType));
if (parentSpec == null) {
throw RestfulObjectsApplicationException.create(HttpStatusCode.NOT_FOUND);
}
@@ -181,7 +182,7 @@ public class DomainTypeResourceServerside extends ResourceAbstract implements Do
final RepresentationType representationType = RepresentationType.ACTION_PARAMETER_DESCRIPTION;
init(representationType, Where.ANYWHERE);
- final ObjectSpecification parentSpec = getSpecificationLoader().loadSpecification(domainType);
+ final ObjectSpecification parentSpec = getSpecificationLoader().lookupBySpecId(ObjectSpecId.of(domainType));
if (parentSpec == null) {
throw RestfulObjectsApplicationException.create(HttpStatusCode.NOT_FOUND);
}
@@ -217,12 +218,12 @@ public class DomainTypeResourceServerside extends ResourceAbstract implements Do
final String supertype = domainTypeFor(superTypeStr, args, "supertype");
- final ObjectSpecification domainTypeSpec = getSpecificationLoader().loadSpecification(domainType);
- final ObjectSpecification supertypeSpec = getSpecificationLoader().loadSpecification(supertype);
+ final ObjectSpecification domainTypeSpec = getSpecificationLoader().lookupBySpecId(ObjectSpecId.of(domainType));
+ final ObjectSpecification supertypeSpec = getSpecificationLoader().lookupBySpecId(ObjectSpecId.of(supertype));
final TypeActionResultReprRenderer renderer = new TypeActionResultReprRenderer(getResourceContext(), null, JsonRepresentation.newMap());
- final String url = "domainTypes/" + domainTypeSpec.getFullIdentifier() + "/typeactions/isSubtypeOf/invoke";
+ final String url = "domain-types/" + domainType + "/type-actions/isSubtypeOf/invoke";
final LinkBuilder linkBuilder = LinkBuilder.newBuilder(getResourceContext(), Rel.SELF.getName(), RepresentationType.TYPE_ACTION_RESULT, url);
final JsonRepresentation arguments = DomainTypeReprRenderer.argumentsTo(getResourceContext(), "supertype", supertypeSpec);
final JsonRepresentation selfLink = linkBuilder.withArguments(arguments).build();
@@ -248,12 +249,12 @@ public class DomainTypeResourceServerside extends ResourceAbstract implements Do
final String subtype = domainTypeFor(subTypeStr, args, "subtype");
- final ObjectSpecification domainTypeSpec = getSpecificationLoader().loadSpecification(domainType);
- final ObjectSpecification subtypeSpec = getSpecificationLoader().loadSpecification(subtype);
+ final ObjectSpecification domainTypeSpec = getSpecificationLoader().lookupBySpecId(ObjectSpecId.of(domainType));
+ final ObjectSpecification subtypeSpec = getSpecificationLoader().lookupBySpecId(ObjectSpecId.of(subtype));
final TypeActionResultReprRenderer renderer = new TypeActionResultReprRenderer(getResourceContext(), null, JsonRepresentation.newMap());
- final String url = "domainTypes/" + domainTypeSpec.getFullIdentifier() + "/typeactions/isSupertypeOf/invoke";
+ final String url = "domain-types/" + domainType + "/type-actions/isSupertypeOf/invoke";
final LinkBuilder linkBuilder = LinkBuilder.newBuilder(getResourceContext(), Rel.SELF.getName(), RepresentationType.TYPE_ACTION_RESULT, url);
final JsonRepresentation arguments = DomainTypeReprRenderer.argumentsTo(getResourceContext(), "subtype", subtypeSpec);
final JsonRepresentation selfLink = linkBuilder.withArguments(arguments).build();
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/HomePageReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/HomePageReprRenderer.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/HomePageReprRenderer.java
index c003792..7e0deb4 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/HomePageReprRenderer.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/HomePageReprRenderer.java
@@ -120,12 +120,12 @@ public class HomePageReprRenderer extends ReprRendererAbstract<HomePageReprRende
private void addLinkToDomainTypes(final Collection<ObjectSpecification> specifications) {
- final JsonRepresentation link = LinkBuilder.newBuilder(getRendererContext(), Rel.DOMAIN_TYPES.getName(), RepresentationType.TYPE_LIST, "domainTypes").build();
+ final JsonRepresentation link = LinkBuilder.newBuilder(getRendererContext(), Rel.DOMAIN_TYPES.getName(), RepresentationType.TYPE_LIST, "domain-types").build();
final LinkFollowSpecs linkFollower = getLinkFollowSpecs().follow("links");
if (linkFollower.matches(link)) {
final TypeListReprRenderer renderer = new TypeListReprRenderer(getRendererContext(), linkFollower, JsonRepresentation.newMap());
- renderer.withLink(Rel.SELF, "domainTypes").with(specifications);
+ renderer.withLink(Rel.SELF, "domain-types").with(specifications);
link.mapPut("value", renderer.render());
}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/any/AnyResourceTest_serverSideException_exceptionHandling.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/any/AnyResourceTest_serverSideException_exceptionHandling.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/any/AnyResourceTest_serverSideException_exceptionHandling.java
deleted file mode 100644
index f71fc48..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/any/AnyResourceTest_serverSideException_exceptionHandling.java
+++ /dev/null
@@ -1,65 +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.any;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import org.apache.isis.core.webserver.WebServer;
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.Header;
-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.util.Parser;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class AnyResourceTest_serverSideException_exceptionHandling {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- @Before
- public void setUp() throws Exception {
- final WebServer webServer = webServerRule.getWebServer();
- client = new RestfulClient(webServer.getBase());
- }
-
- @Test
- public void runtimeException_isMapped() throws Exception {
-
- // given
- final RestfulRequest restfulReq = client.createRequest(RestfulHttpMethod.GET, "version");
- final Header<Boolean> header = new Header<Boolean>("X-FAIL", Parser.forBoolean());
- restfulReq.withHeader(header, true);
-
- // when
- final RestfulResponse<JsonRepresentation> jsonResp = restfulReq.execute();
-
- // then
- assertThat(jsonResp.getStatus(), is(HttpStatusCode.METHOD_FAILURE));
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/any/errorhandling/AnyResourceTest_serverSideException.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/any/errorhandling/AnyResourceTest_serverSideException.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/any/errorhandling/AnyResourceTest_serverSideException.java
new file mode 100644
index 0000000..5b04f4f
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/any/errorhandling/AnyResourceTest_serverSideException.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.any.errorhandling;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.Header;
+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.util.Parser;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class AnyResourceTest_serverSideException {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+ }
+
+ @Test
+ public void runtimeException_isMapped() throws Exception {
+
+ // given
+ final RestfulRequest restfulReq = client.createRequest(RestfulHttpMethod.GET, "version");
+ final Header<Boolean> header = new Header<Boolean>("X-FAIL", Parser.forBoolean());
+ restfulReq.withHeader(header, true);
+
+ // when
+ final RestfulResponse<JsonRepresentation> jsonResp = restfulReq.execute();
+
+ // then
+ assertThat(jsonResp.getStatus(), is(HttpStatusCode.METHOD_FAILURE));
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_header_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_header_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_header_accept.java
deleted file mode 100644
index 52ea9cd..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_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.domainservice;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.MediaType;
-
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.jboss.resteasy.client.ClientRequest;
-import org.jboss.resteasy.client.ClientResponse;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class DomainServiceResourceTest_serviceId_request_header_accept {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
- private RestfulRequest request;
-
- private String href;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
- href = Util.givenLinkToService(client, "JdkValuedEntities");
- request = client.createRequest(RestfulHttpMethod.GET, href);
- }
-
- @Test
- public void applicationJson_noProfile_returns200() throws Exception {
-
- request.withHeader(RestfulRequest.Header.ACCEPT, MediaType.APPLICATION_JSON_TYPE);
- final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- }
-
- @Test
- public void applicationJson_profileDomainObject_returns200() throws Exception {
-
- request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.DOMAIN_OBJECT.getMediaType());
- final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- }
-
- @Test
- public void missingHeader_returns200() throws Exception {
-
- final RestfulResponse<DomainObjectRepresentation> restfulResp = request.executeT();
-
- assertThat(restfulResp.getStatus(), is(HttpStatusCode.OK));
- }
-
- @Test
- public void applicationJson_profileIncorrect_returns406() throws Exception {
-
- request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.VERSION.getMediaType());
- final RestfulResponse<ListRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
- }
-
- @Test
- public void incorrectMediaType_returnsNotAcceptable() throws Exception {
-
- // given
- final ClientRequest clientRequest = client.getClientRequestFactory().createRequest(href);
- clientRequest.accept(MediaType.APPLICATION_ATOM_XML_TYPE);
-
- // when
- final ClientResponse<?> resp = clientRequest.get();
- final RestfulResponse<JsonRepresentation> restfulResp = RestfulResponse.of(resp);
-
- // then
- assertThat(restfulResp.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrodomainmodel.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrodomainmodel.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrodomainmodel.java
deleted file mode 100644
index 02827df..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrodomainmodel.java
+++ /dev/null
@@ -1,75 +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;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.MediaType;
-
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.RequestParameter;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class DomainServiceResourceTest_serviceId_request_queryarg_xrodomainmodel {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
- private RestfulRequest request;
-
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
- String href = Util.givenLinkToService(client, "JdkValuedEntities");
- request = client.createRequest(RestfulHttpMethod.GET, href);
- }
-
- @Test
- public void simple_rejected() throws Exception {
-
- request.withArg(RequestParameter.DOMAIN_MODEL, "simple");
- final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.BAD_REQUEST));
- assertThat(restfulResponse.getHeader(RestfulResponse.Header.WARNING), is("x-ro-domain-model of 'simple' is not supported"));
- }
-
- @Test
- public void formal_accepted() throws Exception {
-
- request.withArg(RequestParameter.DOMAIN_MODEL, "formal");
- final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrofollowlinks.java
deleted file mode 100644
index d53619c..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrofollowlinks.java
+++ /dev/null
@@ -1,119 +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;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.Response;
-
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.webserver.WebServer;
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.RequestParameter;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-
-public class DomainServiceResourceTest_serviceId_request_queryarg_xrofollowlinks {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- @Before
- public void setUp() throws Exception {
- final WebServer webServer = webServerRule.getWebServer();
- client = new RestfulClient(webServer.getBase());
- }
-
- @Ignore("todo... the service Id is wrong")
- @Test
- public void withCriteria() throws Exception {
-
- final String href = givenHrefToService("simples");
-
- final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, href).withArg(RequestParameter.FOLLOW_LINKS, "members[id=%s].links[rel=details]", "list");
- final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- final DomainObjectRepresentation repr = restfulResponse.getEntity();
-
- final JsonRepresentation membersList = repr.getMembers();
- assertThat(membersList, isArray());
-
- JsonRepresentation actionRepr;
-
- actionRepr = membersList.getRepresentation("[id=%s]", "list");
- assertThat(actionRepr.getRepresentation("links[rel=details]"), is(not(nullValue())));
- assertThat(actionRepr.getRepresentation("links[rel=details].value"), is(not(nullValue()))); // followed
-
- actionRepr = membersList.getRepresentation("[id=%s]", "newTransientEntity");
- assertThat(actionRepr.getRepresentation("links[rel=details]"), is(not(nullValue())));
- assertThat(actionRepr.getRepresentation("links[rel=details].value"), is(nullValue())); // not
- // followed
- }
-
- @Ignore("todo")
- @Test
- public void toSelf() throws Exception {
-
- }
-
- @Ignore("todo")
- @Test
- public void toDescribedBy() throws Exception {
-
- }
-
- @Ignore("todo")
- @Test
- public void toMembers() throws Exception {
-
- // no need to do an individual member, that's been tested already elsewhere
- }
-
-
- private String givenHrefToService(final String serviceId) throws JsonParseException, JsonMappingException, IOException {
- final DomainServiceResource resource = client.getDomainServiceResource();
- final Response response = resource.services();
- final ListRepresentation services = RestfulResponse.<ListRepresentation> ofT(response).getEntity();
-
- return services.getRepresentation("values[id=%s]", serviceId).asLink().getHref();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_headers.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_headers.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_headers.java
deleted file mode 100644
index 1a943fd..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_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;
-
-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 DomainServiceResourceTest_serviceId_response_headers {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
- private DomainServiceResource resource;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
-
- resource = client.getDomainServiceResource();
- }
-
- @Test
- public void headers() throws Exception {
- // given
- final Response resp = resource.service("JdkValuedEntities");
-
- // when
- final RestfulResponse<DomainObjectRepresentation> jsonResp = RestfulResponse.ofT(resp);
-
-
- // then
- assertThat(jsonResp.getStatus(), is(HttpStatusCode.OK));
- assertThat(jsonResp.getHeader(RestfulResponse.Header.CONTENT_TYPE), is(RepresentationType.DOMAIN_OBJECT.getMediaType("x-ro-domain-type", "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/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_representation.java
deleted file mode 100644
index 2b77339..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_representation.java
+++ /dev/null
@@ -1,163 +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;
-
-import static org.apache.isis.core.commons.matchers.IsisMatchers.matches;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
-import static org.hamcrest.CoreMatchers.*;
-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.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.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class DomainServiceResourceTest_serviceId_response_representation {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
- private DomainServiceResource resource;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
-
- resource = client.getDomainServiceResource();
- }
-
- @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(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"));
- }
-
- @Ignore("todo - factored out since failing")
- @Test
- public void link_describedBy() throws Exception {
-
- // given
- final Response resp = resource.service("JdkValuedEntities");
-
- // when
- final RestfulResponse<DomainObjectRepresentation> jsonResp = RestfulResponse.ofT(resp);
- final DomainObjectRepresentation repr = jsonResp.getEntity();
-
- // then
- LinkRepresentation describedByLink = repr.getLinkWithRel(Rel.DESCRIBEDBY);
- assertThat(describedByLink, isLink(client)
- .returning(HttpStatusCode.OK)
- .responseEntityWithSelfHref(describedByLink.getHref()));
-
- }
-
- @Ignore("todo")
- @Test
- public void disabledAction() throws Exception {
-
-
- // has a disabledRead
-
- }
-
- @Ignore("todo")
- @Test
- public void nonExistentAction() throws Exception {
-
-
- // eg...
- // DomainObjectMemberRepresentation listMemberRepr = repr.getAction("foobar");
-
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_status_notFound.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_status_notFound.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_status_notFound.java
deleted file mode 100644
index aa39d8f..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_status_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;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.Response;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.webserver.WebServer;
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.Rel;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-
-public class DomainServiceResourceTest_serviceId_status_notFound {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
- private DomainServiceResource resource;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
-
- resource = client.getDomainServiceResource();
- }
-
- @Test
- public void notFound_usingTemplatedMethod() throws Exception {
-
- // when
- final Response resp = resource.service("nonExistentServiceId");
- final RestfulResponse<JsonRepresentation> jsonResp = RestfulResponse.of(resp);
-
- // then
- assertThat(jsonResp.getStatus(), is(HttpStatusCode.NOT_FOUND));
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_header_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_header_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_header_accept.java
deleted file mode 100644
index a11478d..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_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;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.MediaType;
-
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.jboss.resteasy.client.ClientRequest;
-import org.jboss.resteasy.client.ClientResponse;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class DomainServiceResourceTest_services_header_accept {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
- private RestfulRequest request;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
- request = client.createRequest(RestfulHttpMethod.GET, "services");
- }
-
- @Test
- public void applicationJson_noProfile_returns200() throws Exception {
-
- request.withHeader(RestfulRequest.Header.ACCEPT, MediaType.APPLICATION_JSON_TYPE);
- final RestfulResponse<ListRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- assertThat(restfulResponse.getHeader(RestfulResponse.Header.CONTENT_TYPE), is(RepresentationType.LIST.getMediaType()));
- }
-
- @Test
- public void applicationJson_profileList_returns200() throws Exception {
-
- request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.LIST.getMediaType());
- final RestfulResponse<ListRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- }
-
- @Test
- public void missingHeader_returns200() throws Exception {
-
- final RestfulResponse<ListRepresentation> restfulResp = request.executeT();
-
- assertThat(restfulResp.getStatus(), is(HttpStatusCode.OK));
- }
-
- @Test
- public void applicationJson_profileIncorrect_returns406() throws Exception {
-
- request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.VERSION.getMediaType());
- final RestfulResponse<ListRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
- }
-
- @Test
- public void incorrectMediaType_returnsNotAcceptable() throws Exception {
-
- // given
- final ClientRequest clientRequest = client.getClientRequestFactory().createRelativeRequest("services");
- clientRequest.accept(MediaType.APPLICATION_ATOM_XML_TYPE);
-
- // when
- final ClientResponse<?> resp = clientRequest.get();
- final RestfulResponse<JsonRepresentation> restfulResp = RestfulResponse.of(resp);
-
- // then
- assertThat(restfulResp.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_queryarg_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_queryarg_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_queryarg_xrofollowlinks.java
deleted file mode 100644
index 5414ee9..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_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;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
-import static org.hamcrest.CoreMatchers.*;
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.hamcrest.Matchers.greaterThan;
-import static org.junit.Assert.assertThat;
-
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.Rel;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.RequestParameter;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.user.UserRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.hamcrest.Matchers;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class DomainServiceResourceTest_services_queryarg_xrofollowlinks {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- private RestfulRequest request;
- private RestfulResponse<ListRepresentation> restfulResponse;
- private ListRepresentation repr;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
-
- }
-
- @Test
- public void noFollow() throws Exception {
-
- request = client.createRequest(RestfulHttpMethod.GET, "services");
- restfulResponse = request.executeT();
- repr = restfulResponse.getEntity();
-
- assertThat(repr.getSelf().getValue(), is(nullValue()));
- assertThat(repr.getUp().getValue(), is(nullValue()));
- }
-
- @Test
- public void self() throws Exception {
-
- request = client.createRequest(RestfulHttpMethod.GET, "services")
- .withArg(RequestParameter.FOLLOW_LINKS, "links[rel=" + Rel.SELF.getName() + "]");
- restfulResponse = request.executeT();
- repr = restfulResponse.getEntity();
-
- assertThat(repr.getSelf().getValue(), is(not(nullValue())));
- }
-
- @Test
- public void up() throws Exception {
-
- request = client.createRequest(RestfulHttpMethod.GET, "services")
- .withArg(RequestParameter.FOLLOW_LINKS, "links[rel=" + Rel.UP.getName() + "]");
- restfulResponse = request.executeT();
- repr = restfulResponse.getEntity();
-
- assertThat(repr.getUp().getValue(), is(not(nullValue())));
- }
-
- @Test
- public void value_noQualifications_andSoAllOfThemEagerlyReturned() throws Exception {
-
- request = client.createRequest(RestfulHttpMethod.GET, "services")
- .withArg(RequestParameter.FOLLOW_LINKS, "value[rel=" + Rel.SERVICE.getName() + "]");
- restfulResponse = request.executeT();
- repr = restfulResponse.getEntity();
-
- request = client.createRequest(RestfulHttpMethod.GET, "services")
- .withArg(RequestParameter.FOLLOW_LINKS, "value");
- restfulResponse = request.executeT();
- repr = restfulResponse.getEntity();
-
- // then
- for (final LinkRepresentation link : repr.getValue().arrayIterable(LinkRepresentation.class)) {
-
- assertThat(link, isLink(client)
- .rel(containsString(Rel.SERVICE.getName()))
- .href(containsString(":39393/"))
- .httpMethod(RestfulHttpMethod.GET)
- .type(RepresentationType.DOMAIN_OBJECT.getMediaType())
- .value(is(not(nullValue(JsonRepresentation.class))))
- );
- }
-
- }
-
- @Test
- public void value_withQualification_andSoSingleServiceEagerlyReturned() throws Exception {
-
- request = client.createRequest(RestfulHttpMethod.GET, "services")
- .withArg(RequestParameter.FOLLOW_LINKS, "value[rel=" + Rel.SERVICE.getName() + ";serviceId=\"JdkValuedEntities\"]");
- restfulResponse = request.executeT();
- repr = restfulResponse.getEntity();
-
- // then
- int numWithValue = 0;
- int numWithoutValue = 0;
- for (final LinkRepresentation link : repr.getValue().arrayIterable(LinkRepresentation.class)) {
-
- if(isLink(client).value(is(not(nullValue(JsonRepresentation.class)))).build().matches(link)) {
- numWithValue++;
- } else {
- numWithoutValue++;
- }
- }
-
- assertThat(numWithValue, is(1));
- assertThat(numWithoutValue, is(greaterThan(0)));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_response_headers.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_response_headers.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_response_headers.java
deleted file mode 100644
index 62c06c7..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_response_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;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.CacheControl;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.apache.isis.core.webserver.WebServer;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.Header;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class DomainServiceResourceTest_services_response_headers {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
- private DomainServiceResource resource;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
- resource = client.getDomainServiceResource();
- }
-
-
- @Test
- public void contentType_and_cacheControl() throws Exception {
- // given
- final Response resp = resource.services();
-
- // when
- final RestfulResponse<ListRepresentation> restfulResponse = RestfulResponse.ofT(resp);
-
- // then
- final MediaType contentType = restfulResponse.getHeader(Header.CONTENT_TYPE);
- assertThat(contentType, hasType("application"));
- assertThat(contentType, hasSubType("json"));
- assertThat(contentType, hasParameter("profile", "urn:org.restfulobjects:repr-types/list"));
- assertThat(contentType, is(RepresentationType.LIST.getMediaType()));
-
- // then
- final CacheControl cacheControl = restfulResponse.getHeader(Header.CACHE_CONTROL);
- assertThat(cacheControl, hasMaxAge(24 * 60 * 60));
- assertThat(cacheControl.getMaxAge(), is(24 * 60 * 60));
- }
-
-}
[41/50] [abbrv] ISIS-233: more stub test cases.
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenDoesntExistColl_thenResponseCode_404_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenDoesntExistColl_thenResponseCode_404_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenDoesntExistColl_thenResponseCode_404_TODO.java
new file mode 100644
index 0000000..9039fae
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenDoesntExistColl_thenResponseCode_404_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Get_whenDoesntExistColl_thenResponseCode_404_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenDoesntExistOid_thenResponseCode_404_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenDoesntExistOid_thenResponseCode_404_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenDoesntExistOid_thenResponseCode_404_TODO.java
new file mode 100644
index 0000000..90f042f
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenDoesntExistOid_thenResponseCode_404_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Get_whenDoesntExistOid_thenResponseCode_404_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/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
deleted file mode 100644
index bd4ace9..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenHrefArg_bad_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-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/cf0bc337/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
deleted file mode 100644
index 9c8ff26..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenHrefArg_thenResponseCode_205_bad_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenQueryArg_xRoDomainModel_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenQueryArg_xRoDomainModel_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenQueryArg_xRoDomainModel_ok_TODO.java
new file mode 100644
index 0000000..ae0f368
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_whenQueryArg_xRoDomainModel_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Get_whenQueryArg_xRoDomainModel_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenDisabled_thenResponseCode_203_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenDisabled_thenResponseCode_203_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenDisabled_thenResponseCode_203_TODO.java
new file mode 100644
index 0000000..30688f5
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenDisabled_thenResponseCode_203_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Post_givenDisabled_thenResponseCode_203_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenEntityInCollection_whenArgIsHrefAndLinksToEntity_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenEntityInCollection_whenArgIsHrefAndLinksToEntity_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenEntityInCollection_whenArgIsHrefAndLinksToEntity_ok_TODO.java
new file mode 100644
index 0000000..bd458d2
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenEntityInCollection_whenArgIsHrefAndLinksToEntity_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Post_givenEntityInCollection_whenArgIsHrefAndLinksToEntity_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/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
deleted file mode 100644
index 98062f7..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenEntityInCollection_whenHrefArgLinksToEntity_ok_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java
new file mode 100644
index 0000000..32adc32
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Post_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java
new file mode 100644
index 0000000..e04e0a0
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Post_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenHidden_thenResponseCode_404_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenHidden_thenResponseCode_404_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenHidden_thenResponseCode_404_TODO.java
new file mode 100644
index 0000000..fe6343b
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_givenHidden_thenResponseCode_404_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Post_givenHidden_thenResponseCode_404_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseCode_200_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseCode_200_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseCode_200_ok_TODO.java
new file mode 100644
index 0000000..c784a59
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseCode_200_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Post_thenResponseCode_200_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_CacheControl_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_CacheControl_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_CacheControl_ok_TODO.java
new file mode 100644
index 0000000..2c48ef1
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_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 Post_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_ContentLength_ok_TODO.java
new file mode 100644
index 0000000..88be4bb
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_ContentLength_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 Post_thenResponseHeaders_ContentLength_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_ContentType_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_ContentType_ok_TODO.java
new file mode 100644
index 0000000..6593f4e
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_ContentType_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 Post_thenResponseHeaders_ContentType_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_eTag_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_eTag_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_eTag_ok_TODO.java
new file mode 100644
index 0000000..272ccc5
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_eTag_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Post_thenResponseHeaders_eTag_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgIsHrefAndLinksToEntityOfWrongType_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgIsHrefAndLinksToEntityOfWrongType_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgIsHrefAndLinksToEntityOfWrongType_bad_TODO.java
new file mode 100644
index 0000000..45e1aa4
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgIsHrefAndLinksToEntityOfWrongType_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Post_whenArgIsHrefAndLinksToEntityOfWrongType_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgIsHrefAndLinksToNonExistentEntity_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgIsHrefAndLinksToNonExistentEntity_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgIsHrefAndLinksToNonExistentEntity_bad_TODO.java
new file mode 100644
index 0000000..55a697a
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgIsHrefAndLinksToNonExistentEntity_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Post_whenArgIsHrefAndLinksToNonExistentEntity_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgIsMalformed_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgIsMalformed_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgIsMalformed_bad_TODO.java
new file mode 100644
index 0000000..7970adc
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgIsMalformed_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Post_whenArgIsMalformed_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgMandatoryButMissing_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgMandatoryButMissing_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgMandatoryButMissing_bad_TODO.java
new file mode 100644
index 0000000..1a1d527
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgMandatoryButMissing_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Post_whenArgMandatoryButMissing_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgValid_thenEntityAddedToCollection_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgValid_thenEntityAddedToCollection_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgValid_thenEntityAddedToCollection_ok_TODO.java
new file mode 100644
index 0000000..aa9e332
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgValid_thenEntityAddedToCollection_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Post_whenArgValid_thenEntityAddedToCollection_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgValueIsInvalid_andQueryArg_XRoValidateOnly_4xx_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgValueIsInvalid_andQueryArg_XRoValidateOnly_4xx_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgValueIsInvalid_andQueryArg_XRoValidateOnly_4xx_TODO.java
new file mode 100644
index 0000000..d3ee930
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgValueIsInvalid_andQueryArg_XRoValidateOnly_4xx_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Post_whenArgValueIsInvalid_andQueryArg_XRoValidateOnly_4xx_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgValueIsInvalid_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgValueIsInvalid_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgValueIsInvalid_bad_TODO.java
new file mode 100644
index 0000000..4c3d75a
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgValueIsInvalid_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Post_whenArgValueIsInvalid_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgValueIsValid_andQueryArg_XRoValidateOnly_2xx_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgValueIsValid_andQueryArg_XRoValidateOnly_2xx_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgValueIsValid_andQueryArg_XRoValidateOnly_2xx_TODO.java
new file mode 100644
index 0000000..4198c94
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenArgValueIsValid_andQueryArg_XRoValidateOnly_2xx_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Post_whenArgValueIsValid_andQueryArg_XRoValidateOnly_2xx_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenDoesntExistColl_thenResponseCode_404_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenDoesntExistColl_thenResponseCode_404_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenDoesntExistColl_thenResponseCode_404_TODO.java
new file mode 100644
index 0000000..0ef12cd
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenDoesntExistColl_thenResponseCode_404_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Post_whenDoesntExistColl_thenResponseCode_404_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenDoesntExistOid_thenResponseCode_404_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenDoesntExistOid_thenResponseCode_404_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenDoesntExistOid_thenResponseCode_404_TODO.java
new file mode 100644
index 0000000..6745b49
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenDoesntExistOid_thenResponseCode_404_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Post_whenDoesntExistOid_thenResponseCode_404_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/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
deleted file mode 100644
index bfc1ab8..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenInvalidArg_bad_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-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/cf0bc337/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
deleted file mode 100644
index e8d8887..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_whenNoArg_bad_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-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/cf0bc337/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
deleted file mode 100644
index da9ab97..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/PutOrPost_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-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/cf0bc337/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
deleted file mode 100644
index 0d6177a..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/PutOrPost_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-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/cf0bc337/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
deleted file mode 100644
index e9da0b9..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/PutOrPost_whenHrefArgLinkToNonExistentEntity_bad_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-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/cf0bc337/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
deleted file mode 100644
index 904bf48..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/PutOrPost_whenHrefArgValid_ok_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenDisabled_thenResponseCode_203_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenDisabled_thenResponseCode_203_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenDisabled_thenResponseCode_203_TODO.java
new file mode 100644
index 0000000..918a098
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenDisabled_thenResponseCode_203_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Put_givenDisabled_thenResponseCode_203_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenEntityAlreadyInCollection_whenArgsValid_thenNoChange_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenEntityAlreadyInCollection_whenArgsValid_thenNoChange_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenEntityAlreadyInCollection_whenArgsValid_thenNoChange_ok_TODO.java
new file mode 100644
index 0000000..7513cc8
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenEntityAlreadyInCollection_whenArgsValid_thenNoChange_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Put_givenEntityAlreadyInCollection_whenArgsValid_thenNoChange_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/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
deleted file mode 100644
index cc3b11e..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenEntityAlreadyInCollection_whenHrefArgLinksToEntity_bad_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenEntityNotInCollection_whenArgsValid_thenEntityAddedFromCollection_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenEntityNotInCollection_whenArgsValid_thenEntityAddedFromCollection_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenEntityNotInCollection_whenArgsValid_thenEntityAddedFromCollection_ok_TODO.java
new file mode 100644
index 0000000..e0cb100
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenEntityNotInCollection_whenArgsValid_thenEntityAddedFromCollection_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Put_givenEntityNotInCollection_whenArgsValid_thenEntityAddedFromCollection_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java
new file mode 100644
index 0000000..822d3be
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Put_givenEtag_whenIfMatchHeaderDoesMatch_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java
new file mode 100644
index 0000000..d707602
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Put_givenEtag_whenIfMatchHeaderDoesNotMatch_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenHidden_thenResponseCode_404_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenHidden_thenResponseCode_404_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenHidden_thenResponseCode_404_TODO.java
new file mode 100644
index 0000000..885bb14
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_givenHidden_thenResponseCode_404_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Put_givenHidden_thenResponseCode_404_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseCode_200_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseCode_200_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseCode_200_ok_TODO.java
new file mode 100644
index 0000000..35dd9cb
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseCode_200_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Put_thenResponseCode_200_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_CacheControl_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_CacheControl_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_CacheControl_ok_TODO.java
new file mode 100644
index 0000000..c560adf
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_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 Put_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_ContentLength_ok_TODO.java
new file mode 100644
index 0000000..5905a2c
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_ContentLength_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 Put_thenResponseHeaders_ContentLength_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_ContentType_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_ContentType_ok_TODO.java
new file mode 100644
index 0000000..8b1edee
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_ContentType_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 Put_thenResponseHeaders_ContentType_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_eTag_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_eTag_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_eTag_ok_TODO.java
new file mode 100644
index 0000000..12a8eba
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_eTag_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Put_thenResponseHeaders_eTag_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgIsHrefAndLinksToEntityOfWrongType_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgIsHrefAndLinksToEntityOfWrongType_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgIsHrefAndLinksToEntityOfWrongType_bad_TODO.java
new file mode 100644
index 0000000..360be37
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgIsHrefAndLinksToEntityOfWrongType_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Put_whenArgIsHrefAndLinksToEntityOfWrongType_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgIsHrefAndLinksToNonExistentEntity_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgIsHrefAndLinksToNonExistentEntity_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgIsHrefAndLinksToNonExistentEntity_bad_TODO.java
new file mode 100644
index 0000000..d03a135
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgIsHrefAndLinksToNonExistentEntity_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Put_whenArgIsHrefAndLinksToNonExistentEntity_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgIsMalformed_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgIsMalformed_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgIsMalformed_bad_TODO.java
new file mode 100644
index 0000000..62a4f2f
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgIsMalformed_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Put_whenArgIsMalformed_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgMandatoryButMissing_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgMandatoryButMissing_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgMandatoryButMissing_bad_TODO.java
new file mode 100644
index 0000000..229cc9b
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgMandatoryButMissing_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Put_whenArgMandatoryButMissing_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgValid_thenEntityAddedToCollection_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgValid_thenEntityAddedToCollection_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgValid_thenEntityAddedToCollection_ok_TODO.java
new file mode 100644
index 0000000..6b12319
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgValid_thenEntityAddedToCollection_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Put_whenArgValid_thenEntityAddedToCollection_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgValueIsInvalid_andQueryArg_XRoValidateOnly_4xx_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgValueIsInvalid_andQueryArg_XRoValidateOnly_4xx_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgValueIsInvalid_andQueryArg_XRoValidateOnly_4xx_TODO.java
new file mode 100644
index 0000000..50e5870
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgValueIsInvalid_andQueryArg_XRoValidateOnly_4xx_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Put_whenArgValueIsInvalid_andQueryArg_XRoValidateOnly_4xx_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgValueIsInvalid_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgValueIsInvalid_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgValueIsInvalid_bad_TODO.java
new file mode 100644
index 0000000..eb34234
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgValueIsInvalid_bad_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Put_whenArgValueIsInvalid_bad_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgValueIsValid_andQueryArg_XRoValidateOnly_2xx_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgValueIsValid_andQueryArg_XRoValidateOnly_2xx_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgValueIsValid_andQueryArg_XRoValidateOnly_2xx_TODO.java
new file mode 100644
index 0000000..e7c6c89
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenArgValueIsValid_andQueryArg_XRoValidateOnly_2xx_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Put_whenArgValueIsValid_andQueryArg_XRoValidateOnly_2xx_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenDoesntExistColl_thenResponseCode_404_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenDoesntExistColl_thenResponseCode_404_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenDoesntExistColl_thenResponseCode_404_TODO.java
new file mode 100644
index 0000000..a74f38c
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenDoesntExistColl_thenResponseCode_404_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Put_whenDoesntExistColl_thenResponseCode_404_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenDoesntExistOid_thenResponseCode_404_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenDoesntExistOid_thenResponseCode_404_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenDoesntExistOid_thenResponseCode_404_TODO.java
new file mode 100644
index 0000000..23754b3
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenDoesntExistOid_thenResponseCode_404_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class Put_whenDoesntExistOid_thenResponseCode_404_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/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
deleted file mode 100644
index d595a78..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenInvalidArg_bad_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-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/cf0bc337/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
deleted file mode 100644
index 43832d9..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_whenNoArg_bad_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_givenDisabled_thenResponseCode_203_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_givenDisabled_thenResponseCode_203_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_givenDisabled_thenResponseCode_203_TODO.java
new file mode 100644
index 0000000..a193f1c
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_givenDisabled_thenResponseCode_203_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Delete_givenDisabled_thenResponseCode_203_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_givenHidden_thenResponseCode_404_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_givenHidden_thenResponseCode_404_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_givenHidden_thenResponseCode_404_TODO.java
new file mode 100644
index 0000000..8e37b7a
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_givenHidden_thenResponseCode_404_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Delete_givenHidden_thenResponseCode_404_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenPropertyValueCleared_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenPropertyValueCleared_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenPropertyValueCleared_ok_TODO.java
new file mode 100644
index 0000000..8821a07
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenPropertyValueCleared_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Delete_thenPropertyValueCleared_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseCode_200_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseCode_200_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseCode_200_ok_TODO.java
new file mode 100644
index 0000000..a34b942
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseCode_200_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Delete_thenResponseCode_200_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_CacheControl_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_CacheControl_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_CacheControl_ok_TODO.java
new file mode 100644
index 0000000..080558e
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_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.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 Delete_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_ContentLength_ok_TODO.java
new file mode 100644
index 0000000..6817fbc
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_ContentLength_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 Delete_thenResponseHeaders_ContentLength_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_ContentType_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_ContentType_ok_TODO.java
new file mode 100644
index 0000000..e943156
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_ContentType_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 Delete_thenResponseHeaders_ContentType_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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_eTag_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_eTag_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_eTag_ok_TODO.java
new file mode 100644
index 0000000..9e5f49d
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_eTag_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Delete_thenResponseHeaders_eTag_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_whenArgs_thenResponseCode_4xx_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_whenArgs_thenResponseCode_4xx_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_whenArgs_thenResponseCode_4xx_TODO.java
new file mode 100644
index 0000000..fafb8b4
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_whenArgs_thenResponseCode_4xx_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Delete_whenArgs_thenResponseCode_4xx_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_whenDoesntExistOid_thenResponseCode_404_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_whenDoesntExistOid_thenResponseCode_404_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_whenDoesntExistOid_thenResponseCode_404_TODO.java
new file mode 100644
index 0000000..891ca3b
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_whenDoesntExistOid_thenResponseCode_404_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Delete_whenDoesntExistOid_thenResponseCode_404_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_whenDoesntExistProp_thenResponseCode_404_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_whenDoesntExistProp_thenResponseCode_404_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_whenDoesntExistProp_thenResponseCode_404_TODO.java
new file mode 100644
index 0000000..363b1cf
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_whenDoesntExistProp_thenResponseCode_404_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Delete_whenDoesntExistProp_thenResponseCode_404_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/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
deleted file mode 100644
index d11dbb5..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_whenNoArg_bad_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-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/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_givenDisabled_thenRepresentation_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_givenDisabled_thenRepresentation_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_givenDisabled_thenRepresentation_ok_TODO.java
new file mode 100644
index 0000000..d0ac943
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_givenDisabled_thenRepresentation_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Get_givenDisabled_thenRepresentation_ok_TODO {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cf0bc337/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseCode_200_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseCode_200_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseCode_200_ok_TODO.java
new file mode 100644
index 0000000..8fdfcde
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseCode_200_ok_TODO.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+public class Get_thenResponseCode_200_ok_TODO {
+
+}
[28/50] [abbrv] git commit: ISIS-233: invoking action with missing
args or surplus args
Posted by da...@apache.org.
ISIS-233: invoking action with missing args or surplus args
* nb: this has broken some of the unit tests, due to change in JsonRepresentation's handling of null. Need to fix.
* have also added some ZzzToDo placeholders for future tests to be written (for 405 method_not_acceptable).
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/fe016432
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/fe016432
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/fe016432
Branch: refs/heads/master
Commit: fe016432a4b54b9e6bd78f363657c9266353639d
Parents: 7bc8691
Author: Dan Haywood <da...@apache.org>
Authored: Thu Mar 21 08:51:05 2013 +0000
Committer: Dan Haywood <da...@apache.org>
Committed: Sat Apr 27 19:01:23 2013 +0100
----------------------------------------------------------------------
.../restfulobjects/applib/JsonRepresentation.java | 5 +-
.../restfulobjects/applib/LinkRepresentation.java | 6 +
.../applib/client/RestfulResponse.java | 2 +-
.../RestfulObjectsApplicationExceptionMapper.java | 38 +-
.../resources/DomainObjectResourceServerside.java | 10 +-
.../server/resources/DomainResourceHelper.java | 38 +-
...ZzzTodo_idempotent_fail_method_not_allowed.java | 5 +
...Todo_nonidempotent_fail_method_not_allowed.java | 5 +
.../ZzzTodo_safe_fail_method_not_allowed.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 +
.../ZzzTodo_clear_fail_method_not_allowed.java | 5 +
.../ZzzTodo_details_fail_method_not_allowed.java | 5 +
.../ZzzTodo_modify_fail_method_not_allowed.java | 5 +
.../action/invoke/DomainServiceTest_forbidden.java | 122 +
...mainServiceTest_req_safe_arg_bad_malformed.java | 20 +-
..._req_safe_simplearg_fail_mandatory_missing.java | 34 +-
...q_safe_simplearg_fail_mandatory_value_null.java | 133 +
...ceTest_req_safe_simplearg_fail_surplus_arg.java | 135 +
...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 +
.../wicket/src/docbkx/guide/isis-wicket-viewer.md | 2958 +++++++++++++++
.../tck/dom/actions/ActionsEntityRepository.java | 2 +-
.../tck/dom/busrules/BusRulesEntityRepository.java | 4 +-
26 files changed, 3803 insertions(+), 85 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/fe016432/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java
index 17c0cad..2f6e52c 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java
@@ -867,12 +867,9 @@ public class JsonRepresentation {
if (!isMap()) {
throw new IllegalStateException("does not represent map");
}
- if (value == null) {
- return;
- }
final Path path = Path.parse(key);
final ObjectNode node = JsonNodeUtils.walkNodeUpTo(asObjectNode(), path.getHead());
- node.put(path.getTail(), new POJONode(value));
+ node.put(path.getTail(), value != null? new POJONode(value): NullNode.getInstance() );
}
public void mapPut(final String key, final JsonRepresentation value) {
http://git-wip-us.apache.org/repos/asf/isis/blob/fe016432/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/LinkRepresentation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/LinkRepresentation.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/LinkRepresentation.java
index bafbdba..4058734 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/LinkRepresentation.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/LinkRepresentation.java
@@ -47,6 +47,11 @@ public final class LinkRepresentation extends JsonRepresentation {
asObjectNode().put("rel", rel);
return this;
}
+
+ public LinkRepresentation withRel(Rel rel) {
+ return withRel(rel.getName());
+ }
+
public String getHref() {
return asObjectNode().path("href").getTextValue();
@@ -161,4 +166,5 @@ public final class LinkRepresentation extends JsonRepresentation {
return "Link [rel=" + getRel() + ", href=" + getHref() + ", method=" + getHttpMethod() + ", type=" + getType() + "]";
}
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/fe016432/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java
index c1869ac..2562ef6 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java
@@ -124,7 +124,7 @@ public class RestfulResponse<T> {
public final static HttpStatusCode UNAUTHORIZED = new HttpStatusCode(401, Status.UNAUTHORIZED);
// public static final int SC_PAYMENT_REQUIRED = 402;
- // public static final int SC_FORBIDDEN = 403;
+ public static final HttpStatusCode FORBIDDEN = new HttpStatusCode(403, Status.FORBIDDEN);
public final static HttpStatusCode NOT_FOUND = new HttpStatusCode(404, Status.NOT_FOUND);
public final static HttpStatusCode METHOD_NOT_ALLOWED = new HttpStatusCode(405, new StatusTypeImpl(405, Family.CLIENT_ERROR, "Method not allowed"));
http://git-wip-us.apache.org/repos/asf/isis/blob/fe016432/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapper.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapper.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapper.java
index a2b7587..5178601 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapper.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/RestfulObjectsApplicationExceptionMapper.java
@@ -42,13 +42,28 @@ public class RestfulObjectsApplicationExceptionMapper implements ExceptionMapper
@Override
public Response toResponse(final RestfulObjectsApplicationException ex) {
final ResponseBuilder builder = Response.status(ex.getHttpStatusCode().getJaxrsStatusType());
- final String body = bodyFor(ex);
- if(body != null) {
+
+ // body and content-type
+ final JsonRepresentation bodyRepr = ex.getBody();
+ final Throwable cause = ex.getCause();
+ if (bodyRepr != null) {
+ final String body = bodyRepr.toString();
builder.entity(body);
builder.type(MediaType.APPLICATION_JSON); // generic; the spec doesn't define what the media type should be
- } else {
+ } else if(cause == null) {
+ builder.type(MediaType.APPLICATION_JSON); // generic; the spec doesn't define what the media type should be
+ } else {
+ String body;
+ try {
+ body = JsonMapper.instance().write(ExceptionPojo.create(cause));
+ } catch (final Exception e) {
+ // fallback
+ body = "{ \"exception\": \"" + ExceptionUtils.getFullStackTrace(cause) + "\" }";
+ }
+ builder.entity(body);
builder.type(RestfulMediaType.APPLICATION_JSON_ERROR);
}
+
final String message = ex.getMessage();
if (message != null) {
builder.header(RestfulResponse.Header.WARNING.getName(), RestfulResponse.Header.WARNING.render(message));
@@ -56,23 +71,6 @@ public class RestfulObjectsApplicationExceptionMapper implements ExceptionMapper
return builder.build();
}
- static String bodyFor(final RestfulObjectsApplicationException ex) {
- final JsonRepresentation jsonRepresentation = ex.getBody();
- if (jsonRepresentation != null) {
- return jsonRepresentation.toString();
- }
- Throwable cause = ex.getCause();
- if(cause == null) {
- return null;
- }
- try {
- return JsonMapper.instance().write(ExceptionPojo.create(cause));
- } catch (final Exception e) {
- // fallback
- return "{ \"exception\": \"" + ExceptionUtils.getFullStackTrace(cause) + "\" }";
- }
- }
-
private static class ExceptionPojo {
public static ExceptionPojo create(final Throwable ex) {
http://git-wip-us.apache.org/repos/asf/isis/blob/fe016432/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainObjectResourceServerside.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainObjectResourceServerside.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainObjectResourceServerside.java
index 24ff44f..afa6a64 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainObjectResourceServerside.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainObjectResourceServerside.java
@@ -189,7 +189,7 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, oidStr);
final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), objectAdapter);
- final OneToOneAssociation property = helper.getPropertyThatIsVisibleAndUsable(propertyId, Intent.MUTATE, getResourceContext().getWhere());
+ final OneToOneAssociation property = helper.getPropertyThatIsVisibleForIntent(propertyId, Intent.MUTATE, getResourceContext().getWhere());
final ObjectSpecification propertySpec = property.getSpecification();
final String bodyAsString = DomainResourceHelper.asStringUtf8(body);
@@ -216,7 +216,7 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, oidStr);
final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), objectAdapter);
- final OneToOneAssociation property = helper.getPropertyThatIsVisibleAndUsable(propertyId, Intent.MUTATE, getResourceContext().getWhere());
+ final OneToOneAssociation property = helper.getPropertyThatIsVisibleForIntent(propertyId, Intent.MUTATE, getResourceContext().getWhere());
final Consent consent = property.isAssociationValid(objectAdapter, null);
if (consent.isVetoed()) {
@@ -256,7 +256,7 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, oidStr);
final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), objectAdapter);
- final OneToManyAssociation collection = helper.getCollectionThatIsVisibleAndUsable(collectionId, Intent.MUTATE, getResourceContext().getWhere());
+ final OneToManyAssociation collection = helper.getCollectionThatIsVisibleForIntent(collectionId, Intent.MUTATE, getResourceContext().getWhere());
if (!collection.getCollectionSemantics().isSet()) {
throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.BAD_REQUEST, "Collection '%s' does not have set semantics", collectionId);
@@ -287,7 +287,7 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, oidStr);
final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), objectAdapter);
- final OneToManyAssociation collection = helper.getCollectionThatIsVisibleAndUsable(collectionId, Intent.MUTATE, getResourceContext().getWhere());
+ final OneToManyAssociation collection = helper.getCollectionThatIsVisibleForIntent(collectionId, Intent.MUTATE, getResourceContext().getWhere());
if (!collection.getCollectionSemantics().isListOrArray()) {
throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.METHOD_NOT_ALLOWED, "Collection '%s' does not have list or array semantics", collectionId);
@@ -317,7 +317,7 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, oidStr);
final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), objectAdapter);
- final OneToManyAssociation collection = helper.getCollectionThatIsVisibleAndUsable(collectionId, Intent.MUTATE, getResourceContext().getWhere());
+ final OneToManyAssociation collection = helper.getCollectionThatIsVisibleForIntent(collectionId, Intent.MUTATE, getResourceContext().getWhere());
final ObjectSpecification collectionSpec = collection.getSpecification();
final ObjectAdapter argAdapter = helper.parseAsMapWithSingleValue(collectionSpec, getResourceContext().getQueryString());
http://git-wip-us.apache.org/repos/asf/isis/blob/fe016432/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
index 74d7cdf..103cfd0 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
@@ -189,7 +189,7 @@ public final class DomainResourceHelper {
Response propertyDetails(final String propertyId, final MemberMode memberMode, final Caching caching, Where where) {
- final OneToOneAssociation property = getPropertyThatIsVisibleAndUsable(propertyId, Intent.ACCESS, where);
+ final OneToOneAssociation property = getPropertyThatIsVisibleForIntent(propertyId, Intent.ACCESS, where);
final ObjectPropertyReprRenderer renderer = new ObjectPropertyReprRenderer(resourceContext, null, null, JsonRepresentation.newMap());
@@ -206,7 +206,7 @@ public final class DomainResourceHelper {
Response collectionDetails(final String collectionId, final MemberMode memberMode, final Caching caching, Where where) {
- final OneToManyAssociation collection = getCollectionThatIsVisibleAndUsable(collectionId, Intent.ACCESS, where);
+ final OneToManyAssociation collection = getCollectionThatIsVisibleForIntent(collectionId, Intent.ACCESS, where);
final ObjectCollectionReprRenderer renderer = new ObjectCollectionReprRenderer(resourceContext, null, null, JsonRepresentation.newMap());
@@ -222,7 +222,7 @@ public final class DomainResourceHelper {
// //////////////////////////////////////////////////////////////
Response actionPrompt(final String actionId, Where where) {
- final ObjectAction action = getObjectActionThatIsVisibleAndUsable(actionId, Intent.ACCESS, where);
+ final ObjectAction action = getObjectActionThatIsVisibleForIntent(actionId, Intent.ACCESS, where);
final ObjectActionReprRenderer renderer = new ObjectActionReprRenderer(resourceContext, null, null, JsonRepresentation.newMap());
@@ -244,7 +244,7 @@ public final class DomainResourceHelper {
}
Response invokeActionQueryOnly(final String actionId, final JsonRepresentation arguments, Where where) {
- final ObjectAction action = getObjectActionThatIsVisibleAndUsable(actionId, Intent.ACCESS, where);
+ final ObjectAction action = getObjectActionThatIsVisibleForIntent(actionId, Intent.MUTATE, where);
final ActionSemantics.Of actionSemantics = action.getSemantics();
if (actionSemantics != ActionSemantics.Of.SAFE) {
@@ -256,7 +256,7 @@ public final class DomainResourceHelper {
Response invokeActionIdempotent(final String actionId, final JsonRepresentation arguments, Where where) {
- final ObjectAction action = getObjectActionThatIsVisibleAndUsable(actionId, Intent.MUTATE, where);
+ final ObjectAction action = getObjectActionThatIsVisibleForIntent(actionId, Intent.MUTATE, where);
final ActionSemantics.Of actionSemantics = action.getSemantics();
if (!actionSemantics.isIdempotentInNature()) {
@@ -266,7 +266,7 @@ public final class DomainResourceHelper {
}
Response invokeAction(final String actionId, final JsonRepresentation arguments, Where where) {
- final ObjectAction action = getObjectActionThatIsVisibleAndUsable(actionId, Intent.MUTATE, where);
+ final ObjectAction action = getObjectActionThatIsVisibleForIntent(actionId, Intent.MUTATE, where);
return invokeActionUsingAdapters(action, arguments);
}
@@ -363,37 +363,37 @@ public final class DomainResourceHelper {
// get{MemberType}ThatIsVisibleAndUsable
// ///////////////////////////////////////////////////////////////////
- protected OneToOneAssociation getPropertyThatIsVisibleAndUsable(final String propertyId, final Intent intent, Where where) {
+ protected OneToOneAssociation getPropertyThatIsVisibleForIntent(final String propertyId, final Intent intent, Where where) {
final ObjectAssociation association = objectAdapter.getSpecification().getAssociation(propertyId);
if (association == null || !association.isOneToOneAssociation()) {
throwNotFoundException(propertyId, MemberType.PROPERTY);
}
final OneToOneAssociation property = (OneToOneAssociation) association;
- return memberThatIsVisibleAndUsable(property, MemberType.PROPERTY, intent, where);
+ return memberThatIsVisibleForIntent(property, MemberType.PROPERTY, intent, where);
}
- protected OneToManyAssociation getCollectionThatIsVisibleAndUsable(final String collectionId, final Intent intent, Where where) {
+ protected OneToManyAssociation getCollectionThatIsVisibleForIntent(final String collectionId, final Intent intent, Where where) {
final ObjectAssociation association = objectAdapter.getSpecification().getAssociation(collectionId);
if (association == null || !association.isOneToManyAssociation()) {
throwNotFoundException(collectionId, MemberType.COLLECTION);
}
final OneToManyAssociation collection = (OneToManyAssociation) association;
- return memberThatIsVisibleAndUsable(collection, MemberType.COLLECTION, intent, where);
+ return memberThatIsVisibleForIntent(collection, MemberType.COLLECTION, intent, where);
}
- protected ObjectAction getObjectActionThatIsVisibleAndUsable(final String actionId, final Intent intent, Where where) {
+ protected ObjectAction getObjectActionThatIsVisibleForIntent(final String actionId, final Intent intent, Where where) {
final ObjectAction action = objectAdapter.getSpecification().getObjectAction(actionId);
if (action == null) {
throwNotFoundException(actionId, MemberType.ACTION);
}
- return memberThatIsVisibleAndUsable(action, MemberType.ACTION, intent, where);
+ return memberThatIsVisibleForIntent(action, MemberType.ACTION, intent, where);
}
- protected <T extends ObjectMember> T memberThatIsVisibleAndUsable(final T objectMember, final MemberType memberType, final Intent intent, Where where) {
+ protected <T extends ObjectMember> T memberThatIsVisibleForIntent(final T objectMember, final MemberType memberType, final Intent intent, Where where) {
final String memberId = objectMember.getId();
final AuthenticationSession authenticationSession = resourceContext.getAuthenticationSession();
if (objectMember.isVisible(authenticationSession, objectAdapter, where).isVetoed()) {
@@ -402,8 +402,7 @@ public final class DomainResourceHelper {
if (intent.isMutate()) {
final Consent usable = objectMember.isUsable(authenticationSession, objectAdapter, where);
if (usable.isVetoed()) {
- final String memberTypeStr = memberType.name().toLowerCase();
- throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.NOT_ACCEPTABLE, "%s is not usable: '%s' (%s)", memberTypeStr, memberId, usable.getReason());
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.FORBIDDEN, usable.getReason());
}
}
return objectMember;
@@ -427,7 +426,6 @@ public final class DomainResourceHelper {
*/
ObjectAdapter parseAsMapWithSingleValue(final ObjectSpecification objectSpec, final String bodyAsString) {
final JsonRepresentation arguments = readAsMap(bodyAsString);
-
return parseAsMapWithSingleValue(objectSpec, arguments);
}
@@ -489,9 +487,9 @@ public final class DomainResourceHelper {
for (final Entry<String, JsonRepresentation> arg : arguments.mapIterable()) {
final String argName = arg.getKey();
if (action.getParameterById(argName) == null) {
- String reason = String.format("Action '%s' does not have a parameter %s but an argument of that name was provided", action.getId(), argName);
+ String reason = String.format("Argument '%s' found but no such parameter", argName);
arguments.mapPut("x-ro-invalidReason", reason);
- throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.VALIDATION_FAILED, reason);
+ throw RestfulObjectsApplicationException.createWithBody(HttpStatusCode.BAD_REQUEST, arguments, reason);
}
}
@@ -502,9 +500,9 @@ public final class DomainResourceHelper {
final String paramId = param.getId();
final JsonRepresentation argRepr = arguments.getRepresentation(paramId);
if (argRepr == null && !param.isOptional()) {
- String reason = String.format("Action '%s', no argument found for (mandatory) parameter '%s'", action.getId(), paramId);
+ String reason = String.format("No argument found for (mandatory) parameter '%s'", paramId);
arguments.mapPut("x-ro-invalidReason", reason);
- throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.VALIDATION_FAILED, reason);
+ throw RestfulObjectsApplicationException.createWithBody(HttpStatusCode.BAD_REQUEST, arguments, reason);
}
argList.add(argRepr);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/fe016432/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
new file mode 100644
index 0000000..03caba4
--- /dev/null
+++ 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
@@ -0,0 +1,5 @@
+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/fe016432/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
new file mode 100644
index 0000000..53cfcb5
--- /dev/null
+++ 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
@@ -0,0 +1,5 @@
+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/fe016432/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
new file mode 100644
index 0000000..f062ecd
--- /dev/null
+++ 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
@@ -0,0 +1,5 @@
+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/fe016432/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
new file mode 100644
index 0000000..6b4f1e9
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/ZzzTodo_addTo_fail_method_not_allowed.java
@@ -0,0 +1,5 @@
+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/fe016432/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
new file mode 100644
index 0000000..b3b0420
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/ZzzTodo_details_fail_method_not_allowed.java
@@ -0,0 +1,5 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.collection;
+
+public class ZzzTodo_details_fail_method_not_allowed {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/fe016432/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
new file mode 100644
index 0000000..adcba23
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/ZzzTodo_removeFrom_fail_method_not_allowed.java
@@ -0,0 +1,5 @@
+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/fe016432/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
new file mode 100644
index 0000000..20dd6dd
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/ZzzTodo_clear_fail_method_not_allowed.java
@@ -0,0 +1,5 @@
+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/fe016432/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
new file mode 100644
index 0000000..5235bbc
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/ZzzTodo_details_fail_method_not_allowed.java
@@ -0,0 +1,5 @@
+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/fe016432/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
new file mode 100644
index 0000000..b001fac
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/ZzzTodo_modify_fail_method_not_allowed.java
@@ -0,0 +1,5 @@
+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/fe016432/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
new file mode 100644
index 0000000..e80690a
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/serviceId/action/invoke/DomainServiceTest_forbidden.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.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/fe016432/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
index 6196072..383a075 100644
--- 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
@@ -20,7 +20,6 @@ package org.apache.isis.viewer.restfulobjects.tck.domainservice.serviceId.action
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.*;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
@@ -29,31 +28,26 @@ 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.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.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 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_arg_bad_malformed {
http://git-wip-us.apache.org/repos/asf/isis/blob/fe016432/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
index 2116f54..81af0c1 100644
--- 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
@@ -21,7 +21,6 @@ package org.apache.isis.viewer.restfulobjects.tck.domainservice.serviceId.action
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;
@@ -30,31 +29,28 @@ 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.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_mandatory_missing {
@@ -93,8 +89,10 @@ public class DomainServiceTest_req_safe_simplearg_fail_mandatory_missing {
assertThat(args, RestfulMatchers.mapHas("to"));
// when
- args.mapPut("from.value", (Integer)null);
+ args = JsonRepresentation.newMap();
+ // nothing for 'from'
args.mapPut("to.value", 0);
+ assertThat(args.size(), is(1));
final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
@@ -102,13 +100,13 @@ public class DomainServiceTest_req_safe_simplearg_fail_mandatory_missing {
thenResponseIsErrorWithInvalidReason(restfulResponse);
}
- @Ignore("to write")
+
@Test
public void usingResourceProxy() throws Exception {
// given, when
JsonRepresentation args = JsonRepresentation.newMap();
- args.mapPut("from.value", 1);
+ // nothing for 'from'
args.mapPut("to.value", 0);
Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "subList", UrlEncodingUtils.urlEncode(args));
RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
@@ -118,8 +116,8 @@ public class DomainServiceTest_req_safe_simplearg_fail_mandatory_missing {
}
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"));
+ 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));
@@ -127,9 +125,7 @@ public class DomainServiceTest_req_safe_simplearg_fail_mandatory_missing {
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"));
+ assertThat(repr.getString("x-ro-invalidReason"), is("No argument found for (mandatory) parameter 'from'"));
}
http://git-wip-us.apache.org/repos/asf/isis/blob/fe016432/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
new file mode 100644
index 0000000..5408be2
--- /dev/null
+++ 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
@@ -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.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"));
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/fe016432/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
new file mode 100644
index 0000000..a4798a8
--- /dev/null
+++ 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
@@ -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.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/fe016432/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
new file mode 100644
index 0000000..ecc445e
--- /dev/null
+++ 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
@@ -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.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/fe016432/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
new file mode 100644
index 0000000..957d767
--- /dev/null
+++ 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
@@ -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.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/fe016432/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
new file mode 100644
index 0000000..b7eec2a
--- /dev/null
+++ 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
@@ -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.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));
+ }
+
+}
[26/50] [abbrv] ISIS-233: invoking action with missing args or
surplus args
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/fe016432/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java
----------------------------------------------------------------------
diff --git a/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java
index a517b9a..676f04b 100644
--- a/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java
+++ b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java
@@ -43,7 +43,7 @@ public class ActionsEntityRepository extends AbstractEntityRepository<ActionsEnt
@ActionSemantics(Of.SAFE)
@MemberOrder(sequence = "1")
- public ActionsEntity findById(int id) {
+ public ActionsEntity findById(@Named("id") int id) {
final Query<ActionsEntity> query =
new QueryDefault<ActionsEntity>(ActionsEntity.class, ActionsEntity.class.getName() + "#pk", "id", id);
return this.firstMatch(query);
http://git-wip-us.apache.org/repos/asf/isis/blob/fe016432/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/busrules/BusRulesEntityRepository.java
----------------------------------------------------------------------
diff --git a/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/busrules/BusRulesEntityRepository.java b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/busrules/BusRulesEntityRepository.java
index 456f514..fd7d8a7 100644
--- a/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/busrules/BusRulesEntityRepository.java
+++ b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/busrules/BusRulesEntityRepository.java
@@ -49,14 +49,14 @@ public class BusRulesEntityRepository extends AbstractEntityRepository<BusRulesE
@ActionSemantics(Of.SAFE)
@MemberOrder(sequence = "1")
- public BusRulesEntity visibleAndInvocableAction(int id) {
+ public BusRulesEntity visibleAndInvocableAction(@Named("id") int id) {
return this.findById(id);
}
@Disabled
@ActionSemantics(Of.SAFE)
@MemberOrder(sequence = "1")
- public BusRulesEntity visibleButNotInvocableAction(int id) {
+ public BusRulesEntity visibleButNotInvocableAction(@Named("id") int id) {
return this.findById(id);
}
[33/50] [abbrv] ISIS-233: adding new test stubs (TODOs)
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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));
+ }
+
+}
[03/50] [abbrv] ISIS-233: more on user, version, services list
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_representation.java
new file mode 100644
index 0000000..b8221b1
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_representation.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.resources.home;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.hamcrest.CoreMatchers.endsWith;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status.Family;
+
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class HomePageResourceTest_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/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_responseHeaders.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_responseHeaders.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_responseHeaders.java
new file mode 100644
index 0000000..f4d8231
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_responseHeaders.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.resources.home;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.CacheControl;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.Header;
+import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class HomePageResourceTest_responseHeaders {
+
+ @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/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_templated_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_templated_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_templated_representation.java
deleted file mode 100644
index acb0c6d..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_templated_representation.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.resources.home;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isFollowableLinkToSelf;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
-import static org.hamcrest.CoreMatchers.endsWith;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.CacheControl;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status.Family;
-
-import org.apache.isis.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.homepage.HomePageResource;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class HomePageResourceTest_templated_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/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_templated_responseHeaders.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_templated_responseHeaders.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_templated_responseHeaders.java
deleted file mode 100644
index 201683e..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_templated_responseHeaders.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.restfulobjects.tck.resources.home;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isFollowableLinkToSelf;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
-import static org.hamcrest.CoreMatchers.endsWith;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.CacheControl;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status.Family;
-
-import org.apache.isis.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.homepage.HomePageResource;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class HomePageResourceTest_templated_responseHeaders {
-
- @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 headers() 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/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_xrofollowlinks.java
index f86249e..4af1ad0 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_xrofollowlinks.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_xrofollowlinks.java
@@ -57,18 +57,30 @@ public class HomePageResourceTest_xrofollowlinks {
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();
-
- // given
+
+ 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 canFollowUser() throws Exception {
+ public void user() throws Exception {
repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.USER.getName() + "]");
@@ -76,7 +88,7 @@ public class HomePageResourceTest_xrofollowlinks {
}
@Test
- public void canFollowServices() throws Exception {
+ public void services() throws Exception {
repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.SERVICES.getName() + "]");
@@ -84,7 +96,7 @@ public class HomePageResourceTest_xrofollowlinks {
}
@Test
- public void canFollowVersion() throws Exception {
+ public void version() throws Exception {
repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.VERSION.getName() + "]");
@@ -92,7 +104,7 @@ public class HomePageResourceTest_xrofollowlinks {
}
@Test
- public void canFollowAll() throws Exception {
+ public void multiple() throws Exception {
repr = whenExecuteAndFollowLinksUsing("/",
"links[rel=" + Rel.USER.getName() + "]," +
@@ -105,7 +117,7 @@ public class HomePageResourceTest_xrofollowlinks {
}
@Test
- public void servicesValues() throws Exception {
+ public void allServices_Value() throws Exception {
repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.SERVICES.getName() + "].value");
@@ -127,7 +139,7 @@ public class HomePageResourceTest_xrofollowlinks {
}
@Test
- public void servicesValuesWithCriteria() throws Exception {
+ public void selectedService_Value() throws Exception {
repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.SERVICES.getName() + "].value[rel=" + Rel.SERVICE.andParam("serviceId", "WrapperValuedEntities")+"]");
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/invoke/DomainServiceResourceTest_invokeAction.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/invoke/DomainServiceResourceTest_invokeAction.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/invoke/DomainServiceResourceTest_invokeAction.java
index 73b6edf..913867e 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/invoke/DomainServiceResourceTest_invokeAction.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/invoke/DomainServiceResourceTest_invokeAction.java
@@ -84,7 +84,7 @@ public class DomainServiceResourceTest_invokeAction {
final RestfulResponse<ListRepresentation> restfulResponse = client.followT(invokeLink);
final ListRepresentation listRepr = restfulResponse.getEntity();
- assertThat(listRepr.getValues().size(), is(5));
+ assertThat(listRepr.getValue().size(), is(5));
}
@Ignore("TODO - fix broken test resulting from introduction of actionresult repr")
@@ -259,7 +259,7 @@ public class DomainServiceResourceTest_invokeAction {
final RestfulResponse<ListRepresentation> restfulResponse = client.followT(invokeLink);
final ListRepresentation listRepr = restfulResponse.getEntity();
- return listRepr.getValues().arrayGet(num).asLink();
+ return listRepr.getValue().arrayGet(num).asLink();
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/services/DomainServiceResourceTest_services_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/services/DomainServiceResourceTest_services_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/services/DomainServiceResourceTest_services_accept.java
deleted file mode 100644
index 9362707..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/services/DomainServiceResourceTest_services_accept.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.resources.service.services;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.MediaType;
-
-import org.apache.isis.core.webserver.WebServer;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class DomainServiceResourceTest_services_accept {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- @Before
- public void setUp() throws Exception {
- final WebServer webServer = webServerRule.getWebServer();
- client = new RestfulClient(webServer.getBase());
- }
-
- @Test
- public void applicationJson() throws Exception {
-
- final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, "services").withHeader(RestfulRequest.Header.ACCEPT, MediaType.APPLICATION_JSON_TYPE);
- final RestfulResponse<HomePageRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- }
-
- @Test
- public void applicationJson_profileList() throws Exception {
-
- final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, "services").withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.LIST.getMediaType());
- final RestfulResponse<HomePageRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- }
-
- @Test
- public void applicationJson_invalid() throws Exception {
-
- final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, "services").withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.USER.getMediaType());
- final RestfulResponse<HomePageRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/services/DomainServiceResourceTest_services_representationAndHeaders.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/services/DomainServiceResourceTest_services_representationAndHeaders.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/services/DomainServiceResourceTest_services_representationAndHeaders.java
deleted file mode 100644
index 1d80286..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/services/DomainServiceResourceTest_services_representationAndHeaders.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.resources.service.services;
-
-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.isFollowableLinkToSelf;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-
-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.LinkRepresentation;
-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.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class DomainServiceResourceTest_services_representationAndHeaders {
-
- @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
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- assertThat(restfulResponse.getHeader(RestfulResponse.Header.CONTENT_TYPE), is(RepresentationType.LIST.getMediaType()));
- assertThat(restfulResponse.getHeader(RestfulResponse.Header.CACHE_CONTROL).getMaxAge(), is(24 * 60 * 60));
-
- final ListRepresentation repr = restfulResponse.getEntity();
-
- assertThat(repr, isMap());
-
- assertThat(repr.getSelf(), isLink().httpMethod(RestfulHttpMethod.GET));
-
- assertThat(repr.getValues(), isArray());
-
- assertThat(repr.getLinks(), isArray());
- assertThat(repr.getExtensions(), isMap());
- }
-
- @Test
- public void self_isFollowable() throws Exception {
- // given
- final ListRepresentation repr = givenRepresentation();
-
- // when, then
- assertThat(repr, isFollowableLinkToSelf(client));
- }
-
- @Test
- public void linksToDomainServiceResources() throws Exception {
-
- // given
- final ListRepresentation repr = givenRepresentation();
-
- // when
- final JsonRepresentation values = repr.getValues();
-
- // then
- for (final LinkRepresentation link : values.arrayIterable(LinkRepresentation.class)) {
- assertThat("HiddenRepository should not show up in services list", false, is(link.getHref().endsWith("HiddenRepository")));
-
- final RestfulResponse<JsonRepresentation> followJsonResp = client.follow(link);
- assertThat(followJsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));
-
- final JsonRepresentation followRepr = followJsonResp.getEntity();
- final LinkRepresentation self = followRepr.getLink("links[rel=self]");
-
- assertThat(self.getHref(), is(link.getHref()));
- }
- }
-
- private ListRepresentation givenRepresentation() throws JsonParseException, JsonMappingException, IOException {
- final RestfulResponse<ListRepresentation> jsonResp = RestfulResponse.ofT(resource.services());
- return jsonResp.getEntity();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/services/DomainServiceResourceTest_services_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/services/DomainServiceResourceTest_services_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/services/DomainServiceResourceTest_services_xrofollowlinks.java
deleted file mode 100644
index d52903b..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/services/DomainServiceResourceTest_services_xrofollowlinks.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.restfulobjects.tck.resources.service.services;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.Matchers.greaterThan;
-import static org.junit.Assert.assertThat;
-
-import org.hamcrest.Matchers;
-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.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.domainobjects.ListRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-
-public class DomainServiceResourceTest_services_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 xrofollowLinks() throws Exception {
-
- RestfulRequest request;
- RestfulResponse<ListRepresentation> restfulResponse;
- ListRepresentation repr;
-
- request = client.createRequest(RestfulHttpMethod.GET, "services");
- restfulResponse = request.executeT();
- repr = restfulResponse.getEntity();
-
- assertThat(repr.getValues(), isArray());
- assertThat(repr.getValues().size(), is(greaterThan(0)));
- assertThat(repr.getValues().arrayGet(0), isLink().novalue());
-
- request = client.createRequest(RestfulHttpMethod.GET, "services").withArg(RequestParameter.FOLLOW_LINKS, "values");
- restfulResponse = request.executeT();
- repr = restfulResponse.getEntity();
-
- assertThat(repr.getValues().arrayGet(0), isLink().value(is(not(Matchers.nullValue(JsonRepresentation.class)))));
- assertThat(repr.getValues().arrayGet(0).getRepresentation("value"), isMap());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_acceptHeader.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_acceptHeader.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_acceptHeader.java
new file mode 100644
index 0000000..af9adf7
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_acceptHeader.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.resources.user;
+
+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 UserResourceTest_acceptHeader {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+ private RestfulRequest request;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+ request = client.createRequest(RestfulHttpMethod.GET, "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/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_get_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_get_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_get_accept.java
deleted file mode 100644
index 4246313..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_get_accept.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.restfulobjects.tck.resources.user;
-
-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 UserResourceTest_get_accept {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
- }
-
- @Test
- public void applicationJson_noProfile_returns200() throws Exception {
-
- final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, "user").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 {
-
- final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, "user").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 {
- // given
- final RestfulRequest restfulReq = client.createRequest(RestfulHttpMethod.GET, "user");
-
- // when
- final RestfulResponse<UserRepresentation> restfulResp = restfulReq.executeT();
-
- // then
- assertThat(restfulResp.getStatus(), is(HttpStatusCode.OK));
- }
-
- @Test
- public void applicationJson_profileIncorrect_returns406() throws Exception {
-
- final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, "user").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/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_representation.java
new file mode 100644
index 0000000..1dec9b5
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_representation.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.resources.user;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.hamcrest.CoreMatchers.endsWith;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status.Family;
+
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.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 UserResourceTest_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/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_responseHeaders.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_responseHeaders.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_responseHeaders.java
new file mode 100644
index 0000000..f15a265
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_responseHeaders.java
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.resources.user;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isFollowableLinkToSelf;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.hamcrest.CoreMatchers.endsWith;
+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 UserResourceTest_responseHeaders {
+
+ @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/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_templated_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_templated_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_templated_representation.java
deleted file mode 100644
index da95307..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_templated_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.resources.user;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
-import static org.hamcrest.CoreMatchers.endsWith;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status.Family;
-
-import org.apache.isis.viewer.restfulobjects.applib.Rel;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.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 UserResourceTest_templated_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/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_templated_responseHeaders.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_templated_responseHeaders.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_templated_responseHeaders.java
deleted file mode 100644
index ea6e6ec..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_templated_responseHeaders.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.resources.user;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isFollowableLinkToSelf;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
-import static org.hamcrest.CoreMatchers.endsWith;
-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 UserResourceTest_templated_responseHeaders {
-
- @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 headers() 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/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_xrofollowlinks.java
new file mode 100644
index 0000000..7d683ca
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_xrofollowlinks.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.resources.user;
+
+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 UserResourceTest_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/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_acceptHeader.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_acceptHeader.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_acceptHeader.java
new file mode 100644
index 0000000..2efa8e6
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_acceptHeader.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.resources.version;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.MediaType;
+
+import org.jboss.resteasy.client.ClientRequest;
+import org.jboss.resteasy.client.ClientResponse;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.user.UserRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.version.VersionRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+public class VersionResourceTest_acceptHeader {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ private RestfulRequest request;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+ request = client.createRequest(RestfulHttpMethod.GET, "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));
+ }
+}
[43/50] [abbrv] git commit: ISIS-233: more tck tests for RO viewer
Posted by da...@apache.org.
ISIS-233: more tck tests for RO viewer
fixes for actionresult returning a domain object representation.
can now pass in ?id=123 as well
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/82c7af43
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/82c7af43
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/82c7af43
Branch: refs/heads/master
Commit: 82c7af438d3fb8e19a9dc02d7bee6216f7cb5429
Parents: cf0bc33
Author: Dan Haywood <da...@apache.org>
Authored: Wed Apr 24 07:31:27 2013 +0100
Committer: Dan Haywood <da...@apache.org>
Committed: Sat Apr 27 19:01:37 2013 +0100
----------------------------------------------------------------------
.gitignore | 3 +
.../restfulobjects/applib/JsonRepresentation.java | 16 +--
.../applib/client/RestfulResponse.java | 1 +
.../restfulobjects/applib/util/JsonNodeUtils.java | 8 +
.../JsonRepresentationTest_getLink_isLink.java | 22 +++
.../domainobjects/ActionResultReprRenderer.java | 62 +++++---
.../restfulobjects/server/ResourceContext.java | 41 +++++-
.../server/resources/DomainResourceHelper.java | 11 +-
.../isis/viewer/restfulobjects/tck/Util.java | 3 +
...Get_thenRepresentation_containsSelfLink_ok.java | 98 +++++++++++
.../invoke/Get_whenList_thenRepresentation_ok.java | 112 -------------
...nseHeaders_ContentType_andContentLength_ok.java | 112 +++++++++++++
..._thenResponseHeaders_ContentLength_ok_TODO.java | 13 --
...st_thenResponseHeaders_ContentType_ok_TODO.java | 13 --
...nseHeaders_ContentType_andContentLength_ok.java | 125 +++++++++++++++
...et_whenObject_isNull_thenRepresentation_ok.java | 97 +++++++++++
.../Get_whenObject_thenRepresentation_ok_TODO.java | 13 --
..._thenResponseHeaders_ContentLength_ok_TODO.java | 13 --
...ct_thenResponseHeaders_ContentType_ok_TODO.java | 13 --
...enRepresentation_doesNotContainSelfLink_ok.java | 93 +++++++++++
...enRepresentation_doesNotContainSelfLink_ok.java | 93 +++++++++++
.../tck/dom/actions/ActionsEntityRepository.java | 23 ++-
22 files changed, 767 insertions(+), 218 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/82c7af43/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 33f7a97..9c248dd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,3 +33,6 @@ hs_err_pid*.log
pom.xml.tag
pom.xml.releaseBackup
+
+*.jdproj
+JArchitectOut/
http://git-wip-us.apache.org/repos/asf/isis/blob/82c7af43/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java
index 2f6e52c..ac23b28 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java
@@ -782,12 +782,8 @@ public class JsonRepresentation {
final Function<JsonNode, ?> transformer = representationInstantiatorFor(requiredType);
final ArrayNode arrayNode = (ArrayNode) jsonNode;
final Iterator<JsonNode> iterator = arrayNode.iterator();
- final Function<JsonNode, T> typedTransformer = asT(transformer); // necessary
- // to
- // do
- // in
- // two
- // steps
+ // necessary to do in two steps
+ final Function<JsonNode, T> typedTransformer = asT(transformer);
return Iterators.transform(iterator, typedTransformer);
}
@@ -797,12 +793,12 @@ public class JsonRepresentation {
}
public JsonRepresentation arrayGet(final int i) {
- ensureIsAnArrayAtLeastAsLargeAs(i);
+ ensureIsAnArrayAtLeastAsLargeAs(i+1);
return new JsonRepresentation(jsonNode.get(i));
}
public void arraySetElementAt(final int i, final JsonRepresentation objectRepr) {
- ensureIsAnArrayAtLeastAsLargeAs(i);
+ ensureIsAnArrayAtLeastAsLargeAs(i+1);
if (objectRepr.isArray()) {
throw new IllegalArgumentException("Representation being set cannot be an array");
}
@@ -815,8 +811,8 @@ public class JsonRepresentation {
if (!jsonNode.isArray()) {
throw new IllegalStateException("Is not an array");
}
- if (i >= size()) {
- throw new IndexOutOfBoundsException("array has " + size() + " elements");
+ if (i > size()) {
+ throw new IndexOutOfBoundsException("array has only " + size() + " elements");
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/82c7af43/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java
index 2562ef6..c137942 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java
@@ -247,6 +247,7 @@ public class RestfulResponse<T> {
public final static Header<Date> LAST_MODIFIED = new Header<Date>("Last-Modified", Parser.forDate());
public final static Header<CacheControl> CACHE_CONTROL = new Header<CacheControl>("Cache-Control", Parser.forCacheControl());
public final static Header<MediaType> CONTENT_TYPE = new Header<MediaType>("Content-Type", Parser.forJaxRsMediaType());
+ public final static Header<Integer> CONTENT_LENGTH = new Header<Integer>("Content-Length", Parser.forInteger());
public final static Header<String> ETAG = new Header<String>("ETag", Parser.forETag());
private final String name;
http://git-wip-us.apache.org/repos/asf/isis/blob/82c7af43/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/JsonNodeUtils.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/JsonNodeUtils.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/JsonNodeUtils.java
index 446bc3d..7f61f02 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/JsonNodeUtils.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/util/JsonNodeUtils.java
@@ -26,6 +26,8 @@ import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.node.JsonNodeFactory;
import org.codehaus.jackson.node.ObjectNode;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+
import com.google.common.base.Charsets;
public class JsonNodeUtils {
@@ -39,6 +41,12 @@ public class JsonNodeUtils {
return new ByteArrayInputStream(bytes);
}
+ public static InputStream asInputStream(final JsonRepresentation jsonRepresentation) {
+ final String jsonStr = jsonRepresentation.toString();
+ final byte[] bytes = jsonStr.getBytes(Charsets.UTF_8);
+ return new ByteArrayInputStream(bytes);
+ }
+
/**
* Walks the path, ensuring keys exist and are maps, or creating required
* maps as it goes.
http://git-wip-us.apache.org/repos/asf/isis/blob/82c7af43/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getLink_isLink.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getLink_isLink.java b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getLink_isLink.java
index 7bc45b9..d05ee0e 100644
--- a/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getLink_isLink.java
+++ b/component/viewer/restfulobjects/applib/src/test/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentationTest_getLink_isLink.java
@@ -19,6 +19,7 @@
package org.apache.isis.viewer.restfulobjects.applib;
import static org.apache.isis.viewer.restfulobjects.applib.JsonFixture.readJson;
+import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
@@ -94,4 +95,25 @@ public class JsonRepresentationTest_getLink_isLink {
assertThat(e.getMessage(), is("'aSubList' is an array that does not represent a link"));
}
}
+
+ @Test
+ public void withPredicate() throws JsonParseException, JsonMappingException, IOException {
+
+ // given
+ link = new LinkRepresentation().withRel(Rel.SELF).withHref("http://foo/bar").withMethod(RestfulHttpMethod.GET);
+ JsonRepresentation linkListRepr = JsonRepresentation.newArray();
+ linkListRepr.arrayAdd(link);
+
+ jsonRepresentation = JsonRepresentation.newMap();
+ jsonRepresentation.mapPut("links", linkListRepr);
+
+ // when, then
+ assertThat(jsonRepresentation.isLink("links[rel=self]"), is(true));
+ assertThat(jsonRepresentation.getLink("links[rel=self]"), is(not(nullValue())));
+
+ assertThat(jsonRepresentation.isLink("links[rel=other]"), is(false));
+ assertThat(jsonRepresentation.getLink("links[rel=other]"), is(nullValue()));
+ }
+
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/82c7af43/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ActionResultReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ActionResultReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ActionResultReprRenderer.java
index 3623d81..978596a 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ActionResultReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ActionResultReprRenderer.java
@@ -19,6 +19,8 @@ package org.apache.isis.viewer.restfulobjects.rendering.domainobjects;
import java.util.Collection;
import java.util.Map;
+import org.codehaus.jackson.node.NullNode;
+
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
import org.apache.isis.core.metamodel.facets.object.encodeable.EncodableFacet;
@@ -41,9 +43,16 @@ public class ActionResultReprRenderer extends ReprRendererAbstract<ActionResultR
private ObjectAction action;
private JsonRepresentation arguments;
private ObjectAdapter returnedAdapter;
+ private final SelfLink selfLink;
+
+
+ public enum SelfLink {
+ INCLUDED, EXCLUDED
+ }
- public ActionResultReprRenderer(final RendererContext resourceContext, final LinkFollowSpecs linkFollower, final JsonRepresentation representation) {
- super(resourceContext, linkFollower, RepresentationType.ACTION_RESULT, representation);
+ public ActionResultReprRenderer(final RendererContext rendererContext, final LinkFollowSpecs linkFollower, final SelfLink selfLink, final JsonRepresentation representation) {
+ super(rendererContext, linkFollower, RepresentationType.ACTION_RESULT, representation);
+ this.selfLink = selfLink;
}
@Override
@@ -81,7 +90,11 @@ public class ActionResultReprRenderer extends ReprRendererAbstract<ActionResultR
if (!resultType.isVoid()) {
putResultType(representation, resultType);
- representation.mapPut("result", result);
+ if(returnedAdapter != null) {
+ representation.mapPut("result", result);
+ } else {
+ representation.mapPut("result", NullNode.getInstance());
+ }
}
}
@@ -98,12 +111,14 @@ public class ActionResultReprRenderer extends ReprRendererAbstract<ActionResultR
if (collectionFacet != null) {
// collection
- final Collection<ObjectAdapter> collectionAdapters = collectionFacet.collection(returnedAdapter);
-
- final ListReprRenderer renderer = new ListReprRenderer(rendererContext, null, result);
- renderer.with(collectionAdapters).withReturnType(action.getReturnType()).withElementType(returnedAdapter.getElementSpecification());
-
- renderer.render();
+ if(returnedAdapter != null) {
+ final Collection<ObjectAdapter> collectionAdapters = collectionFacet.collection(returnedAdapter);
+
+ final ListReprRenderer renderer = new ListReprRenderer(rendererContext, null, result);
+ renderer.with(collectionAdapters).withReturnType(action.getReturnType()).withElementType(returnedAdapter.getElementSpecification());
+
+ renderer.render();
+ }
return ResultType.LIST;
}
@@ -111,21 +126,25 @@ public class ActionResultReprRenderer extends ReprRendererAbstract<ActionResultR
if (encodableFacet != null) {
// scalar
- final ScalarValueReprRenderer renderer = new ScalarValueReprRenderer(rendererContext, null, result);
- renderer.with(returnedAdapter).withReturnType(action.getReturnType());
-
- renderer.render();
+ if(returnedAdapter != null) {
+ final ScalarValueReprRenderer renderer = new ScalarValueReprRenderer(rendererContext, null, result);
+ renderer.with(returnedAdapter).withReturnType(action.getReturnType());
+
+ renderer.render();
+ }
return ResultType.SCALAR_VALUE;
}
{
// object
- final DomainObjectReprRenderer renderer = new DomainObjectReprRenderer(rendererContext, null, result);
-
- renderer.with(returnedAdapter).includesSelf();
-
- renderer.render();
+ if(returnedAdapter != null) {
+ final DomainObjectReprRenderer renderer = new DomainObjectReprRenderer(rendererContext, null, result);
+
+ renderer.with(returnedAdapter).includesSelf();
+
+ renderer.render();
+ }
return ResultType.DOMAIN_OBJECT;
}
}
@@ -134,10 +153,14 @@ public class ActionResultReprRenderer extends ReprRendererAbstract<ActionResultR
representation.mapPut("resulttype", resultType.getValue());
}
- private JsonRepresentation representationWithSelfFor(final ObjectAction action, final JsonRepresentation bodyArgs) {
+ private void representationWithSelfFor(final ObjectAction action, final JsonRepresentation bodyArgs) {
final JsonRepresentation links = JsonRepresentation.newArray();
representation.mapPut("links", links);
+ if(selfLink == SelfLink.EXCLUDED) {
+ return;
+ }
+
final LinkBuilder selfLinkBuilder = adapterLinkTo.memberBuilder(Rel.SELF, MemberType.ACTION, action, RepresentationType.ACTION_RESULT, "invoke");
// TODO: remove duplication with AbstractObjectMember#addLinkTo
@@ -152,7 +175,6 @@ public class ActionResultReprRenderer extends ReprRendererAbstract<ActionResultR
links.arrayAdd(selfLink);
selfLink.mapPut("args", bodyArgs);
- return representation;
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/82c7af43/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/ResourceContext.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/ResourceContext.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/ResourceContext.java
index 27ec6c4..bf2fd54 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/ResourceContext.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/ResourceContext.java
@@ -21,6 +21,7 @@ package org.apache.isis.viewer.restfulobjects.server;
import java.io.InputStream;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -114,6 +115,8 @@ public class ResourceContext implements RendererContext {
void init(final RepresentationType representationType) {
+ getQueryStringAsJsonRepr(); // force it to be cached
+
ensureCompatibleAcceptHeader(representationType);
ensureDomainModelQueryParamSupported();
@@ -168,12 +171,48 @@ public class ResourceContext implements RendererContext {
}
public JsonRepresentation getQueryStringAsJsonRepr() {
+
if (readQueryStringAsMap == null) {
- readQueryStringAsMap = DomainResourceHelper.readQueryStringAsMap(getQueryString());
+ readQueryStringAsMap = requestArgsAsMap();
}
return readQueryStringAsMap;
}
+ protected JsonRepresentation requestArgsAsMap() {
+ @SuppressWarnings("unchecked")
+ final Map<String,String[]> params = httpServletRequest.getParameterMap();
+
+ if(simpleQueryArgs(params)) {
+ // try to process regular params and build up JSON repr
+ final JsonRepresentation map = JsonRepresentation.newMap();
+ for(String paramName: params.keySet()) {
+ String paramValue = params.get(paramName)[0];
+ try {
+ int paramValueAsInt = Integer.parseInt(paramValue);
+ map.mapPut(paramName+".value", paramValueAsInt);
+ } catch(Exception ex) {
+ map.mapPut(paramName+".value", paramValue);
+ }
+ }
+ return map;
+ } else {
+ return DomainResourceHelper.readQueryStringAsMap(getQueryString());
+ }
+ }
+
+ private static boolean simpleQueryArgs(Map<String, String[]> params) {
+ if(params.isEmpty()) {
+ return false;
+ }
+ for(String paramName: params.keySet()) {
+ if("x-isis-querystring".equals(paramName) || paramName.startsWith("{")) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+
public <Q> Q getArg(final RequestParameter<Q> requestParameter) {
final JsonRepresentation queryStringJsonRepr = getQueryStringAsJsonRepr();
return requestParameter.valueOf(queryStringJsonRepr);
http://git-wip-us.apache.org/repos/asf/isis/blob/82c7af43/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
index 103cfd0..22312c9 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
@@ -51,6 +51,7 @@ import org.apache.isis.viewer.restfulobjects.rendering.RendererContext;
import org.apache.isis.viewer.restfulobjects.rendering.RendererFactory;
import org.apache.isis.viewer.restfulobjects.rendering.domainobjects.AbstractObjectMemberReprRenderer;
import org.apache.isis.viewer.restfulobjects.rendering.domainobjects.ActionResultReprRenderer;
+import org.apache.isis.viewer.restfulobjects.rendering.domainobjects.ActionResultReprRenderer.SelfLink;
import org.apache.isis.viewer.restfulobjects.rendering.domainobjects.DomainObjectLinkTo;
import org.apache.isis.viewer.restfulobjects.rendering.domainobjects.DomainObjectReprRenderer;
import org.apache.isis.viewer.restfulobjects.rendering.domainobjects.JsonValueEncoder;
@@ -251,7 +252,7 @@ public final class DomainResourceHelper {
throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.METHOD_NOT_ALLOWED, "Method not allowed; action '%s' is not query only", action.getId());
}
- return invokeActionUsingAdapters(action, arguments);
+ return invokeActionUsingAdapters(action, arguments, SelfLink.INCLUDED);
}
Response invokeActionIdempotent(final String actionId, final JsonRepresentation arguments, Where where) {
@@ -262,16 +263,16 @@ public final class DomainResourceHelper {
if (!actionSemantics.isIdempotentInNature()) {
throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.METHOD_NOT_ALLOWED, "Method not allowed; action '%s' is not idempotent", action.getId());
}
- return invokeActionUsingAdapters(action, arguments);
+ return invokeActionUsingAdapters(action, arguments, SelfLink.EXCLUDED);
}
Response invokeAction(final String actionId, final JsonRepresentation arguments, Where where) {
final ObjectAction action = getObjectActionThatIsVisibleForIntent(actionId, Intent.MUTATE, where);
- return invokeActionUsingAdapters(action, arguments);
+ return invokeActionUsingAdapters(action, arguments, SelfLink.EXCLUDED);
}
- private Response invokeActionUsingAdapters(final ObjectAction action, final JsonRepresentation arguments) {
+ private Response invokeActionUsingAdapters(final ObjectAction action, final JsonRepresentation arguments, SelfLink selfLink) {
final List<ObjectAdapter> argAdapters = parseAndValidateArguments(action, arguments);
@@ -280,7 +281,7 @@ public final class DomainResourceHelper {
final ObjectAdapter returnedAdapter = action.execute(objectAdapter, argArray2);
// response (void)
- final ActionResultReprRenderer renderer = new ActionResultReprRenderer(resourceContext, null, JsonRepresentation.newMap());
+ final ActionResultReprRenderer renderer = new ActionResultReprRenderer(resourceContext, null, selfLink, JsonRepresentation.newMap());
renderer.with(new ObjectAndActionInvocation(objectAdapter, action, arguments, returnedAdapter)).using(adapterLinkTo);
http://git-wip-us.apache.org/repos/asf/isis/blob/82c7af43/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/Util.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/Util.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/Util.java
index f1fd706..6922169 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/Util.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/Util.java
@@ -21,7 +21,10 @@ package org.apache.isis.viewer.restfulobjects.tck;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
+import java.io.ByteArrayInputStream;
import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.Charset;
import javax.ws.rs.core.Response;
http://git-wip-us.apache.org/repos/asf/isis/blob/82c7af43/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_thenRepresentation_containsSelfLink_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_thenRepresentation_containsSelfLink_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_thenRepresentation_containsSelfLink_ok.java
new file mode 100644
index 0000000..8a639bc
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_thenRepresentation_containsSelfLink_ok.java
@@ -0,0 +1,98 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+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.endsWith;
+import static org.hamcrest.CoreMatchers.is;
+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.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.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.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_thenRepresentation_containsSelfLink_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", "findById");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+ final JsonRepresentation args =invokeLink.getArguments();
+
+ // when
+ args.mapPut("id.value", 1);
+
+ // when
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ // then
+ then(restfulResponse);
+ }
+
+
+
+ @Test
+ public void usingResourceProxy() throws Exception {
+
+ // given, when
+
+ JsonRepresentation args = JsonRepresentation.newMap();
+ args.mapPut("id.value", 1);
+
+ Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "findById", UrlEncodingUtils.urlEncode(args));
+ RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ // then
+ then(restfulResponse);
+ }
+
+ private void then(RestfulResponse<ActionResultRepresentation> restfulResponse) throws Exception {
+
+ final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
+
+ assertThat(actionResultRepr.getSelf(), isLink()
+ .rel(Rel.SELF)
+ .href(endsWith(":39393/services/ActionsEntities/actions/findById/invoke"))
+ .httpMethod(RestfulHttpMethod.GET)
+ .type(RepresentationType.ACTION_RESULT.getMediaType())
+ );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/82c7af43/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
deleted file mode 100644
index 0a7a054..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenRepresentation_ok.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.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/82c7af43/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenRepresentation_ok_andResponseHeaders_ContentType_andContentLength_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_andResponseHeaders_ContentType_andContentLength_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenRepresentation_ok_andResponseHeaders_ContentType_andContentLength_ok.java
new file mode 100644
index 0000000..5ac99c4
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenRepresentation_ok_andResponseHeaders_ContentType_andContentLength_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_andResponseHeaders_ContentType_andContentLength_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);
+ }
+
+ @Test
+ public void usingResourceProxy() throws Exception {
+
+ // given, when
+ Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "list", null);
+ RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ 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));
+ assertThat(restfulResponse.getHeader(Header.CONTENT_LENGTH), is(2245));
+
+ 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/82c7af43/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenResponseHeaders_ContentLength_ok_TODO.java
deleted file mode 100644
index 1f4d3a9..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenResponseHeaders_ContentLength_ok_TODO.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class Get_whenList_thenResponseHeaders_ContentLength_ok_TODO {
-
- @Ignore
- @Test
- public void todo() throws Exception {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/82c7af43/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenResponseHeaders_ContentType_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenResponseHeaders_ContentType_ok_TODO.java
deleted file mode 100644
index 2f2153d..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenResponseHeaders_ContentType_ok_TODO.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class Get_whenList_thenResponseHeaders_ContentType_ok_TODO {
-
- @Ignore
- @Test
- public void todo() throws Exception {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/82c7af43/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_isNotNull_thenRepresentation_ok_andResponseHeaders_ContentType_andContentLength_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_isNotNull_thenRepresentation_ok_andResponseHeaders_ContentType_andContentLength_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_isNotNull_thenRepresentation_ok_andResponseHeaders_ContentType_andContentLength_ok.java
new file mode 100644
index 0000000..92d5e58
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_isNotNull_thenRepresentation_ok_andResponseHeaders_ContentType_andContentLength_ok.java
@@ -0,0 +1,125 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
+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.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.hamcrest.CoreMatchers;
+import org.hamcrest.Description;
+import org.hamcrest.Matcher;
+import org.hamcrest.TypeSafeMatcher;
+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.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.DomainObjectRepresentation;
+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_whenObject_isNotNull_thenRepresentation_ok_andResponseHeaders_ContentType_andContentLength_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", "findById");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+ final JsonRepresentation args =invokeLink.getArguments();
+
+ // when
+ args.mapPut("id.value", 1);
+
+ // when
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ // then
+ then(restfulResponse);
+ }
+
+
+ @Test
+ public void usingResourceProxy() throws Exception {
+
+ // given, when
+
+ JsonRepresentation args = JsonRepresentation.newMap();
+ args.mapPut("id.value", 1);
+
+ Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "findById", UrlEncodingUtils.urlEncode(args));
+ RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ 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));
+ assertThat(restfulResponse.getHeader(Header.CONTENT_LENGTH), is(3335));
+
+ final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
+
+ assertThat(actionResultRepr.getResultType(), is(ResultType.DOMAIN_OBJECT));
+ final DomainObjectRepresentation objRepr = actionResultRepr.getResult().as(DomainObjectRepresentation.class);
+
+ assertThat(objRepr.getMembers(), is(not(nullValue())));
+ assertThat(objRepr.getMembers().size(), is(greaterThan(0)));
+
+ assertThat(objRepr.getTitle(), is(not(nullValue())));
+
+ assertThat(objRepr.getLinks(), is(not(nullValue())));
+ assertThat(objRepr.getMembers().size(), is(greaterThan(0)));
+
+ assertThat(objRepr.getExtensions(), is(not(nullValue())));
+ }
+
+ private static Matcher<Integer> greaterThan(final int i) {
+ return new TypeSafeMatcher<Integer>() {
+
+ @Override
+ public void describeTo(Description description) {
+ description.appendText("greater than " + i);
+ }
+
+ @Override
+ protected boolean matchesSafely(Integer item) {
+ return item > i;
+ }
+ };
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/82c7af43/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_isNull_thenRepresentation_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_isNull_thenRepresentation_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_isNull_thenRepresentation_ok.java
new file mode 100644
index 0000000..74a0633
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_isNull_thenRepresentation_ok.java
@@ -0,0 +1,97 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
+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.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.hamcrest.CoreMatchers;
+import org.hamcrest.Description;
+import org.hamcrest.Matcher;
+import org.hamcrest.TypeSafeMatcher;
+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.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.DomainObjectRepresentation;
+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_whenObject_isNull_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", "findById");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+ final JsonRepresentation args =invokeLink.getArguments();
+
+ // when
+ args.mapPut("id.value", 999);
+
+ // when
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ // then
+ then(restfulResponse);
+ }
+
+
+ @Test
+ public void usingResourceProxy() throws Exception {
+
+ // given, when
+
+ JsonRepresentation args = JsonRepresentation.newMap();
+ args.mapPut("id.value", 999);
+
+ Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "findById", UrlEncodingUtils.urlEncode(args));
+ RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ 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.DOMAIN_OBJECT));
+ assertThat(actionResultRepr.getResult(), is(nullValue()));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/82c7af43/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
deleted file mode 100644
index c86172c..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_thenRepresentation_ok_TODO.java
+++ /dev/null
@@ -1,13 +0,0 @@
-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/82c7af43/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_thenResponseHeaders_ContentLength_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_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_thenResponseHeaders_ContentLength_ok_TODO.java
deleted file mode 100644
index bb10774..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_thenResponseHeaders_ContentLength_ok_TODO.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class Get_whenObject_thenResponseHeaders_ContentLength_ok_TODO {
-
- @Ignore
- @Test
- public void todo() throws Exception {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/82c7af43/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_thenResponseHeaders_ContentType_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_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_thenResponseHeaders_ContentType_ok_TODO.java
deleted file mode 100644
index 18ead99..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_thenResponseHeaders_ContentType_ok_TODO.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class Get_whenObject_thenResponseHeaders_ContentType_ok_TODO {
-
- @Ignore
- @Test
- public void todo() throws Exception {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/82c7af43/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Post_thenRepresentation_doesNotContainSelfLink_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Post_thenRepresentation_doesNotContainSelfLink_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Post_thenRepresentation_doesNotContainSelfLink_ok.java
new file mode 100644
index 0000000..0e3b9ce
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Post_thenRepresentation_doesNotContainSelfLink_ok.java
@@ -0,0 +1,93 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+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.*;
+import static org.hamcrest.CoreMatchers.endsWith;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.ws.rs.core.Response;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+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.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.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.JsonNodeUtils;
+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_thenRepresentation_doesNotContainSelfLink_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", "findByIdNotIdempotent");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+ final JsonRepresentation args =invokeLink.getArguments();
+
+ // when
+ args.mapPut("id.value", 1);
+
+ // when
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ // then
+ then(restfulResponse);
+ }
+
+
+
+ @Test
+ public void usingResourceProxy() throws Exception {
+
+ // given, when
+ final JsonRepresentation args = JsonRepresentation.newMap();
+ args.mapPut("id.value", 1);
+
+ final Response response = serviceResource.invokeAction("ActionsEntities", "findByIdNotIdempotent", JsonNodeUtils.asInputStream(args));
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ // then
+ then(restfulResponse);
+
+ }
+
+ private void then(RestfulResponse<ActionResultRepresentation> restfulResponse) throws Exception {
+ final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
+ assertThat(actionResultRepr.mapHas("links[rel=self]"), is(false));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/82c7af43/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Put_thenRepresentation_doesNotContainSelfLink_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Put_thenRepresentation_doesNotContainSelfLink_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Put_thenRepresentation_doesNotContainSelfLink_ok.java
new file mode 100644
index 0000000..70f09d2
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Put_thenRepresentation_doesNotContainSelfLink_ok.java
@@ -0,0 +1,93 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+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.*;
+import static org.hamcrest.CoreMatchers.endsWith;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.ws.rs.core.Response;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+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.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.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.JsonNodeUtils;
+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_thenRepresentation_doesNotContainSelfLink_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", "findByIdIdempotent");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+ final JsonRepresentation args =invokeLink.getArguments();
+
+ // when
+ args.mapPut("id.value", 1);
+
+ // when
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink, args);
+
+ // then
+ then(restfulResponse);
+ }
+
+
+
+ @Test
+ public void usingResourceProxy() throws Exception {
+
+ // given, when
+ final JsonRepresentation args = JsonRepresentation.newMap();
+ args.mapPut("id.value", 1);
+
+ final Response response = serviceResource.invokeActionIdempotent("ActionsEntities", "findByIdIdempotent", JsonNodeUtils.asInputStream(args));
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ // then
+ then(restfulResponse);
+
+ }
+
+ private void then(RestfulResponse<ActionResultRepresentation> restfulResponse) throws Exception {
+ final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
+ assertThat(actionResultRepr.getSelf(), is(nullValue()));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/82c7af43/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java
----------------------------------------------------------------------
diff --git a/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java
index 676f04b..65c07f7 100644
--- a/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java
+++ b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java
@@ -28,8 +28,6 @@ import org.apache.isis.applib.annotation.MustSatisfy;
import org.apache.isis.applib.annotation.Named;
import org.apache.isis.applib.annotation.ObjectType;
import org.apache.isis.applib.annotation.Optional;
-import org.apache.isis.applib.query.Query;
-import org.apache.isis.applib.query.QueryDefault;
import org.apache.isis.applib.spec.Specification;
import org.apache.isis.core.tck.dom.AbstractEntityRepository;
@@ -44,9 +42,24 @@ public class ActionsEntityRepository extends AbstractEntityRepository<ActionsEnt
@ActionSemantics(Of.SAFE)
@MemberOrder(sequence = "1")
public ActionsEntity findById(@Named("id") int id) {
- final Query<ActionsEntity> query =
- new QueryDefault<ActionsEntity>(ActionsEntity.class, ActionsEntity.class.getName() + "#pk", "id", id);
- return this.firstMatch(query);
+ return findByIdIfAny(id);
+ }
+
+ @ActionSemantics(Of.IDEMPOTENT)
+ @MemberOrder(sequence = "1")
+ public ActionsEntity findByIdIdempotent(@Named("id") int id) {
+ return findByIdIfAny(id);
+ }
+
+ @ActionSemantics(Of.NON_IDEMPOTENT)
+ @MemberOrder(sequence = "1")
+ public ActionsEntity findByIdNotIdempotent(@Named("id") int id) {
+ return findByIdIfAny(id);
+ }
+
+ private ActionsEntity findByIdIfAny(int id) {
+ List<ActionsEntity> subList = subList(id, id+1);
+ return subList.isEmpty()?null:subList.get(0);
}
@ActionSemantics(Of.SAFE)
[11/50] [abbrv] ISIS-233-ro: more on domainservice.serviceId
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/5e01f688/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
new file mode 100644
index 0000000..5626aa7
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_invoke_TOREFACTOR.java
@@ -0,0 +1,265 @@
+/*
+ * 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 {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+
+ resource = client.getDomainServiceResource();
+ }
+
+ @Ignore("TODO - fix broken test resulting from introduction of actionresult repr")
+ @Test
+ public void invokeQueryOnly_noArg_usingClientFollow() throws Exception {
+
+ // given
+ final JsonRepresentation givenAction = givenAction("simples", "list");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ // when
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+
+ // then
+ assertThat(invokeLink, is(not(nullValue())));
+ final RestfulResponse<ListRepresentation> restfulResponse = client.followT(invokeLink);
+ final ListRepresentation listRepr = restfulResponse.getEntity();
+
+ assertThat(listRepr.getValue().size(), is(5));
+ }
+
+ @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/5e01f688/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
new file mode 100644
index 0000000..5a2b8d1
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_req_queryarg_xrovalidateonly.java
@@ -0,0 +1,20 @@
+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/5e01f688/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
new file mode 100644
index 0000000..a7c1d82
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_resp_representation_of_List.java
@@ -0,0 +1,13 @@
+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/5e01f688/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
new file mode 100644
index 0000000..9827629
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_resp_representation_of_Object.java
@@ -0,0 +1,13 @@
+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/5e01f688/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
new file mode 100644
index 0000000..b0586db
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_resp_representation_of_Scalar.java
@@ -0,0 +1,13 @@
+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/5e01f688/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
new file mode 100644
index 0000000..304a536
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_resp_representation_of_Void.java
@@ -0,0 +1,13 @@
+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/5e01f688/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
new file mode 100644
index 0000000..a77b9f6
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_resp_throwsError.java
@@ -0,0 +1,13 @@
+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/5e01f688/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
new file mode 100644
index 0000000..efe7665
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_when_created_new_object.java
@@ -0,0 +1,14 @@
+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/5e01f688/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
new file mode 100644
index 0000000..53bdb35
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/zzztodo/domainservice/actioninvoke/DomainServiceTest_when_is_forbidden.java
@@ -0,0 +1,13 @@
+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)
+ }
+}
[32/50] [abbrv] ISIS-233: adding new test stubs (TODOs)
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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"));
- }
-
-
-
-}
[36/50] [abbrv] ISIS-233: adding new test stubs (TODOs)
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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
+ }
+
+}
[50/50] [abbrv] git commit: ISIS-233: fix for 404 tests.
Posted by da...@apache.org.
ISIS-233: fix for 404 tests.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/f0526cdf
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/f0526cdf
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/f0526cdf
Branch: refs/heads/master
Commit: f0526cdfe3ea57730f3a8ba56aa11e4daf971032
Parents: de41535
Author: Dan Haywood <da...@apache.org>
Authored: Sat Apr 27 19:30:44 2013 +0100
Committer: Dan Haywood <da...@apache.org>
Committed: Sat Apr 27 19:30:44 2013 +0100
----------------------------------------------------------------------
.../restfulobjects/server/util/OidUtils.java | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/f0526cdf/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/util/OidUtils.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/util/OidUtils.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/util/OidUtils.java
index c10424b..e691865 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/util/OidUtils.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/util/OidUtils.java
@@ -89,7 +89,6 @@ public final class OidUtils {
private static ObjectAdapter getObjectAdapterForUnencodedElseThrowNotFound(final RendererContext resourceContext, final String oidStr) {
final RootOid rootOid = RootOidDefault.deStringEncoded(oidStr, getOidMarshaller());
- //return resourceContext.getAdapterManager().adapterFor(rootOid);
return resourceContext.getPersistenceSession().loadObject(rootOid);
}
[31/50] [abbrv] ISIS-233: adding new test stubs (TODOs)
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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 {
+
+ }
+
+
+}
[04/50] [abbrv] git commit: ISIS-233: more on user, version,
services list
Posted by da...@apache.org.
ISIS-233: more on user, version, services list
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/5491a130
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/5491a130
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/5491a130
Branch: refs/heads/master
Commit: 5491a130ee0dcf4e8d88c11a5576a17723b4a768
Parents: 438b450
Author: Dan Haywood <da...@apache.org>
Authored: Wed Feb 20 22:56:40 2013 +0000
Committer: Dan Haywood <da...@apache.org>
Committed: Sat Apr 27 18:57:25 2013 +0100
----------------------------------------------------------------------
.../restfulobjects/applib/JsonRepresentation.java | 6 +-
.../AbstractDomainObjectRepresentation.java | 54 ------
.../domainobjects/DomainObjectRepresentation.java | 38 ++++-
.../applib/domainobjects/DomainRepresentation.java | 8 +-
.../applib/domainobjects/ListRepresentation.java | 12 +-
.../TransientDomainObjectRepresentation.java | 34 ----
.../applib/user/UserRepresentation.java | 4 +-
.../applib/version/VersionRepresentation.java | 4 +-
.../rendering/ReprRendererAbstract.java | 4 -
.../AbstractObjectMemberReprRenderer.java | 4 +-
.../domainobjects/DomainObjectReprRenderer.java | 4 +-
.../DomainServicesListReprRenderer.java | 54 ++++++
.../resources/DomainServiceResourceServerside.java | 4 +-
.../server/resources/HomePageReprRenderer.java | 10 +-
.../server/resources/UserReprRenderer.java | 34 +++-
.../server/resources/VersionReprRenderer.java | 28 +++-
.../restfulobjects/tck/RepresentationMatchers.java | 69 ++++++--
...Test_serverSideException_exceptionHandling.java | 72 ++++++++
...nServiceResourceTest_services_acceptHeader.java | 106 +++++++++++
...erviceResourceTest_services_representation.java | 137 +++++++++++++++
...rviceResourceTest_services_responseHeaders.java | 82 +++++++++
...erviceResourceTest_services_xrofollowlinks.java | 122 +++++++++++++
...Test_serverSideException_exceptionHandling.java | 72 --------
.../home/HomePageResourceTest_acceptHeader.java | 106 +++++++++++
.../home/HomePageResourceTest_get_accept.java | 107 -----------
.../home/HomePageResourceTest_representation.java | 111 ++++++++++++
.../home/HomePageResourceTest_responseHeaders.java | 79 +++++++++
...ePageResourceTest_templated_representation.java | 123 -------------
...PageResourceTest_templated_responseHeaders.java | 95 ----------
.../home/HomePageResourceTest_xrofollowlinks.java | 28 ++-
.../DomainServiceResourceTest_invokeAction.java | 4 +-
.../DomainServiceResourceTest_services_accept.java | 79 ---------
...urceTest_services_representationAndHeaders.java | 128 --------------
...erviceResourceTest_services_xrofollowlinks.java | 80 ---------
.../user/UserResourceTest_acceptHeader.java | 105 +++++++++++
.../user/UserResourceTest_get_accept.java | 107 -----------
.../user/UserResourceTest_representation.java | 104 +++++++++++
.../user/UserResourceTest_responseHeaders.java | 96 ++++++++++
.../UserResourceTest_templated_representation.java | 104 -----------
...UserResourceTest_templated_responseHeaders.java | 96 ----------
.../user/UserResourceTest_xrofollowlinks.java | 92 ++++++++++
.../version/VersionResourceTest_acceptHeader.java | 110 ++++++++++++
.../version/VersionResourceTest_get_accept.java | 111 ------------
.../VersionResourceTest_representation.java | 113 ++++++++++++
.../VersionResourceTest_responseHeaders.java | 82 +++++++++
...rsionResourceTest_templated_representation.java | 125 -------------
...sionResourceTest_templated_responseHeaders.java | 82 ---------
.../VersionResourceTest_xrofollowlinks.java | 88 +++++++++
48 files changed, 1867 insertions(+), 1450 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java
index c3e8fb0..1efc2ea 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java
@@ -52,10 +52,14 @@ import com.google.common.collect.Maps;
*/
public class JsonRepresentation {
- public interface LinksToSelf {
+ public interface HasLinkToSelf {
public LinkRepresentation getSelf();
}
+ public interface HasLinkToUp {
+ public LinkRepresentation getUp();
+ }
+
public interface HasLinks {
public JsonRepresentation getLinks();
}
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/AbstractDomainObjectRepresentation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/AbstractDomainObjectRepresentation.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/AbstractDomainObjectRepresentation.java
deleted file mode 100644
index 24de931..0000000
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/AbstractDomainObjectRepresentation.java
+++ /dev/null
@@ -1,54 +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.applib.domainobjects;
-
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.codehaus.jackson.JsonNode;
-
-public abstract class AbstractDomainObjectRepresentation extends DomainRepresentation {
-
- public AbstractDomainObjectRepresentation(final JsonNode jsonNode) {
- super(jsonNode);
- }
-
- public String getTitle() {
- return getString("title");
- }
-
- public JsonRepresentation getMembers() {
- return getRepresentation("members").ensureArray();
- }
-
- public JsonRepresentation getProperty(final String id) {
- return getRepresentation("members[memberType=property id=%s]", id);
- }
-
- public JsonRepresentation getProperties() {
- return getRepresentation("members[memberType=property]").ensureArray();
- }
-
- public JsonRepresentation getCollection(final String id) {
- return getRepresentation("members[memberType=collection id=%s]", id);
- }
-
- public JsonRepresentation getCollections() {
- return getRepresentation("members[memberType=collection]").ensureArray();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectRepresentation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectRepresentation.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectRepresentation.java
index f32b0e3..98e714f 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectRepresentation.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectRepresentation.java
@@ -19,18 +19,47 @@
package org.apache.isis.viewer.restfulobjects.applib.domainobjects;
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.codehaus.jackson.JsonNode;
-public class DomainObjectRepresentation extends AbstractDomainObjectRepresentation {
+public class DomainObjectRepresentation extends DomainRepresentation {
public DomainObjectRepresentation(final JsonNode jsonNode) {
super(jsonNode);
}
+ public String getTitle() {
+ return getString("title");
+ }
+
+ /**
+ * Only for persistent or addressable objects
+ */
public String getOid() {
return getString("oid");
}
+ public JsonRepresentation getMembers() {
+ return getRepresentation("members").ensureArray();
+ }
+
+ public JsonRepresentation getProperty(final String id) {
+ return getRepresentation("members[memberType=property id=%s]", id);
+ }
+
+ public JsonRepresentation getProperties() {
+ return getRepresentation("members[memberType=property]").ensureArray();
+ }
+
+ public JsonRepresentation getCollection(final String id) {
+ return getRepresentation("members[memberType=collection id=%s]", id);
+ }
+
+ public JsonRepresentation getCollections() {
+ return getRepresentation("members[memberType=collection]").ensureArray();
+ }
+
public JsonRepresentation getActions() {
return getRepresentation("members[memberType=action]");
}
@@ -39,4 +68,11 @@ public class DomainObjectRepresentation extends AbstractDomainObjectRepresentati
return getRepresentation("members[memberType=action id=%s]", id);
}
+ /**
+ * Only for transient, persistable, objects
+ */
+ public LinkRepresentation getPersistLink() {
+ return getLinkWithRel(Rel.PERSIST);
+ }
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainRepresentation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainRepresentation.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainRepresentation.java
index 784ffde..31b81e1 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainRepresentation.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainRepresentation.java
@@ -19,14 +19,14 @@
package org.apache.isis.viewer.restfulobjects.applib.domainobjects;
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.JsonRepresentation.HasExtensions;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation.HasLinkToSelf;
import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation.HasLinks;
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation.LinksToSelf;
+import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
import org.codehaus.jackson.JsonNode;
-public abstract class DomainRepresentation extends JsonRepresentation implements LinksToSelf, HasLinks, HasExtensions {
+public abstract class DomainRepresentation extends JsonRepresentation implements HasLinkToSelf, HasLinks, HasExtensions {
public DomainRepresentation(final JsonNode jsonNode) {
super(jsonNode);
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/ListRepresentation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/ListRepresentation.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/ListRepresentation.java
index 51d4ef1..cf82860 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/ListRepresentation.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/ListRepresentation.java
@@ -19,16 +19,24 @@
package org.apache.isis.viewer.restfulobjects.applib.domainobjects;
import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation.HasLinkToUp;
+import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
import org.codehaus.jackson.JsonNode;
-public class ListRepresentation extends DomainRepresentation {
+public class ListRepresentation extends DomainRepresentation implements HasLinkToUp {
public ListRepresentation(final JsonNode jsonNode) {
super(jsonNode);
}
- public JsonRepresentation getValues() {
+ public JsonRepresentation getValue() {
return getArray("value").ensureArray();
}
+ @Override
+ public LinkRepresentation getUp() {
+ return getLinkWithRel(Rel.UP);
+ }
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/TransientDomainObjectRepresentation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/TransientDomainObjectRepresentation.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/TransientDomainObjectRepresentation.java
deleted file mode 100644
index b23f119..0000000
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/TransientDomainObjectRepresentation.java
+++ /dev/null
@@ -1,34 +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.applib.domainobjects;
-
-import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
-import org.codehaus.jackson.JsonNode;
-
-public class TransientDomainObjectRepresentation extends AbstractDomainObjectRepresentation {
-
- public TransientDomainObjectRepresentation(final JsonNode jsonNode) {
- super(jsonNode);
- }
-
- public LinkRepresentation getPersistLink() {
- return getLink("links[rel=persist]");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/user/UserRepresentation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/user/UserRepresentation.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/user/UserRepresentation.java
index 6fb5906..6a280d4 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/user/UserRepresentation.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/user/UserRepresentation.java
@@ -19,17 +19,19 @@
package org.apache.isis.viewer.restfulobjects.applib.user;
import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation.HasLinkToUp;
import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
import org.apache.isis.viewer.restfulobjects.applib.Rel;
import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainRepresentation;
import org.codehaus.jackson.JsonNode;
-public class UserRepresentation extends DomainRepresentation {
+public class UserRepresentation extends DomainRepresentation implements HasLinkToUp {
public UserRepresentation(final JsonNode jsonNode) {
super(jsonNode);
}
+ @Override
public LinkRepresentation getUp() {
return getLinkWithRel(Rel.UP);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/version/VersionRepresentation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/version/VersionRepresentation.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/version/VersionRepresentation.java
index a0f4792..fa49124 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/version/VersionRepresentation.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/version/VersionRepresentation.java
@@ -19,17 +19,19 @@
package org.apache.isis.viewer.restfulobjects.applib.version;
import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation.HasLinkToUp;
import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
import org.apache.isis.viewer.restfulobjects.applib.Rel;
import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainRepresentation;
import org.codehaus.jackson.JsonNode;
-public class VersionRepresentation extends DomainRepresentation {
+public class VersionRepresentation extends DomainRepresentation implements HasLinkToUp {
public VersionRepresentation(final JsonNode jsonNode) {
super(jsonNode);
}
+ @Override
public LinkRepresentation getUp() {
return getLinkWithRel(Rel.UP);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/ReprRendererAbstract.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/ReprRendererAbstract.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/ReprRendererAbstract.java
index 171113d..fe57485 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/ReprRendererAbstract.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/ReprRendererAbstract.java
@@ -167,10 +167,6 @@ public abstract class ReprRendererAbstract<R extends ReprRendererAbstract<R, T>,
return IsisContext.getPersistenceSession().getServices();
}
- protected AuthenticationSession getAuthenticationSession() {
- return IsisContext.getAuthenticationSession();
- }
-
protected UpdateNotifier getUpdateNotifier() {
return IsisContext.getCurrentTransaction().getUpdateNotifier();
}
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/AbstractObjectMemberReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/AbstractObjectMemberReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/AbstractObjectMemberReprRenderer.java
index d15ce72..d824d6a 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/AbstractObjectMemberReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/AbstractObjectMemberReprRenderer.java
@@ -247,11 +247,11 @@ public abstract class AbstractObjectMemberReprRenderer<R extends ReprRendererAbs
}
protected Consent usability() {
- return objectMember.isUsable(getAuthenticationSession(), objectAdapter, where);
+ return objectMember.isUsable(getRendererContext().getAuthenticationSession(), objectAdapter, where);
}
protected Consent visibility() {
- return objectMember.isVisible(getAuthenticationSession(), objectAdapter, where);
+ return objectMember.isVisible(getRendererContext().getAuthenticationSession(), objectAdapter, where);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java
index 737e5f8..65aef76 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java
@@ -188,7 +188,7 @@ public class DomainObjectReprRenderer extends ReprRendererAbstract<DomainObjectR
for (final ObjectAssociation assoc : associations) {
if (mode.checkVisibility()) {
- final Consent visibility = assoc.isVisible(getAuthenticationSession(), objectAdapter, rendererContext.getWhere());
+ final Consent visibility = assoc.isVisible(getRendererContext().getAuthenticationSession(), objectAdapter, rendererContext.getWhere());
if (!visibility.isAllowed()) {
continue;
}
@@ -226,7 +226,7 @@ public class DomainObjectReprRenderer extends ReprRendererAbstract<DomainObjectR
private void addActions(final ObjectAdapter objectAdapter, final List<ObjectAction> actions, final JsonRepresentation members) {
final LinkFollowSpecs linkFollower = getLinkFollowSpecs().follow("members");
for (final ObjectAction action : actions) {
- final Consent visibility = action.isVisible(getAuthenticationSession(), objectAdapter, rendererContext.getWhere());
+ final Consent visibility = action.isVisible(getRendererContext().getAuthenticationSession(), objectAdapter, rendererContext.getWhere());
if (!visibility.isAllowed()) {
continue;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainServicesListReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainServicesListReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainServicesListReprRenderer.java
new file mode 100644
index 0000000..2cf08ae
--- /dev/null
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainServicesListReprRenderer.java
@@ -0,0 +1,54 @@
+/**
+ * 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.rendering.domainobjects;
+
+import java.util.Collection;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+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.rendering.LinkFollowSpecs;
+import org.apache.isis.viewer.restfulobjects.rendering.RendererContext;
+import org.apache.isis.viewer.restfulobjects.rendering.ReprRendererAbstract;
+
+public class DomainServicesListReprRenderer extends ListReprRenderer {
+
+ private ObjectAdapterLinkTo linkTo;
+ private Collection<ObjectAdapter> objectAdapters;
+ private ObjectSpecification elementType;
+ private ObjectSpecification returnType;
+
+ public DomainServicesListReprRenderer(final RendererContext resourceContext, final LinkFollowSpecs linkFollower, final JsonRepresentation representation) {
+ super(resourceContext, linkFollower, representation);
+ }
+
+ @Override
+ public JsonRepresentation render() {
+ super.render();
+
+ addLink(Rel.RETURN_TYPE, returnType);
+ addLink(Rel.ELEMENT_TYPE, elementType);
+
+ getExtensions();
+
+ return representation;
+ }
+
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java
index 8132967..c537b7b 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java
@@ -54,7 +54,9 @@ public class DomainServiceResourceServerside extends ResourceAbstract implements
final List<ObjectAdapter> serviceAdapters = getResourceContext().getServiceAdapters();
final ListReprRenderer renderer = new ListReprRenderer(getResourceContext(), null, JsonRepresentation.newMap());
- renderer.usingLinkToBuilder(new DomainServiceLinkTo()).withLink(Rel.SELF, "services").with(serviceAdapters);
+ renderer.usingLinkToBuilder(new DomainServiceLinkTo())
+ .withLink(Rel.SELF, "services")
+ .with(serviceAdapters);
return responseOfOk(renderer, Caching.ONE_DAY).build();
}
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/HomePageReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/HomePageReprRenderer.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/HomePageReprRenderer.java
index 09eafb3..c003792 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/HomePageReprRenderer.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/HomePageReprRenderer.java
@@ -52,7 +52,7 @@ public class HomePageReprRenderer extends ReprRendererAbstract<HomePageReprRende
// self
if (includesSelf) {
- addLinkToSelf(representation);
+ addLinkToSelf();
}
addLinkToUser(getRendererContext().getAuthenticationSession());
@@ -66,10 +66,10 @@ public class HomePageReprRenderer extends ReprRendererAbstract<HomePageReprRende
return representation;
}
- private void addLinkToSelf(final JsonRepresentation representation) {
- final JsonRepresentation link = LinkBuilder.newBuilder(rendererContext, Rel.SELF.getName(), getRepresentationType(), "").build();
+ private void addLinkToSelf() {
+ final JsonRepresentation link = LinkBuilder.newBuilder(rendererContext, Rel.SELF.getName(), RepresentationType.HOME_PAGE, "").build();
- final LinkFollowSpecs linkFollower = getLinkFollowSpecs().follow("links[rel=" + Rel.SELF.getName() + "]");
+ final LinkFollowSpecs linkFollower = getLinkFollowSpecs().follow("links");
if (linkFollower.matches(link)) {
final HomePageReprRenderer renderer = new HomePageReprRenderer(getRendererContext(), linkFollower, JsonRepresentation.newMap());
link.mapPut("value", renderer.render());
@@ -80,7 +80,7 @@ public class HomePageReprRenderer extends ReprRendererAbstract<HomePageReprRende
private void addLinkToVersion() {
final JsonRepresentation link = LinkBuilder.newBuilder(getRendererContext(), Rel.VERSION.getName(), RepresentationType.VERSION, "version").build();
- final LinkFollowSpecs linkFollower = getLinkFollowSpecs().follow("links[rel=" + Rel.VERSION.getName() + "]");
+ final LinkFollowSpecs linkFollower = getLinkFollowSpecs().follow("links");
if (linkFollower.matches(link)) {
final VersionReprRenderer renderer = new VersionReprRenderer(getRendererContext(), linkFollower, JsonRepresentation.newMap());
link.mapPut("value", renderer.render());
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/UserReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/UserReprRenderer.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/UserReprRenderer.java
index ea3cf1e..6cd15bd 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/UserReprRenderer.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/UserReprRenderer.java
@@ -20,14 +20,15 @@ import org.apache.isis.core.commons.authentication.AuthenticationSession;
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.rendering.LinkBuilder;
import org.apache.isis.viewer.restfulobjects.rendering.LinkFollowSpecs;
import org.apache.isis.viewer.restfulobjects.rendering.RendererContext;
import org.apache.isis.viewer.restfulobjects.rendering.ReprRendererAbstract;
public class UserReprRenderer extends ReprRendererAbstract<UserReprRenderer, AuthenticationSession> {
- UserReprRenderer(final RendererContext resourceContext, final LinkFollowSpecs linkFollower, final JsonRepresentation representation) {
- super(resourceContext, linkFollower, RepresentationType.USER, representation);
+ UserReprRenderer(final RendererContext rendererContext, final LinkFollowSpecs linkFollower, final JsonRepresentation representation) {
+ super(rendererContext, linkFollower, RepresentationType.USER, representation);
}
@Override
@@ -44,11 +45,36 @@ public class UserReprRenderer extends ReprRendererAbstract<UserReprRenderer, Aut
@Override
public JsonRepresentation render() {
if (includesSelf) {
- withLink(Rel.SELF, "user");
- withLink(Rel.UP, "");
+ addLinkToSelf();
+ addLinkToUp();
}
getExtensions();
return representation;
}
+ private void addLinkToSelf() {
+ final JsonRepresentation link = LinkBuilder.newBuilder(getRendererContext(), Rel.SELF.getName(), RepresentationType.USER, "user").build();
+
+ final LinkFollowSpecs linkFollower = getLinkFollowSpecs().follow("links");
+ if (linkFollower.matches(link)) {
+ final UserReprRenderer renderer = new UserReprRenderer(getRendererContext(), linkFollower, JsonRepresentation.newMap());
+ renderer.with(getRendererContext().getAuthenticationSession());
+ link.mapPut("value", renderer.render());
+ }
+
+ getLinks().arrayAdd(link);
+ }
+
+ private void addLinkToUp() {
+ final JsonRepresentation link = LinkBuilder.newBuilder(rendererContext, Rel.UP.getName(), RepresentationType.HOME_PAGE, "").build();
+
+ final LinkFollowSpecs linkFollower = getLinkFollowSpecs().follow("links");
+ if (linkFollower.matches(link)) {
+ final HomePageReprRenderer renderer = new HomePageReprRenderer(getRendererContext(), linkFollower, JsonRepresentation.newMap());
+ link.mapPut("value", renderer.render());
+ }
+ getLinks().arrayAdd(link);
+ }
+
+
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/VersionReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/VersionReprRenderer.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/VersionReprRenderer.java
index f917698..425e332 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/VersionReprRenderer.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/VersionReprRenderer.java
@@ -25,6 +25,7 @@ import java.util.Properties;
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.rendering.LinkBuilder;
import org.apache.isis.viewer.restfulobjects.rendering.LinkFollowSpecs;
import org.apache.isis.viewer.restfulobjects.rendering.RendererContext;
import org.apache.isis.viewer.restfulobjects.rendering.ReprRendererAbstract;
@@ -49,8 +50,8 @@ public class VersionReprRenderer extends ReprRendererAbstract<VersionReprRendere
public JsonRepresentation render() {
if (includesSelf) {
- withLink(Rel.SELF, "version");
- withLink(Rel.UP, "");
+ addLinkToSelf();
+ addLinkToUp();
}
representation.mapPut("specVersion", RestfulObjectsApplication.SPEC_VERSION);
@@ -62,6 +63,29 @@ public class VersionReprRenderer extends ReprRendererAbstract<VersionReprRendere
return representation;
}
+ private void addLinkToSelf() {
+ final JsonRepresentation link = LinkBuilder.newBuilder(getRendererContext(), Rel.SELF.getName(), RepresentationType.VERSION, "version").build();
+
+ final LinkFollowSpecs linkFollower = getLinkFollowSpecs().follow("links");
+ if (linkFollower.matches(link)) {
+ final VersionReprRenderer renderer = new VersionReprRenderer(getRendererContext(), linkFollower, JsonRepresentation.newMap());
+ link.mapPut("value", renderer.render());
+ }
+
+ getLinks().arrayAdd(link);
+ }
+
+ private void addLinkToUp() {
+ final JsonRepresentation link = LinkBuilder.newBuilder(rendererContext, Rel.UP.getName(), RepresentationType.HOME_PAGE, "").build();
+
+ final LinkFollowSpecs linkFollower = getLinkFollowSpecs().follow("links");
+ if (linkFollower.matches(link)) {
+ final HomePageReprRenderer renderer = new HomePageReprRenderer(getRendererContext(), linkFollower, JsonRepresentation.newMap());
+ link.mapPut("value", renderer.render());
+ }
+ getLinks().arrayAdd(link);
+ }
+
private static String versionFromManifest() {
try {
URL resource = Resources.getResource(META_INF_POM_PROPERTIES);
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/RepresentationMatchers.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/RepresentationMatchers.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/RepresentationMatchers.java
index 46332a5..117dc1f 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/RepresentationMatchers.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/RepresentationMatchers.java
@@ -18,6 +18,8 @@
*/
package org.apache.isis.viewer.restfulobjects.tck;
+import java.io.IOException;
+
import javax.ws.rs.core.CacheControl;
import javax.ws.rs.core.MediaType;
@@ -32,10 +34,13 @@ 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.JsonRepresentation.LinksToSelf;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation.HasLinkToSelf;
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.tck.RepresentationMatchers.AbstractMatcherBuilder;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
public class RepresentationMatchers {
@@ -109,7 +114,7 @@ public class RepresentationMatchers {
@Override
public boolean matchesSafely(final T item) {
- final LinksToSelf initialRepr = (LinksToSelf) item; // no easy
+ final HasLinkToSelf initialRepr = (HasLinkToSelf) item; // no easy
// way to do
// this with
// Hamcrest
@@ -119,7 +124,7 @@ public class RepresentationMatchers {
// then
final T repr2 = followedResp.getEntity();
- final LinksToSelf repr2AsLinksToSelf = (LinksToSelf) repr2;
+ final HasLinkToSelf repr2AsLinksToSelf = (HasLinkToSelf) repr2;
return initialRepr.getSelf().equals(repr2AsLinksToSelf.getSelf());
} catch (final Exception e) {
throw new RuntimeException(e);
@@ -159,12 +164,14 @@ public class RepresentationMatchers {
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 LinkMatcherBuilder(final RestfulClient client) {
super(client);
@@ -180,13 +187,18 @@ public class RepresentationMatchers {
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> methodMatcher) {
- this.hrefMatcher = methodMatcher;
+ public LinkMatcherBuilder href(final Matcher<String> hrefMatcher) {
+ this.hrefMatcher = hrefMatcher;
return this;
}
@@ -227,6 +239,11 @@ public class RepresentationMatchers {
return this;
}
+ public LinkMatcherBuilder responseEntityWithSelfHref(String selfHref) {
+ this.selfHref = selfHref;
+ return this;
+ }
+
@Override
public Matcher<JsonRepresentation> build() {
return new TypeSafeMatcher<JsonRepresentation>() {
@@ -263,16 +280,20 @@ public class RepresentationMatchers {
}
// trigger link being followed
- if (statusCode != null) {
+ if (statusCode != null || selfHref != null) {
if (client == null) {
throw new IllegalStateException("require client in order to assert on statusCode");
}
- description.appendText(" that when followed returns status " + statusCode);
- }
-
- // assertions on response
- if (statusCode != null) {
- description.appendText(" returns ").appendValue(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(" an response whose self.href is " + selfHref);
+ }
}
}
@@ -285,6 +306,9 @@ public class RepresentationMatchers {
if (rel != null && !rel.equals(link.getRel())) {
return false;
}
+ if (relNameMatcher != null && !relNameMatcher.matches(link.getHref())) {
+ return false;
+ }
if (href != null && !href.equals(link.getHref())) {
return false;
}
@@ -313,7 +337,7 @@ public class RepresentationMatchers {
// follow link if criteria require it
RestfulResponse<JsonRepresentation> jsonResp = null;
- if (statusCode != null) {
+ if (statusCode != null || selfHref != null) {
if (client == null) {
return false;
}
@@ -330,12 +354,31 @@ public class RepresentationMatchers {
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("self");
+ if(selfLink == null) {
+ return false;
+ }
+ if (!selfLink.getHref().equals(selfHref)) {
+ return false;
+ }
+ }
return true;
}
};
}
+
}
public static EntryMatcherBuilder entry(final String key) {
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/AnyResourceTest_serverSideException_exceptionHandling.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/AnyResourceTest_serverSideException_exceptionHandling.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/AnyResourceTest_serverSideException_exceptionHandling.java
new file mode 100644
index 0000000..8aa79ff
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/AnyResourceTest_serverSideException_exceptionHandling.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.resources;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.MediaType;
+
+import org.jboss.resteasy.client.ClientRequest;
+import org.jboss.resteasy.client.ClientResponse;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.Header;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.util.Parser;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+public class AnyResourceTest_serverSideException_exceptionHandling {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ }
+
+ @Test
+ public void runtimeException_isMapped() throws Exception {
+
+ // given
+ final RestfulRequest restfulReq = client.createRequest(RestfulHttpMethod.GET, "version");
+ final Header<Boolean> header = new Header<Boolean>("X-FAIL", Parser.forBoolean());
+ restfulReq.withHeader(header, true);
+
+ // when
+ final RestfulResponse<JsonRepresentation> jsonResp = restfulReq.execute();
+
+ // then
+ assertThat(jsonResp.getStatus(), is(HttpStatusCode.METHOD_FAILURE));
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_acceptHeader.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_acceptHeader.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_acceptHeader.java
new file mode 100644
index 0000000..c62e641
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_acceptHeader.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.resources.domainService;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.user.UserRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.jboss.resteasy.client.ClientRequest;
+import org.jboss.resteasy.client.ClientResponse;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class DomainServiceResourceTest_services_acceptHeader {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+ private RestfulRequest request;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+ request = client.createRequest(RestfulHttpMethod.GET, "services");
+ }
+
+ @Test
+ public void applicationJson_noProfile_returns200() throws Exception {
+
+ request.withHeader(RestfulRequest.Header.ACCEPT, MediaType.APPLICATION_JSON_TYPE);
+ final RestfulResponse<ListRepresentation> restfulResponse = request.executeT();
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+ assertThat(restfulResponse.getHeader(RestfulResponse.Header.CONTENT_TYPE), is(RepresentationType.LIST.getMediaType()));
+ }
+
+ @Test
+ public void applicationJson_profileList_returns200() throws Exception {
+
+ request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.LIST.getMediaType());
+ final RestfulResponse<ListRepresentation> restfulResponse = request.executeT();
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+ }
+
+ @Test
+ public void missingHeader_returns200() throws Exception {
+
+ final RestfulResponse<ListRepresentation> restfulResp = request.executeT();
+
+ assertThat(restfulResp.getStatus(), is(HttpStatusCode.OK));
+ }
+
+ @Test
+ public void applicationJson_profileIncorrect_returns406() throws Exception {
+
+ request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.VERSION.getMediaType());
+ final RestfulResponse<ListRepresentation> restfulResponse = request.executeT();
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
+ }
+
+ @Test
+ public void incorrectMediaType_returnsNotAcceptable() throws Exception {
+
+ // given
+ final ClientRequest clientRequest = client.getClientRequestFactory().createRelativeRequest("services");
+ clientRequest.accept(MediaType.APPLICATION_ATOM_XML_TYPE);
+
+ // when
+ final ClientResponse<?> resp = clientRequest.get();
+ final RestfulResponse<JsonRepresentation> restfulResp = RestfulResponse.of(resp);
+
+ // then
+ assertThat(restfulResp.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_representation.java
new file mode 100644
index 0000000..5dae3b8
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_representation.java
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.resources.domainService;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.endsWith;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+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.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.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 DomainServiceResourceTest_services_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 ListRepresentation repr = givenRepresentation();
+
+ // 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(endsWith(":39393/"))
+ .httpMethod(RestfulHttpMethod.GET)
+ .type(RepresentationType.HOME_PAGE.getMediaType())
+ .returning(HttpStatusCode.OK)
+ .responseEntityWithSelfHref(link.getHref())
+ );
+ }
+ }
+
+ private ListRepresentation givenRepresentation() throws JsonParseException, JsonMappingException, IOException {
+ final RestfulResponse<ListRepresentation> jsonResp = RestfulResponse.ofT(resource.services());
+ return jsonResp.getEntity();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_responseHeaders.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_responseHeaders.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_responseHeaders.java
new file mode 100644
index 0000000..499ff45
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_responseHeaders.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.resources.domainService;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.CacheControl;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.Header;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class DomainServiceResourceTest_services_responseHeaders {
+
+ @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/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_xrofollowlinks.java
new file mode 100644
index 0000000..a50a2da
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_xrofollowlinks.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.resources.domainService;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.hamcrest.CoreMatchers.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.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.domainobjects.ListRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.user.UserRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class DomainServiceResourceTest_services_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())));
+ }
+
+
+ // TODO: split up this test?
+ @Test
+ public void services_withFollowLinks() throws Exception {
+
+ RestfulRequest request;
+ RestfulResponse<ListRepresentation> restfulResponse;
+ ListRepresentation repr;
+
+ request = client.createRequest(RestfulHttpMethod.GET, "services");
+ restfulResponse = request.executeT();
+ repr = restfulResponse.getEntity();
+
+ assertThat(repr.getValue(), isArray());
+ assertThat(repr.getValue().size(), is(greaterThan(0)));
+ assertThat(repr.getValue().arrayGet(0), isLink().novalue());
+
+ request = client.createRequest(RestfulHttpMethod.GET, "services")
+ .withArg(RequestParameter.FOLLOW_LINKS, "value");
+ restfulResponse = request.executeT();
+ repr = restfulResponse.getEntity();
+
+ assertThat(repr.getValue().arrayGet(0), isLink().value(is(not(nullValue(JsonRepresentation.class)))));
+ assertThat(repr.getValue().arrayGet(0).getRepresentation("value"), isMap());
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/errorhandling/AnyResourceTest_serverSideException_exceptionHandling.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/errorhandling/AnyResourceTest_serverSideException_exceptionHandling.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/errorhandling/AnyResourceTest_serverSideException_exceptionHandling.java
deleted file mode 100644
index 2ffc14a..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/errorhandling/AnyResourceTest_serverSideException_exceptionHandling.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.restfulobjects.tck.resources.errorhandling;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jboss.resteasy.client.ClientRequest;
-import org.jboss.resteasy.client.ClientResponse;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.webserver.WebServer;
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.Header;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.util.Parser;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-
-public class AnyResourceTest_serverSideException_exceptionHandling {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- @Before
- public void setUp() throws Exception {
- final WebServer webServer = webServerRule.getWebServer();
- client = new RestfulClient(webServer.getBase());
- }
-
- @Test
- public void runtimeException_isMapped() throws Exception {
-
- // given
- final RestfulRequest restfulReq = client.createRequest(RestfulHttpMethod.GET, "version");
- final Header<Boolean> header = new Header<Boolean>("X-FAIL", Parser.forBoolean());
- restfulReq.withHeader(header, true);
-
- // when
- final RestfulResponse<JsonRepresentation> jsonResp = restfulReq.execute();
-
- // then
- assertThat(jsonResp.getStatus(), is(HttpStatusCode.METHOD_FAILURE));
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_acceptHeader.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_acceptHeader.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_acceptHeader.java
new file mode 100644
index 0000000..b05aed1
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_acceptHeader.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.resources.home;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.jboss.resteasy.client.ClientRequest;
+import org.jboss.resteasy.client.ClientResponse;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class HomePageResourceTest_acceptHeader {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ private RestfulRequest request;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+ request = client.createRequest(RestfulHttpMethod.GET, "/");
+ }
+
+ @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/5491a130/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_get_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_get_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_get_accept.java
deleted file mode 100644
index 9879079..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/home/HomePageResourceTest_get_accept.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.restfulobjects.tck.resources.home;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.MediaType;
-
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.jboss.resteasy.client.ClientRequest;
-import org.jboss.resteasy.client.ClientResponse;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class HomePageResourceTest_get_accept {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
- }
-
- @Test
- public void applicationJson_noProfile_returns200() throws Exception {
-
- final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, "/").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 {
-
- final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, "/").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 {
- // given
- final RestfulRequest restfulReq = client.createRequest(RestfulHttpMethod.GET, "/");
-
- // when
- final RestfulResponse<HomePageRepresentation> restfulResp = restfulReq.executeT();
-
- // then
- assertThat(restfulResp.getStatus(), is(HttpStatusCode.OK));
- }
-
- @Test
- public void applicationJson_profileIncorrect_returns406() throws Exception {
-
- final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, "/").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));
- }
-}
[21/50] [abbrv] ISIS-233: more testing on actions
Posted by da...@apache.org.
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;
[35/50] [abbrv] ISIS-233: adding new test stubs (TODOs)
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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'"));
+ }
+
+
+
+}
[47/50] [abbrv] ISIS-233: more tck tests for RO viewer.
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithPrimitiveProperties_thenRepresentation_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithPrimitiveProperties_thenRepresentation_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithPrimitiveProperties_thenRepresentation_ok.java
new file mode 100644
index 0000000..2214785
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithPrimitiveProperties_thenRepresentation_ok.java
@@ -0,0 +1,170 @@
+/*
+ * 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 org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.core.commons.matchers.IsisMatchers;
+import org.apache.isis.core.webserver.WebServer;
+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.domainobjects.DomainObjectMemberRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ScalarValueRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+
+public class Get_givenEntityWithPrimitiveProperties_thenRepresentation_ok {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+
+ private DomainObjectRepresentation domainObjectRepr;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ }
+
+ @Test
+ public void thenMembers() throws Exception {
+
+ // when
+ final LinkRepresentation link = Util.domainObjectLink(client, "PrimitiveValuedEntities");
+ domainObjectRepr = client.follow(link).getEntity().as(DomainObjectRepresentation.class);
+
+ // then members (types)
+ DomainObjectMemberRepresentation property;
+ ScalarValueRepresentation scalarRepr;
+
+ property = domainObjectRepr.getProperty("booleanProperty");
+ assertThat(property.getMemberType(), is("property"));
+ assertThat(property.getFormat(), is(nullValue()));
+ assertThat(property.getXIsisFormat(), is("boolean"));
+ scalarRepr = property.getRepresentation("value").as(ScalarValueRepresentation.class);
+ assertThat(scalarRepr.isBoolean(), is(true));
+ Boolean booleanValue = scalarRepr.asBoolean();
+ assertThat(booleanValue, is(true));
+
+ property = domainObjectRepr.getProperty("byteProperty");
+ assertThat(property.getMemberType(), is("property"));
+ assertThat(property.getFormat(), is(nullValue()));
+ assertThat(property.getXIsisFormat(), is("byte"));
+ scalarRepr = property.getRepresentation("value").as(ScalarValueRepresentation.class);
+ assertThat(scalarRepr.isIntegralNumber(), is(true));
+ Byte byteValue = scalarRepr.asByte();
+ assertThat(byteValue, is((byte)123));
+
+ property = domainObjectRepr.getProperty("shortProperty");
+ assertThat(property.getMemberType(), is("property"));
+ assertThat(property.getFormat(), is(nullValue()));
+ assertThat(property.getXIsisFormat(), is("short"));
+ scalarRepr = property.getRepresentation("value").as(ScalarValueRepresentation.class);
+ assertThat(scalarRepr.isIntegralNumber(), is(true));
+ Short shortValue = scalarRepr.asShort();
+ assertThat(shortValue, is((short)32123));
+
+ property = domainObjectRepr.getProperty("intProperty");
+ assertThat(property.getMemberType(), is("property"));
+ assertThat(property.getFormat(), is("int"));
+ assertThat(property.getXIsisFormat(), is("int"));
+ scalarRepr = property.getRepresentation("value").as(ScalarValueRepresentation.class);
+ assertThat(scalarRepr.isInt(), is(true));
+ Integer intValue = scalarRepr.asInt();
+ assertThat(intValue, is(987654321));
+
+ property = domainObjectRepr.getProperty("longProperty");
+ assertThat(property.getMemberType(), is("property"));
+ assertThat(property.getFormat(), is("int"));
+ assertThat(property.getXIsisFormat(), is("long"));
+ scalarRepr = property.getRepresentation("value").as(ScalarValueRepresentation.class);
+ assertThat(scalarRepr.isLong(), is(true));
+ Long longValue = scalarRepr.asLong();
+ assertThat(longValue, is(2345678901234567890L));
+
+ property = domainObjectRepr.getProperty("charProperty");
+ assertThat(property.getMemberType(), is("property"));
+ assertThat(property.getFormat(), is(nullValue()));
+ assertThat(property.getXIsisFormat(), is("char"));
+ scalarRepr = property.getRepresentation("value").as(ScalarValueRepresentation.class);
+ assertThat(scalarRepr.isString(), is(true));
+ Character charValue = scalarRepr.asChar();
+ assertThat(charValue, is('a'));
+
+ property = domainObjectRepr.getProperty("floatProperty");
+ assertThat(property.getMemberType(), is("property"));
+ assertThat(property.getFormat(), is("decimal"));
+ assertThat(property.getXIsisFormat(), is("float"));
+ scalarRepr = property.getRepresentation("value").as(ScalarValueRepresentation.class);
+ assertThat(scalarRepr.isNumber(), is(true));
+ assertThat(scalarRepr.isIntegralNumber(), is(false));
+ Float floatValue = scalarRepr.asFloat();
+ assertThat(floatValue, is(12345678901234567890.1234567890F));
+
+ property = domainObjectRepr.getProperty("doubleProperty");
+ assertThat(property.getMemberType(), is("property"));
+ assertThat(property.getFormat(), is("decimal"));
+ assertThat(property.getXIsisFormat(), is("double"));
+ scalarRepr = property.getRepresentation("value").as(ScalarValueRepresentation.class);
+ assertThat(scalarRepr.isDouble(), is(true));
+ Double doubleValue = scalarRepr.asDouble();
+ assertThat(doubleValue, is(12345678901234567890.1234567890));
+
+
+ // and then member types have links to details (selected ones inspected only)
+ property = domainObjectRepr.getProperty("booleanProperty");
+ assertThat(property.getLinkWithRel(Rel.DETAILS),
+ isLink()
+ .href(matches(".+\\/objects\\/PRMV\\/\\d+\\/properties\\/booleanProperty"))
+ .httpMethod(RestfulHttpMethod.GET)
+ .type(RepresentationType.OBJECT_PROPERTY.getMediaType()));
+
+ property = domainObjectRepr.getProperty("byteProperty");
+ assertThat(property.getLinkWithRel(Rel.DETAILS),
+ isLink()
+ .href(matches(".+\\/objects\\/PRMV\\/\\d+\\/properties\\/byteProperty"))
+ .httpMethod(RestfulHttpMethod.GET)
+ .type(RepresentationType.OBJECT_PROPERTY.getMediaType()));
+
+ property = domainObjectRepr.getProperty("shortProperty");
+ assertThat(property.getLinkWithRel(Rel.DETAILS),
+ isLink()
+ .href(matches(".+\\/objects\\/PRMV\\/\\d+\\/properties\\/shortProperty"))
+ .httpMethod(RestfulHttpMethod.GET)
+ .type(RepresentationType.OBJECT_PROPERTY.getMediaType()));
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithWrapperProperties_thenRepresentation_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithWrapperProperties_thenRepresentation_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithWrapperProperties_thenRepresentation_ok.java
new file mode 100644
index 0000000..09845e8
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithWrapperProperties_thenRepresentation_ok.java
@@ -0,0 +1,171 @@
+/*
+ * 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 org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.core.commons.matchers.IsisMatchers;
+import org.apache.isis.core.webserver.WebServer;
+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.domainobjects.DomainObjectMemberRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ScalarValueRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+
+public class Get_givenEntityWithWrapperProperties_thenRepresentation_ok {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+
+ private DomainObjectRepresentation domainObjectRepr;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ }
+
+ @Test
+ public void thenMembers() throws Exception {
+
+ // when
+ final LinkRepresentation link = Util.domainObjectLink(client, "WrapperValuedEntities");
+ domainObjectRepr = client.follow(link).getEntity().as(DomainObjectRepresentation.class);
+
+
+ // and then members (types)
+ DomainObjectMemberRepresentation property;
+ ScalarValueRepresentation scalarRepr;
+
+ property = domainObjectRepr.getProperty("booleanProperty");
+ assertThat(property.getMemberType(), is("property"));
+ assertThat(property.getFormat(), is(nullValue()));
+ assertThat(property.getXIsisFormat(), is("boolean"));
+ scalarRepr = property.getRepresentation("value").as(ScalarValueRepresentation.class);
+ assertThat(scalarRepr.isBoolean(), is(true));
+ Boolean booleanValue = scalarRepr.asBoolean();
+ assertThat(booleanValue, is(true));
+
+ property = domainObjectRepr.getProperty("byteProperty");
+ assertThat(property.getMemberType(), is("property"));
+ assertThat(property.getFormat(), is(nullValue()));
+ assertThat(property.getXIsisFormat(), is("byte"));
+ scalarRepr = property.getRepresentation("value").as(ScalarValueRepresentation.class);
+ assertThat(scalarRepr.isIntegralNumber(), is(true));
+ Byte byteValue = scalarRepr.asByte();
+ assertThat(byteValue, is((byte)123));
+
+ property = domainObjectRepr.getProperty("shortProperty");
+ assertThat(property.getMemberType(), is("property"));
+ assertThat(property.getFormat(), is(nullValue()));
+ assertThat(property.getXIsisFormat(), is("short"));
+ scalarRepr = property.getRepresentation("value").as(ScalarValueRepresentation.class);
+ assertThat(scalarRepr.isIntegralNumber(), is(true));
+ Short shortValue = scalarRepr.asShort();
+ assertThat(shortValue, is((short)32123));
+
+ property = domainObjectRepr.getProperty("integerProperty");
+ assertThat(property.getMemberType(), is("property"));
+ assertThat(property.getFormat(), is("int"));
+ assertThat(property.getXIsisFormat(), is("int"));
+ scalarRepr = property.getRepresentation("value").as(ScalarValueRepresentation.class);
+ assertThat(scalarRepr.isInt(), is(true));
+ Integer intValue = scalarRepr.asInt();
+ assertThat(intValue, is(987654321));
+
+ property = domainObjectRepr.getProperty("longProperty");
+ assertThat(property.getMemberType(), is("property"));
+ assertThat(property.getFormat(), is("int"));
+ assertThat(property.getXIsisFormat(), is("long"));
+ scalarRepr = property.getRepresentation("value").as(ScalarValueRepresentation.class);
+ assertThat(scalarRepr.isLong(), is(true));
+ Long longValue = scalarRepr.asLong();
+ assertThat(longValue, is(2345678901234567890L));
+
+ property = domainObjectRepr.getProperty("characterProperty");
+ assertThat(property.getMemberType(), is("property"));
+ assertThat(property.getFormat(), is(nullValue()));
+ assertThat(property.getXIsisFormat(), is("char"));
+ scalarRepr = property.getRepresentation("value").as(ScalarValueRepresentation.class);
+ assertThat(scalarRepr.isString(), is(true));
+ Character charValue = scalarRepr.asChar();
+ assertThat(charValue, is('a'));
+
+ property = domainObjectRepr.getProperty("floatProperty");
+ assertThat(property.getMemberType(), is("property"));
+ assertThat(property.getFormat(), is("decimal"));
+ assertThat(property.getXIsisFormat(), is("float"));
+ scalarRepr = property.getRepresentation("value").as(ScalarValueRepresentation.class);
+ assertThat(scalarRepr.isNumber(), is(true));
+ assertThat(scalarRepr.isIntegralNumber(), is(false));
+ Float floatValue = scalarRepr.asFloat();
+ assertThat(floatValue, is(12345678901234567890.1234567890F));
+
+ property = domainObjectRepr.getProperty("doubleProperty");
+ assertThat(property.getMemberType(), is("property"));
+ assertThat(property.getFormat(), is("decimal"));
+ assertThat(property.getXIsisFormat(), is("double"));
+ scalarRepr = property.getRepresentation("value").as(ScalarValueRepresentation.class);
+ assertThat(scalarRepr.isDouble(), is(true));
+ Double doubleValue = scalarRepr.asDouble();
+ assertThat(doubleValue, is(12345678901234567890.1234567890));
+
+
+ // and then member types have links to details (selected ones inspected only)
+ property = domainObjectRepr.getProperty("booleanProperty");
+ assertThat(property.getLinkWithRel(Rel.DETAILS),
+ isLink()
+ .href(matches(".+\\/objects\\/WRPV\\/\\d+\\/properties\\/booleanProperty"))
+ .httpMethod(RestfulHttpMethod.GET)
+ .type(RepresentationType.OBJECT_PROPERTY.getMediaType()));
+
+ property = domainObjectRepr.getProperty("byteProperty");
+ assertThat(property.getLinkWithRel(Rel.DETAILS),
+ isLink()
+ .href(matches(".+\\/objects\\/WRPV\\/\\d+\\/properties\\/byteProperty"))
+ .httpMethod(RestfulHttpMethod.GET)
+ .type(RepresentationType.OBJECT_PROPERTY.getMediaType()));
+
+ property = domainObjectRepr.getProperty("shortProperty");
+ assertThat(property.getLinkWithRel(Rel.DETAILS),
+ isLink()
+ .href(matches(".+\\/objects\\/WRPV\\/\\d+\\/properties\\/shortProperty"))
+ .httpMethod(RestfulHttpMethod.GET)
+ .type(RepresentationType.OBJECT_PROPERTY.getMediaType()));
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntity_thenRepresentation_ofTitleIdLinksEtc_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntity_thenRepresentation_ofTitleIdLinksEtc_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntity_thenRepresentation_ofTitleIdLinksEtc_ok.java
new file mode 100644
index 0000000..3fb5db7
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntity_thenRepresentation_ofTitleIdLinksEtc_ok.java
@@ -0,0 +1,103 @@
+/*
+ * 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 org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.core.commons.matchers.IsisMatchers;
+import org.apache.isis.core.webserver.WebServer;
+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.domainobjects.DomainObjectMemberRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ScalarValueRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+
+public class Get_givenEntity_thenRepresentation_ofTitleIdLinksEtc_ok {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+
+ private DomainObjectRepresentation domainObjectRepr;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ }
+
+ @Test
+ public void thenTitle_andExtensions_andLinks() throws Exception {
+
+ // when
+ final LinkRepresentation link = Util.domainObjectLink(client, "PrimitiveValuedEntities");
+ domainObjectRepr = client.follow(link).getEntity().as(DomainObjectRepresentation.class);
+
+ // then has domain type, instanceId, title
+ assertThat(domainObjectRepr, is(not(nullValue())));
+
+ assertThat(domainObjectRepr.getTitle(), is("Primitive Valued Entity #0")); // running in-memory
+ assertThat(domainObjectRepr.getDomainType(), is("PRMV"));
+ assertThat(domainObjectRepr.getInstanceId(), is(not(nullValue())));
+
+ // and then extensions
+ assertThat(domainObjectRepr.getExtensions().getString("oid"), IsisMatchers.startsWith("PRMV:" + domainObjectRepr.getInstanceId()));
+ assertThat(domainObjectRepr.getExtensions().getBoolean("isService"), is(false));
+ assertThat(domainObjectRepr.getExtensions().getBoolean("isPersistent"), is(true));
+
+ // and then has links
+ final LinkRepresentation self = domainObjectRepr.getSelf();
+ assertThat(self, isLink()
+ .rel(Rel.SELF)
+ .href(matches(".+\\/objects\\/PRMV\\/\\d+"))
+ .httpMethod(RestfulHttpMethod.GET)
+ .type(RepresentationType.DOMAIN_OBJECT.getMediaType()));
+ assertThat(domainObjectRepr.getLinkWithRel(Rel.DESCRIBEDBY),
+ isLink()
+ .href(matches(".+\\/domain-types\\/PRMV"))
+ .httpMethod(RestfulHttpMethod.GET)
+ .type(RepresentationType.DOMAIN_TYPE.getMediaType()));
+ assertThat(domainObjectRepr.getLinkWithRel(Rel.MODIFY),
+ isLink()
+ .href(matches(".+\\/objects\\/PRMV\\/\\d+"))
+ .httpMethod(RestfulHttpMethod.PUT)
+ .type(RepresentationType.DOMAIN_OBJECT.getMediaType()));
+ assertThat(domainObjectRepr.getLinkWithRel(Rel.ICON),
+ is(nullValue()));
+
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenHasIcon_thenRepresentation_ok_TOFIX.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenHasIcon_thenRepresentation_ok_TOFIX.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenHasIcon_thenRepresentation_ok_TOFIX.java
new file mode 100644
index 0000000..c64334b
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenHasIcon_thenRepresentation_ok_TOFIX.java
@@ -0,0 +1,89 @@
+/*
+ * 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.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+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.webserver.WebServer;
+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.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+public class Get_givenHasIcon_thenRepresentation_ok_TOFIX {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+
+ private DomainObjectResource domainObjectResource;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ domainObjectResource = client.getDomainObjectResource();
+ }
+
+ @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));
+
+ }
+
+
+ private DomainObjectRepresentation givenDomainObjectRepresentationFor(final String domainType, String instanceId) throws JsonParseException, JsonMappingException, IOException {
+
+ 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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenTransient_thenRepresentation_ok_TOFIX.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenTransient_thenRepresentation_ok_TOFIX.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenTransient_thenRepresentation_ok_TOFIX.java
new file mode 100644
index 0000000..78ea63c
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenTransient_thenRepresentation_ok_TOFIX.java
@@ -0,0 +1,83 @@
+/*
+ * 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.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+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.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.domainobjects.ActionResultRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ActionResultRepresentation.ResultType;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+public class Get_givenTransient_thenRepresentation_ok_TOFIX {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+
+ @SuppressWarnings("unused")
+ private DomainObjectResource domainObjectResource;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ domainObjectResource = client.getDomainObjectResource();
+
+ }
+
+
+ @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()));
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/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
deleted file mode 100644
index 4e5248f..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenRepresentation_ok_TOFIX.java
+++ /dev/null
@@ -1,430 +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.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.hasProfile;
-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 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.RepresentationType;
-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.RestfulRequest;
-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.DomainObjectMemberRepresentation;
-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());
- }
-
- @Test
- public void withPrimitiveProperties() throws Exception {
-
- // given
- final DomainObjectResource domainObjectResource = client.getDomainObjectResource();
-
- // when
- final Response jaxrsResponse = domainObjectResource.object("PRMV","29");
- final RestfulResponse<DomainObjectRepresentation> restfulResponse = RestfulResponse.ofT(jaxrsResponse);
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
-
- // then
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(RestfulMediaType.APPLICATION_JSON_OBJECT));
- assertThat(restfulResponse.getHeader(Header.CONTENT_LENGTH), is(6226));
-
- final DomainObjectRepresentation domainObjectRepr = restfulResponse.getEntity();
- assertThat(domainObjectRepr, is(not(nullValue())));
-
- // and then has title
- assertThat(domainObjectRepr.getTitle(), is("Primitive Valued Entity #0")); // running in-memory
-
- // and then extensions
- assertThat(domainObjectRepr.getExtensions().getString("oid"), is("PRMV:29"));
- assertThat(domainObjectRepr.getExtensions().getBoolean("isService"), is(false));
- assertThat(domainObjectRepr.getExtensions().getBoolean("isPersistent"), is(true));
-
- // and then has links
- final LinkRepresentation self = domainObjectRepr.getSelf();
- assertThat(self, isLink()
- .rel(Rel.SELF)
- .href(matches(".+\\/objects\\/PRMV\\/29"))
- .httpMethod(RestfulHttpMethod.GET)
- .type(RepresentationType.DOMAIN_OBJECT.getMediaType()));
- assertThat(domainObjectRepr.getLinkWithRel(Rel.DESCRIBEDBY),
- isLink()
- .href(matches(".+\\/domain-types\\/PRMV"))
- .httpMethod(RestfulHttpMethod.GET)
- .type(RepresentationType.DOMAIN_TYPE.getMediaType()));
- assertThat(domainObjectRepr.getLinkWithRel(Rel.MODIFY),
- isLink()
- .href(matches(".+\\/objects\\/PRMV\\/29"))
- .httpMethod(RestfulHttpMethod.PUT)
- .type(RepresentationType.DOMAIN_OBJECT.getMediaType()));
-
- // and then members
- DomainObjectMemberRepresentation property = domainObjectRepr.getProperty("byteProperty");
- assertThat(property.getMemberType(), is("property"));
- Byte byteValue = property.getRepresentation("value").as(ScalarValueRepresentation.class).asByte();
- assertThat(byteValue, is((byte)0));
- }
-
- @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/430e8b3c/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
deleted file mode 100644
index 3e4bfa7..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseCode_200_ok_TODO.java
+++ /dev/null
@@ -1,5 +0,0 @@
-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/430e8b3c/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
index 6e22e0a..bdebb34 100644
--- 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
@@ -18,14 +18,30 @@
*/
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 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.Ignore;
import org.junit.Rule;
import org.junit.Test;
+import org.apache.isis.core.webserver.WebServer;
+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.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectResource;
+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.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.CacheControlMatcherBuilder;
+
public class Get_thenResponseHeaders_CacheControl_ok_TODO {
@Rule
@@ -33,29 +49,63 @@ public class Get_thenResponseHeaders_CacheControl_ok_TODO {
protected RestfulClient client;
+ private DomainObjectResource domainObjectResource;
+
@Before
public void setUp() throws Exception {
final WebServer webServer = webServerRule.getWebServer();
client = new RestfulClient(webServer.getBase());
+ domainObjectResource = client.getDomainObjectResource();
+
}
- @Ignore
+ @Ignore("TODO")
@Test
- public void noCaching() throws Exception {
+ public void givenNotCached_whenUsingClientFollow() throws Exception {
+ // todo... same as test below
}
+
- @Ignore
@Test
- public void shortTermCaching() throws Exception {
+ public void givenNotCached_whenUsingResourceProxy() throws Exception {
+
+ // when
+ final RestfulResponse<DomainObjectRepresentation> restfulResponse = Util.domainObjectJaxrsResponse(client, "PrimitiveValuedEntities");
+
+ // then
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+ final CacheControl expected = new CacheControl();
+ expected.setNoCache(true);
+ assertThat(restfulResponse.getHeader(Header.CACHE_CONTROL), isCacheControl().withNoCache().build());
}
+
- @Ignore
+ @Ignore("TODO")
@Test
- public void longTermCaching() throws Exception {
-
+ public void givenShortTermCached_whenUsingClientFollow() throws Exception {
+ }
+
+ @Ignore("TODO")
+ @Test
+ public void givenShortTermCached_whenUsingResourceProxy() throws Exception {
+ }
+
+
+ @Ignore("TODO")
+ @Test
+ public void givenLongTermCached_whenUsingClientFollow() throws Exception {
}
+ @Ignore("TODO")
+ @Test
+ public void givenLongTermCached_whenUsingResourceProxy() throws Exception {
+ }
+
+
+ private CacheControlMatcherBuilder isCacheControl() {
+ return new RestfulMatchers.CacheControlMatcherBuilder();
+ }
}
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseHeaders_ContentLength_ok_TODO.java
deleted file mode 100644
index cd78084..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseHeaders_ContentLength_ok_TODO.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.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_ContentLength_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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseHeaders_ContentType_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseHeaders_ContentType_ok_TODO.java
deleted file mode 100644
index ff00479..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseHeaders_ContentType_ok_TODO.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.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_ContentType_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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenDoesntExistOid_thenResponseCode_404_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenDoesntExistOid_thenResponseCode_404_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenDoesntExistOid_thenResponseCode_404_TODO.java
index 82258f9..e434b2a 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenDoesntExistOid_thenResponseCode_404_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_whenDoesntExistOid_thenResponseCode_404_TODO.java
@@ -1,5 +1,72 @@
package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+import static org.hamcrest.CoreMatchers.*;
+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.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.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.DomainObjectResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+
public class Get_whenDoesntExistOid_thenResponseCode_404_TODO {
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+
+ private DomainObjectRepresentation domainObjectRepr;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ }
+
+ @Test
+ public void usingClientFollow() throws Exception {
+
+ // given
+ final LinkRepresentation link = Util.domainObjectLink(client, "PrimitiveValuedEntities");
+ link.mapPut("href", "http://localhost:39393/objects/PRMV/nonExistent");
+
+ // when
+ final RestfulResponse<JsonRepresentation> restfulResp = client.follow(link);
+
+ // then
+ then(restfulResp);
+
+ }
+
+ @Test
+ public void usingResourceProxy() throws Exception {
+
+ // when
+ final DomainObjectResource objectResource = client.getDomainObjectResource();
+
+ final Response response = objectResource.object("PRMV", "nonExistent");
+ RestfulResponse<JsonRepresentation> restfulResp = RestfulResponse.of(response);
+
+ then(restfulResp);
+
+ }
+
+ private void then(final RestfulResponse<JsonRepresentation> restfulResp) {
+ assertThat(restfulResp.getStatus(), is(HttpStatusCode.NOT_FOUND));
+ }
+
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_CacheControl_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_CacheControl_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_CacheControl_ok_TODO.java
index b4dd379..d2565c7 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_CacheControl_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_CacheControl_ok_TODO.java
@@ -39,23 +39,4 @@ public class Put_thenResponseHeaders_CacheControl_ok_TODO {
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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_ContentLength_ok_TODO.java
index ce54469..7ab0605 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_ContentLength_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_ContentLength_ok_TODO.java
@@ -39,23 +39,4 @@ public class Put_thenResponseHeaders_ContentLength_ok_TODO {
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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_ContentType_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_ContentType_ok_TODO.java
index 89fc0bc..3ab91da 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_ContentType_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Put_thenResponseHeaders_ContentType_ok_TODO.java
@@ -39,23 +39,4 @@ public class Put_thenResponseHeaders_ContentType_ok_TODO {
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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_CacheControl_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_CacheControl_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_CacheControl_ok_TODO.java
index e7e021f..cc6bb2f 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_CacheControl_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_CacheControl_ok_TODO.java
@@ -39,23 +39,4 @@ public class Delete_thenResponseHeaders_CacheControl_ok_TODO {
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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_ContentLength_ok_TODO.java
index d83e7f6..90d17b0 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_ContentLength_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_ContentLength_ok_TODO.java
@@ -39,23 +39,4 @@ public class Delete_thenResponseHeaders_ContentLength_ok_TODO {
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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_ContentType_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_ContentType_ok_TODO.java
index 1dd8a73..63dae69 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_ContentType_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Delete_thenResponseHeaders_ContentType_ok_TODO.java
@@ -39,23 +39,4 @@ public class Delete_thenResponseHeaders_ContentType_ok_TODO {
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/430e8b3c/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
index 0bc1a3c..a64d32f 100644
--- 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
@@ -39,23 +39,4 @@ public class Get_thenResponseHeaders_CacheControl_ok_TODO {
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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseHeaders_ContentLength_ok_TODO.java
index aa30ae8..d89a44e 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseHeaders_ContentLength_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseHeaders_ContentLength_ok_TODO.java
@@ -39,23 +39,4 @@ public class Get_thenResponseHeaders_ContentLength_ok_TODO {
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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseHeaders_ContentType_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseHeaders_ContentType_ok_TODO.java
index 7ff97a0..49747e2 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseHeaders_ContentType_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Get_thenResponseHeaders_ContentType_ok_TODO.java
@@ -39,23 +39,5 @@ public class Get_thenResponseHeaders_ContentType_ok_TODO {
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 {
-
- }
-
-
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_CacheControl_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_CacheControl_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_CacheControl_ok_TODO.java
index 2c48ef1..5cba77a 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_CacheControl_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_CacheControl_ok_TODO.java
@@ -39,23 +39,4 @@ public class Post_thenResponseHeaders_CacheControl_ok_TODO {
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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_ContentLength_ok_TODO.java
index 88be4bb..cec6032 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_ContentLength_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_ContentLength_ok_TODO.java
@@ -39,23 +39,4 @@ public class Post_thenResponseHeaders_ContentLength_ok_TODO {
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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_ContentType_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_ContentType_ok_TODO.java
index 6593f4e..391c426 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_ContentType_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Post_thenResponseHeaders_ContentType_ok_TODO.java
@@ -39,23 +39,5 @@ public class Post_thenResponseHeaders_ContentType_ok_TODO {
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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_CacheControl_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_CacheControl_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_CacheControl_ok_TODO.java
index c560adf..92d5786 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_CacheControl_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_CacheControl_ok_TODO.java
@@ -39,23 +39,4 @@ public class Put_thenResponseHeaders_CacheControl_ok_TODO {
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 {
-
- }
-
-
}
[48/50] [abbrv] git commit: ISIS-233: more tck tests for RO viewer.
Posted by da...@apache.org.
ISIS-233: more tck tests for RO viewer.
* primitive/wrapper properties domain object
* utility methods
* list repr, elements
* fix for TypedOfFacet for actions that return List<X>
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/430e8b3c
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/430e8b3c
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/430e8b3c
Branch: refs/heads/master
Commit: 430e8b3cd174d77fd0406ebbbe574f3090986510
Parents: 119d8a8
Author: Dan Haywood <da...@apache.org>
Authored: Sat Apr 27 17:53:09 2013 +0100
Committer: Dan Haywood <da...@apache.org>
Committed: Sat Apr 27 19:01:43 2013 +0100
----------------------------------------------------------------------
.../restfulobjects/applib/JsonRepresentation.java | 371 +++++++++----
.../restfulobjects/applib/LinkRepresentation.java | 2 +-
.../DomainObjectMemberRepresentation.java | 11 +
.../domainobjects/DomainObjectRepresentation.java | 2 +-
.../domainobjects/ActionResultReprRenderer.java | 2 +-
.../domainobjects/DomainObjectReprRenderer.java | 12 +-
.../rendering/domainobjects/ListReprRenderer.java | 8 +-
.../domainobjects/ObjectPropertyReprRenderer.java | 6 +-
.../server/resources/ResourceAbstract.java | 9 +-
.../tck/src/main/webapp/WEB-INF/isis.properties | 8 +-
.../viewer/restfulobjects/tck/RestfulMatchers.java | 66 +++-
.../isis/viewer/restfulobjects/tck/Util.java | 101 +++-
...ContentType_andContentLength_ok_TOCOMPLETE.java | 76 +++
...DisabledMembers_thenRepresentation_ok_TODO.java | 93 ++++
...tityWithActions_thenRepresentation_ok_TODO.java | 118 ++++
...pplibProperties_thenRepresentation_ok_TODO.java | 80 +++
...WithCollections_thenRepresentation_ok_TODO.java | 80 +++
...thJdkProperties_thenRepresentation_ok_TODO.java | 80 +++
...hJodaProperties_thenRepresentation_ok_TODO.java | 111 ++++
...hPrimitiveProperties_thenRepresentation_ok.java | 170 ++++++
...ithWrapperProperties_thenRepresentation_ok.java | 171 ++++++
...ty_thenRepresentation_ofTitleIdLinksEtc_ok.java | 103 ++++
...t_givenHasIcon_thenRepresentation_ok_TOFIX.java | 89 +++
...givenTransient_thenRepresentation_ok_TOFIX.java | 83 +++
.../oid/Get_thenRepresentation_ok_TOFIX.java | 430 ---------------
.../oid/Get_thenResponseCode_200_ok_TODO.java | 5 -
...t_thenResponseHeaders_CacheControl_ok_TODO.java | 70 ++-
..._thenResponseHeaders_ContentLength_ok_TODO.java | 61 --
...et_thenResponseHeaders_ContentType_ok_TODO.java | 61 --
...enDoesntExistOid_thenResponseCode_404_TODO.java | 67 +++
...t_thenResponseHeaders_CacheControl_ok_TODO.java | 19 -
..._thenResponseHeaders_ContentLength_ok_TODO.java | 19 -
...ut_thenResponseHeaders_ContentType_ok_TODO.java | 19 -
...e_thenResponseHeaders_CacheControl_ok_TODO.java | 19 -
..._thenResponseHeaders_ContentLength_ok_TODO.java | 19 -
...te_thenResponseHeaders_ContentType_ok_TODO.java | 19 -
...t_thenResponseHeaders_CacheControl_ok_TODO.java | 19 -
..._thenResponseHeaders_ContentLength_ok_TODO.java | 19 -
...et_thenResponseHeaders_ContentType_ok_TODO.java | 20 +-
...t_thenResponseHeaders_CacheControl_ok_TODO.java | 19 -
..._thenResponseHeaders_ContentLength_ok_TODO.java | 19 -
...st_thenResponseHeaders_ContentType_ok_TODO.java | 18 -
...t_thenResponseHeaders_CacheControl_ok_TODO.java | 19 -
..._thenResponseHeaders_ContentLength_ok_TODO.java | 19 -
...ut_thenResponseHeaders_ContentType_ok_TODO.java | 19 -
...e_thenResponseHeaders_CacheControl_ok_TODO.java | 19 -
..._thenResponseHeaders_ContentLength_ok_TODO.java | 18 -
...te_thenResponseHeaders_ContentType_ok_TODO.java | 19 -
.../property/Get_thenRepresentation_ok_TODO.java | 73 +++
...t_thenResponseHeaders_CacheControl_ok_TODO.java | 19 -
..._thenResponseHeaders_ContentLength_ok_TODO.java | 25 +-
...et_thenResponseHeaders_ContentType_ok_TODO.java | 19 -
...t_whenResponseHeaders_CacheControl_ok_TODO.java | 18 -
..._whenResponseHeaders_ContentLength_ok_TODO.java | 19 -
...et_whenResponseHeaders_ContentType_ok_TODO.java | 19 -
...t_thenResponseHeaders_CacheControl_ok_TODO.java | 19 -
..._thenResponseHeaders_ContentLength_ok_TODO.java | 18 -
...ut_thenResponseHeaders_ContentType_ok_TODO.java | 19 -
.../id/action/Get_thenRepresentation_ok_TODO.java | 81 +++
...t_thenResponseHeaders_CacheControl_ok_TODO.java | 18 -
..._thenResponseHeaders_ContentLength_ok_TODO.java | 19 -
...et_thenResponseHeaders_ContentType_ok_TODO.java | 19 -
...otIdempotent_thenResponseCode_205_bad_TODO.java | 112 ----
...tIdempotent_thenResponseCode_205_bad_TOFIX.java | 112 ++++
...eArgs_whenQueryArg_XroValidateOnly_ok_TODO.java | 18 +
...gIsHrefAndLinksToEntityOfWrongType_ok_TODO.java | 17 +
...ntType_andContentLength_andRespCode_200_ok.java | 117 ++++
...t_thenResponseHeaders_CacheControl_ok_TODO.java | 19 -
..._and_thenQueryArg_XroValidateOnly_2xx_TODO.java | 17 +
...atedNewObject_thenResponseCode_201_ok_TODO.java | 17 +
...whenErrorThrown_thenRepresentation_ok_TODO.java | 17 +
..._andQueryArg_XroValidateOnly_then_4xx_TODO.java | 17 +
...ntType_andContentLength_andRespCode_200_ok.java | 115 ----
.../invoke/Get_whenList_thenRepresentation_ok.java | 111 ++++
...tType_andContentLength__andRespCode_200_ok.java | 22 +-
.../Get_whenScalar_thenRepresentation_ok_TODO.java | 19 +-
..._thenResponseHeaders_ContentLength_ok_TODO.java | 17 +
...ar_thenResponseHeaders_ContentType_ok_TODO.java | 17 +
.../Get_whenVoid_thenRepresentation_ok_TODO.java | 17 +
..._thenResponseHeaders_ContentLength_ok_TODO.java | 20 +-
...id_thenResponseHeaders_ContentType_ok_TODO.java | 17 +
.../tck/objectsoftype/Post_ok_TODO.java | 20 +-
...t_thenResponseHeaders_CacheControl_ok_TODO.java | 19 -
..._thenResponseHeaders_ContentLength_ok_TODO.java | 19 -
...st_thenResponseHeaders_ContentType_ok_TODO.java | 19 -
..._thenResponseHeaders_ContentLength_ok_TODO.java | 20 -
.../TypeOfAnnotationForActionsFacetFactory.java | 52 ++-
.../core/tck/dom/scalars/JodaValuedEntity.java | 91 +++
.../dom/scalars/JodaValuedEntityRepository.java | 44 ++
.../fixture/scalars/JodaValuedEntityFixture.java | 47 ++
.../scalars/PrimitiveValuedEntityFixture.java | 11 +-
.../scalars/WrapperValuedEntityFixture.java | 12 +-
92 files changed, 2809 insertions(+), 1635 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java
index f7b20ca..58cd446 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/JsonRepresentation.java
@@ -257,6 +257,40 @@ public class JsonRepresentation {
}
// ///////////////////////////////////////////////////////////////////////
+ // isNumber
+ // ///////////////////////////////////////////////////////////////////////
+
+ public boolean isNumber(final String path) {
+ return isNumber(getNode(path));
+ }
+
+ public boolean isNumber() {
+ return isNumber(asJsonNode());
+ }
+
+ private boolean isNumber(final JsonNode node) {
+ return !representsNull(node) && node.isValueNode() && node.isNumber();
+ }
+
+
+ // ///////////////////////////////////////////////////////////////////////
+ // isIntegralNumber
+ // ///////////////////////////////////////////////////////////////////////
+
+ public boolean isIntegralNumber(final String path) {
+ return isIntegralNumber(getNode(path));
+ }
+
+ public boolean isIntegralNumber() {
+ return isIntegralNumber(asJsonNode());
+ }
+
+ private boolean isIntegralNumber(final JsonNode node) {
+ return !representsNull(node) && node.isValueNode() && node.isIntegralNumber();
+ }
+
+
+ // ///////////////////////////////////////////////////////////////////////
// isBoolean, getBoolean, asBoolean
// ///////////////////////////////////////////////////////////////////////
@@ -272,10 +306,16 @@ public class JsonRepresentation {
return !representsNull(node) && node.isValueNode() && node.isBoolean();
}
+ /**
+ * Use {@link #isBoolean(String)} to check first, if required.
+ */
public Boolean getBoolean(final String path) {
return getBoolean(path, getNode(path));
}
+ /**
+ * Use {@link #isBoolean()} to check first, if required.
+ */
public Boolean asBoolean() {
return getBoolean(null, asJsonNode());
}
@@ -292,76 +332,102 @@ public class JsonRepresentation {
}
// ///////////////////////////////////////////////////////////////////////
- // isBigInteger, getBigInteger, asBigInteger
+ // getByte, asByte
// ///////////////////////////////////////////////////////////////////////
-
- public boolean isBigInteger(final String path) {
- return isBigInteger(getNode(path));
- }
-
- public boolean isBigInteger() {
- return isBigInteger(asJsonNode());
- }
-
- private boolean isBigInteger(final JsonNode node) {
- return !representsNull(node) && node.isValueNode() && node.isBigInteger();
- }
-
- public BigInteger getBigInteger(final String path) {
+
+ /**
+ * Use {@link #isIntegralNumber(String)} to test if number (it is not possible to check if a byte, however).
+ */
+ public Byte getByte(final String path) {
final JsonNode node = getNode(path);
- return getBigInteger(path, node);
+ return getByte(path, node);
}
-
- public BigInteger asBigInteger() {
- return getBigInteger(null, asJsonNode());
+
+ /**
+ * Use {@link #isIntegralNumber()} to test if number (it is not possible to check if a byte, however).
+ */
+ public Byte asByte() {
+ return getByte(null, asJsonNode());
}
-
- private BigInteger getBigInteger(final String path, final JsonNode node) {
+
+ private Byte getByte(final String path, final JsonNode node) {
if (representsNull(node)) {
return null;
}
- checkValue(path, node, "a biginteger");
- if (!node.isBigInteger()) {
- throw new IllegalArgumentException(formatExMsg(path, "is not a biginteger"));
+ checkValue(path, node, "an byte");
+ if (!node.isNumber()) {
+ // there is no node.isByte()
+ throw new IllegalArgumentException(formatExMsg(path, "is not a number"));
}
- return node.getBigIntegerValue();
+ return node.getNumberValue().byteValue();
}
// ///////////////////////////////////////////////////////////////////////
- // isBigDecimal, getBigDecimal, asBigDecimal
+ // getShort, asShort
// ///////////////////////////////////////////////////////////////////////
- public boolean isBigDecimal(final String path) {
- return isBigDecimal(getNode(path));
+ /**
+ * Use {@link #isIntegralNumber(String)} to check if number (it is not possible to check if a short, however).
+ */
+ public Short getShort(final String path) {
+ final JsonNode node = getNode(path);
+ return getShort(path, node);
}
- public boolean isBigDecimal() {
- return isBigDecimal(asJsonNode());
+ /**
+ * Use {@link #isIntegralNumber()} to check if number (it is not possible to check if a short, however).
+ */
+ public Short asShort() {
+ return getShort(null, asJsonNode());
}
-
- private boolean isBigDecimal(final JsonNode node) {
- return !representsNull(node) && node.isValueNode() && node.isBigDecimal();
+
+ private Short getShort(final String path, final JsonNode node) {
+ if (representsNull(node)) {
+ return null;
+ }
+ checkValue(path, node, "an short");
+ if (!node.isNumber()) {
+ // there is no node.isShort()
+ throw new IllegalArgumentException(formatExMsg(path, "is not a number"));
+ }
+ return node.getNumberValue().shortValue();
}
+
- public BigDecimal getBigDecimal(final String path) {
+ // ///////////////////////////////////////////////////////////////////////
+ // getChar, asChar
+ // ///////////////////////////////////////////////////////////////////////
+
+ /**
+ * Use {@link #isString(String)} to check if string (it is not possible to check if a character, however).
+ */
+ public Character getChar(final String path) {
final JsonNode node = getNode(path);
- return getBigDecimal(path, node);
+ return getChar(path, node);
}
- public BigDecimal asBigDecimal() {
- return getBigDecimal(null, asJsonNode());
+ /**
+ * Use {@link #isString()} to check if string (it is not possible to check if a character, however).
+ */
+ public Character asChar() {
+ return getChar(null, asJsonNode());
}
-
- private BigDecimal getBigDecimal(final String path, final JsonNode node) {
+
+ private Character getChar(final String path, final JsonNode node) {
if (representsNull(node)) {
return null;
}
- checkValue(path, node, "a biginteger");
- if (!node.isBigDecimal()) {
- throw new IllegalArgumentException(formatExMsg(path, "is not a biginteger"));
+ checkValue(path, node, "an short");
+ if (!node.isTextual()) {
+ throw new IllegalArgumentException(formatExMsg(path, "is not textual"));
}
- return node.getDecimalValue();
+ final String textValue = node.getTextValue();
+ if(textValue == null || textValue.length() == 0) {
+ return null;
+ }
+ return textValue.charAt(0);
}
+
// ///////////////////////////////////////////////////////////////////////
// isInt, getInt, asInt
@@ -379,11 +445,17 @@ public class JsonRepresentation {
return !representsNull(node) && node.isValueNode() && node.isInt();
}
+ /**
+ * Use {@link #isInt(String)} to check first, if required.
+ */
public Integer getInt(final String path) {
final JsonNode node = getNode(path);
return getInt(path, node);
}
+ /**
+ * Use {@link #isInt()} to check first, if required.
+ */
public Integer asInt() {
return getInt(null, asJsonNode());
}
@@ -399,144 +471,207 @@ public class JsonRepresentation {
return node.getIntValue();
}
+
// ///////////////////////////////////////////////////////////////////////
- // isNumber
+ // isLong, getLong, asLong
// ///////////////////////////////////////////////////////////////////////
- public boolean isNumber(final String path) {
- return isNumber(getNode(path));
+ public boolean isLong(final String path) {
+ return isLong(getNode(path));
}
- public boolean isNumber() {
- return isNumber(asJsonNode());
+ public boolean isLong() {
+ return isLong(asJsonNode());
}
- private boolean isNumber(final JsonNode node) {
- return !representsNull(node) && node.isValueNode() && node.isNumber();
+ private boolean isLong(final JsonNode node) {
+ return !representsNull(node) && node.isValueNode() && node.isLong();
+ }
+
+ /**
+ * Use {@link #isLong(String)} to check first, if required.
+ */
+ public Long getLong(final String path) {
+ final JsonNode node = getNode(path);
+ return getLong(path, node);
+ }
+
+ /**
+ * Use {@link #isLong()} to check first, if required.
+ */
+ public Long asLong() {
+ return getLong(null, asJsonNode());
+ }
+
+ private Long getLong(final String path, final JsonNode node) {
+ if (representsNull(node)) {
+ return null;
+ }
+ checkValue(path, node, "a long");
+ if (!node.isLong()) {
+ throw new IllegalArgumentException(formatExMsg(path, "is not a long"));
+ }
+ return node.getLongValue();
}
// ///////////////////////////////////////////////////////////////////////
- // getShort, asShort
+ // getFloat, asFloat
// ///////////////////////////////////////////////////////////////////////
- public Short getShort(final String path) {
+ /**
+ * Use {@link #isNumber(String)} to test if number (it is not possible to check if a float, however).
+ */
+ public Float getFloat(final String path) {
final JsonNode node = getNode(path);
- return getShort(path, node);
+ return getFloat(path, node);
}
- public Short asShort() {
- return getShort(null, asJsonNode());
+ /**
+ * Use {@link #isNumber()} to test if number (it is not possible to check if a float, however).
+ */
+ public Float asFloat() {
+ return getFloat(null, asJsonNode());
}
- private Short getShort(final String path, final JsonNode node) {
+ private Float getFloat(final String path, final JsonNode node) {
if (representsNull(node)) {
return null;
}
- checkValue(path, node, "an short");
+ checkValue(path, node, "a float");
if (!node.isNumber()) {
- // there is no node.isShort()
throw new IllegalArgumentException(formatExMsg(path, "is not a number"));
}
- return node.getNumberValue().shortValue();
+ return node.getNumberValue().floatValue();
}
+
// ///////////////////////////////////////////////////////////////////////
- // getByte, asByte
+ // isDouble, getDouble, asDouble
// ///////////////////////////////////////////////////////////////////////
-
- public Byte getByte(final String path) {
+
+ public boolean isDouble(final String path) {
+ return isDouble(getNode(path));
+ }
+
+ public boolean isDouble() {
+ return isDouble(asJsonNode());
+ }
+
+ private boolean isDouble(final JsonNode node) {
+ return !representsNull(node) && node.isValueNode() && node.isDouble();
+ }
+
+ /**
+ * Use {@link #isDouble(String)} to check first, if required.
+ */
+ public Double getDouble(final String path) {
final JsonNode node = getNode(path);
- return getByte(path, node);
+ return getDouble(path, node);
}
-
- public Byte asByte() {
- return getByte(null, asJsonNode());
+
+ /**
+ * Use {@link #isDouble()} to check first, if required.
+ */
+ public Double asDouble() {
+ return getDouble(null, asJsonNode());
}
-
- private Byte getByte(final String path, final JsonNode node) {
+
+ private Double getDouble(final String path, final JsonNode node) {
if (representsNull(node)) {
return null;
}
- checkValue(path, node, "an byte");
- if (!node.isNumber()) {
- // there is no node.isByte()
- throw new IllegalArgumentException(formatExMsg(path, "is not a number"));
+ checkValue(path, node, "a double");
+ if (!node.isDouble()) {
+ throw new IllegalArgumentException(formatExMsg(path, "is not a double"));
}
- return node.getNumberValue().byteValue();
+ return node.getDoubleValue();
}
-
+
// ///////////////////////////////////////////////////////////////////////
- // isLong, getLong, asLong
+ // isBigInteger, getBigInteger, asBigInteger
// ///////////////////////////////////////////////////////////////////////
- public boolean isLong(final String path) {
- return isLong(getNode(path));
+ public boolean isBigInteger(final String path) {
+ return isBigInteger(getNode(path));
}
- public boolean isLong() {
- return isLong(asJsonNode());
+ public boolean isBigInteger() {
+ return isBigInteger(asJsonNode());
}
- private boolean isLong(final JsonNode node) {
- return !representsNull(node) && node.isValueNode() && node.isLong();
+ private boolean isBigInteger(final JsonNode node) {
+ return !representsNull(node) && node.isValueNode() && node.isBigInteger();
}
- public Long getLong(final String path) {
+ /**
+ * Use {@link #isBigInteger(String)} to check first, if required.
+ */
+ public BigInteger getBigInteger(final String path) {
final JsonNode node = getNode(path);
- return getLong(path, node);
+ return getBigInteger(path, node);
}
- public Long asLong() {
- return getLong(null, asJsonNode());
+ /**
+ * Use {@link #isBigInteger()} to check first, if required.
+ */
+ public BigInteger asBigInteger() {
+ return getBigInteger(null, asJsonNode());
}
- private Long getLong(final String path, final JsonNode node) {
+ private BigInteger getBigInteger(final String path, final JsonNode node) {
if (representsNull(node)) {
return null;
}
- checkValue(path, node, "a long");
- if (!node.isLong()) {
- throw new IllegalArgumentException(formatExMsg(path, "is not a long"));
+ checkValue(path, node, "a biginteger");
+ if (!node.isBigInteger()) {
+ throw new IllegalArgumentException(formatExMsg(path, "is not a biginteger"));
}
- return node.getLongValue();
+ return node.getBigIntegerValue();
}
// ///////////////////////////////////////////////////////////////////////
- // isDouble, getDouble, asDouble
+ // isBigDecimal, getBigDecimal, asBigDecimal
// ///////////////////////////////////////////////////////////////////////
- public boolean isDouble(final String path) {
- return isDouble(getNode(path));
+ public boolean isBigDecimal(final String path) {
+ return isBigDecimal(getNode(path));
}
- public boolean isDouble() {
- return isDouble(asJsonNode());
+ public boolean isBigDecimal() {
+ return isBigDecimal(asJsonNode());
}
- private boolean isDouble(final JsonNode node) {
- return !representsNull(node) && node.isValueNode() && node.isDouble();
+ private boolean isBigDecimal(final JsonNode node) {
+ return !representsNull(node) && node.isValueNode() && node.isBigDecimal();
}
- public Double getDouble(final String path) {
+ /**
+ * Use {@link #isBigDecimal(String)} to check first, if required.
+ */
+ public BigDecimal getBigDecimal(final String path) {
final JsonNode node = getNode(path);
- return getDouble(path, node);
+ return getBigDecimal(path, node);
}
- public Double asDouble() {
- return getDouble(null, asJsonNode());
+ /**
+ * Use {@link #isBigDecimal()} to check first, if required.
+ */
+ public BigDecimal asBigDecimal() {
+ return getBigDecimal(null, asJsonNode());
}
- private Double getDouble(final String path, final JsonNode node) {
+ private BigDecimal getBigDecimal(final String path, final JsonNode node) {
if (representsNull(node)) {
return null;
}
- checkValue(path, node, "a double");
- if (!node.isDouble()) {
- throw new IllegalArgumentException(formatExMsg(path, "is not a double"));
+ checkValue(path, node, "a biginteger");
+ if (!node.isBigDecimal()) {
+ throw new IllegalArgumentException(formatExMsg(path, "is not a biginteger"));
}
- return node.getDoubleValue();
+ return node.getDecimalValue();
}
+
// ///////////////////////////////////////////////////////////////////////
// getString, isString, asString
// ///////////////////////////////////////////////////////////////////////
@@ -553,11 +688,17 @@ public class JsonRepresentation {
return !representsNull(node) && node.isValueNode() && node.isTextual();
}
+ /**
+ * Use {@link #isString(String)} to check first, if required.
+ */
public String getString(final String path) {
final JsonNode node = getNode(path);
return getString(path, node);
}
+ /**
+ * Use {@link #isString()} to check first, if required.
+ */
public String asString() {
return getString(null, asJsonNode());
}
@@ -605,10 +746,16 @@ public class JsonRepresentation {
return true;
}
+ /**
+ * Use {@link #isLink(String)} to check first, if required.
+ */
public LinkRepresentation getLink(final String path) {
return getLink(path, getNode(path));
}
+ /**
+ * Use {@link #isLink()} to check first, if required.
+ */
public LinkRepresentation asLink() {
return getLink(null, asJsonNode());
}
@@ -662,11 +809,23 @@ public class JsonRepresentation {
* wrapped node has <tt>null</tt> value (ie
* {@link JsonRepresentation#isNull()}), or returns <tt>null</tt> if there
* was no node with the provided path.
+ *
+ * <p>
+ * Use {@link #isNull(String)} to check first, if required.
*/
public JsonRepresentation getNull(final String path) {
return getNull(path, getNode(path));
}
+ /**
+ * Either returns a {@link JsonRepresentation} that indicates that the
+ * wrapped node has <tt>null</tt> value (ie
+ * {@link JsonRepresentation#isNull()}), or returns <tt>null</tt> if there
+ * was no node with the provided path.
+ *
+ * <p>
+ * Use {@link #isNull()} to check first, if required.
+ */
public JsonRepresentation asNull() {
return getNull(null, asJsonNode());
}
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/LinkRepresentation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/LinkRepresentation.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/LinkRepresentation.java
index 4058734..ec9fa57 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/LinkRepresentation.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/LinkRepresentation.java
@@ -104,7 +104,7 @@ public final class LinkRepresentation extends JsonRepresentation {
*/
public JsonRepresentation getArguments() {
final JsonNode arguments = asObjectNode().get("arguments");
- if (arguments.isNull()) {
+ if (arguments == null || arguments.isNull()) {
return JsonRepresentation.newMap();
}
return new JsonRepresentation(arguments);
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectMemberRepresentation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectMemberRepresentation.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectMemberRepresentation.java
index faabe18..4583a6b 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectMemberRepresentation.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectMemberRepresentation.java
@@ -52,4 +52,15 @@ public class DomainObjectMemberRepresentation extends DomainRepresentation {
return getString("disabledReason");
}
+ public String getFormat() {
+ return getString("format");
+ }
+
+ /**
+ * Isis-specific extension; not part of the RO API;
+ */
+ public String getXIsisFormat() {
+ return getString("x-isis-format");
+ }
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectRepresentation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectRepresentation.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectRepresentation.java
index bc9ee9b..d9b6e59 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectRepresentation.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectRepresentation.java
@@ -37,7 +37,7 @@ public class DomainObjectRepresentation extends DomainRepresentation {
* Populated only for domain objects, not for domain services.
*/
public String getDomainType() {
- return getString("instanceId");
+ return getString("domainType");
}
/**
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ActionResultReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ActionResultReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ActionResultReprRenderer.java
index 978596a..e5df49a 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ActionResultReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ActionResultReprRenderer.java
@@ -114,7 +114,7 @@ public class ActionResultReprRenderer extends ReprRendererAbstract<ActionResultR
if(returnedAdapter != null) {
final Collection<ObjectAdapter> collectionAdapters = collectionFacet.collection(returnedAdapter);
- final ListReprRenderer renderer = new ListReprRenderer(rendererContext, null, result);
+ final ListReprRenderer renderer = new ListReprRenderer(rendererContext, null, result).withElementRel(Rel.ELEMENT);
renderer.with(collectionAdapters).withReturnType(action.getReturnType()).withElementType(returnedAdapter.getElementSpecification());
renderer.render();
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java
index 6b70656..9aeef67 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectReprRenderer.java
@@ -21,7 +21,9 @@ import java.util.List;
import org.codehaus.jackson.node.NullNode;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.oid.Oid;
import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
+import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
import org.apache.isis.core.metamodel.consent.Consent;
import org.apache.isis.core.metamodel.facets.object.notpersistable.NotPersistableFacet;
import org.apache.isis.core.metamodel.facets.object.title.TitleFacet;
@@ -133,11 +135,19 @@ public class DomainObjectReprRenderer extends ReprRendererAbstract<DomainObjectR
}
- // serviceId
+ // serviceId or instance Id
if (!mode.representsArguments()) {
final boolean isService = objectAdapter.getSpecification().isService();
if (isService) {
representation.mapPut("serviceId", ServiceUtil.id(objectAdapter.getObject()));
+ } else {
+ final String domainType = getDomainType();
+ final String instanceId = getInstanceId();
+ if(domainType != null) {
+ representation.mapPut("domainType", domainType);
+ representation.mapPut("instanceId", instanceId);
+
+ }
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ListReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ListReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ListReprRenderer.java
index 8896243..5b8dcc8 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ListReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ListReprRenderer.java
@@ -33,6 +33,7 @@ public class ListReprRenderer extends ReprRendererAbstract<ListReprRenderer, Col
private Collection<ObjectAdapter> objectAdapters;
private ObjectSpecification elementType;
private ObjectSpecification returnType;
+ private Rel elementRel;
public ListReprRenderer(final RendererContext resourceContext, final LinkFollowSpecs linkFollower, final JsonRepresentation representation) {
super(resourceContext, linkFollower, RepresentationType.LIST, representation);
@@ -50,6 +51,11 @@ public class ListReprRenderer extends ReprRendererAbstract<ListReprRenderer, Col
return this;
}
+ public ListReprRenderer withElementRel(Rel elementRel) {
+ this.elementRel = elementRel;
+ return this;
+ }
+
public ListReprRenderer withReturnType(final ObjectSpecification returnType) {
this.returnType = returnType;
return this;
@@ -84,7 +90,7 @@ public class ListReprRenderer extends ReprRendererAbstract<ListReprRenderer, Col
if (specification.isHidden()) {
continue;
}
- final JsonRepresentation linkToObject = linkTo.with(adapter).builder().build();
+ final JsonRepresentation linkToObject = linkTo.with(adapter).builder(elementRel).build();
values.arrayAdd(linkToObject);
final LinkFollowSpecs linkFollower = getLinkFollowSpecs().follow("value");
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectPropertyReprRenderer.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectPropertyReprRenderer.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectPropertyReprRenderer.java
index 5ceebe6..d83134c 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectPropertyReprRenderer.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectPropertyReprRenderer.java
@@ -62,7 +62,11 @@ public class ObjectPropertyReprRenderer extends AbstractObjectMemberReprRenderer
private void addValue() {
final ObjectAdapter valueAdapter = objectMember.get(objectAdapter);
- DomainObjectReprRenderer.appendValueAndFormatOrRef(rendererContext, valueAdapter, valueAdapter.getSpecification(), representation);
+
+ // use the runtime type if we have a value, else the compile time type of the member otherwise
+ final ObjectSpecification specification = valueAdapter != null? valueAdapter.getSpecification(): objectMember.getSpecification();
+
+ DomainObjectReprRenderer.appendValueAndFormatOrRef(rendererContext, valueAdapter, specification, representation);
}
// ///////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java
index 9f00f5b..6b1edca 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java
@@ -183,11 +183,6 @@ public abstract class ResourceAbstract {
return OidUtils.getObjectAdapterElseNull(resourceContext, domainType, instanceId);
}
- // REVIEW: a bit of a hack to just 'new' up the OidMarshaller...
- OidMarshaller getOidMarshaller() {
- return new OidMarshaller();
- }
-
protected ObjectAdapter getServiceAdapter(final String serviceId) {
final List<ObjectAdapter> serviceAdapters = getPersistenceSession().getServices();
for (final ObjectAdapter serviceAdapter : serviceAdapters) {
@@ -267,6 +262,10 @@ public abstract class ResourceAbstract {
return IsisContext.getLocalization();
}
+ protected OidMarshaller getOidMarshaller() {
+ return IsisContext.getOidMarshaller();
+ }
+
// //////////////////////////////////////////////////////////////
// Dependencies (injected via @Context)
// //////////////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/tck/src/main/webapp/WEB-INF/isis.properties
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/main/webapp/WEB-INF/isis.properties b/component/viewer/restfulobjects/tck/src/main/webapp/WEB-INF/isis.properties
index 0734bb7..b5cab51 100644
--- a/component/viewer/restfulobjects/tck/src/main/webapp/WEB-INF/isis.properties
+++ b/component/viewer/restfulobjects/tck/src/main/webapp/WEB-INF/isis.properties
@@ -40,8 +40,8 @@ isis.services =\
defaults.WithDefaultsEntityRepository,\
defaults.HiddenRepository,\
busrules.BusRulesEntityRepository,\
- actions.ActionsEntityRepository
-
+ actions.ActionsEntityRepository,\
+ scalars.JodaValuedEntityRepository
isis.fixtures.prefix= org.apache.isis.core.tck.fixture
isis.fixtures=\
@@ -53,6 +53,8 @@ isis.fixtures=\
refs.ParentEntitiesFixture,\
defaults.WithDefaultsEntityFixture,\
busrules.BusRulesEntityFixture,\
- actions.ActionsEntityFixture
+ actions.ActionsEntityFixture,\
+ scalars.JodaValuedEntityFixture
+
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/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
index 68ff89b..7044395 100644
--- 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
@@ -31,6 +31,9 @@ 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.tck.RestfulMatchers.CacheControlMatcherBuilder;
+import org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.LinkMatcherBuilder;
+
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
@@ -141,7 +144,7 @@ public class RestfulMatchers {
return new LinkMatcherBuilder(null);
}
- public static abstract class AbstractMatcherBuilder<T extends JsonRepresentation> {
+ public static abstract class AbstractMatcherBuilder<T> {
protected RestfulClient client;
public AbstractMatcherBuilder() {
@@ -169,6 +172,8 @@ public class RestfulMatchers {
private String typeParameterValue;
private String selfHref;
private JsonRepresentation arguments;
+ private String title;
+ private Matcher<String> titleMatcher;
private LinkMatcherBuilder(final RestfulClient client) {
super(client);
@@ -209,6 +214,16 @@ public class RestfulMatchers {
return this;
}
+ public LinkMatcherBuilder title(String title) {
+ this.title = title;
+ return this;
+ }
+
+ public LinkMatcherBuilder title(Matcher<String> titleMatcher) {
+ this.titleMatcher = titleMatcher;
+ return this;
+ }
+
public LinkMatcherBuilder typeParameter(final String typeParameterName, final String typeParameterValue) {
this.typeParameterName = typeParameterName;
this.typeParameterValue = typeParameterValue;
@@ -267,6 +282,13 @@ public class RestfulMatchers {
description.appendText(" with href ");
hrefMatcher.describeTo(description);
}
+ if (title != null) {
+ description.appendText(" with title '").appendText(title).appendText("'");
+ }
+ if (titleMatcher != null) {
+ description.appendText(" with title ");
+ titleMatcher.describeTo(description);
+ }
if (httpMethod != null) {
description.appendText(" with method '").appendValue(httpMethod).appendText("'");
}
@@ -325,6 +347,12 @@ public class RestfulMatchers {
if (hrefMatcher != null && !hrefMatcher.matches(link.getHref())) {
return false;
}
+ if (title != null && !title.equals(link.getTitle())) {
+ return false;
+ }
+ if (titleMatcher != null && !titleMatcher.matches(link.getTitle())) {
+ return false;
+ }
if (httpMethod != null && !httpMethod.equals(link.getHttpMethod())) {
return false;
}
@@ -392,6 +420,7 @@ public class RestfulMatchers {
}
+
}
public static EntryMatcherBuilder entry(final String key) {
@@ -556,5 +585,40 @@ public class RestfulMatchers {
};
}
+
+ public static class CacheControlMatcherBuilder extends AbstractMatcherBuilder<CacheControl> {
+
+ private Boolean noCache;
+
+ @Override
+ public Matcher<CacheControl> build() {
+ return new TypeSafeMatcher<CacheControl>() {
+
+ @Override
+ public void describeTo(Description description) {
+ description.appendText("is a CacheControl header ");
+ if(noCache != null) {
+ description.appendText("with " + (noCache?"no":"") + " cache");
+ }
+ }
+
+ @Override
+ protected boolean matchesSafely(CacheControl item) {
+ if(noCache != null) {
+ if(item.isNoCache() != noCache) {
+ return false;
+ }
+ }
+ return true;
+ }
+ };
+ }
+ public CacheControlMatcherBuilder withNoCache() {
+ noCache = true;
+ return this;
+ }
+
+ }
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/Util.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/Util.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/Util.java
index 6922169..d3b59e3 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/Util.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/Util.java
@@ -18,7 +18,12 @@
*/
package org.apache.isis.viewer.restfulobjects.tck;
+import static org.apache.isis.core.commons.matchers.IsisMatchers.matches;
+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 java.io.ByteArrayInputStream;
@@ -28,33 +33,40 @@ import java.nio.charset.Charset;
import javax.ws.rs.core.Response;
+import org.apache.isis.core.commons.matchers.IsisMatchers;
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;
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.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.ActionResultRepresentation.ResultType;
+
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
+import org.hamcrest.CoreMatchers;
+import org.junit.Test;
public class Util {
-
- private Util(){}
+
+ private Util() {
+ }
public static String givenLinkToService(RestfulClient restfulClient, String serviceId) throws JsonParseException, JsonMappingException, IOException {
-
+
final DomainServiceResource resource = restfulClient.getDomainServiceResource();
final Response response = resource.services();
final ListRepresentation services = RestfulResponse.<ListRepresentation> ofT(response).getEntity();
- final String href = services.getRepresentation("value[rel=" + Rel.SERVICE.getName() + ";serviceId=\"" +
- serviceId +
- "\"]").asLink().getHref();
+ final String href = services.getRepresentation("value[rel=" + Rel.SERVICE.getName() + ";serviceId=\"" + serviceId + "\"]").asLink().getHref();
return href;
}
@@ -62,21 +74,90 @@ public class Util {
final DomainServiceResource resource = client.getDomainServiceResource();
final Response response = resource.services();
final ListRepresentation services = RestfulResponse.<ListRepresentation> ofT(response).getEntity();
-
+
return services.getRepresentation("value[rel=urn:org.restfulobjects:rels/service;serviceId=\"%s\"]", serviceId).asLink().getHref();
}
public static JsonRepresentation givenAction(RestfulClient client, final String serviceId, final String actionId) throws JsonParseException, JsonMappingException, IOException {
final String href = givenHrefToService(client, serviceId);
-
+
final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, href).withArg(RequestParameter.FOLLOW_LINKS, "members[%s].links[rel=%s]", actionId, Rel.DETAILS.getName());
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=%s].value", Rel.DETAILS.getName());
}
+ /**
+ * For clientFollow tests; returns a link to the first entity in the list returned by invoking the 'list' action of the specified repo
+ */
+ public static LinkRepresentation domainObjectLink(RestfulClient client, String repoName) throws Exception {
+ return domainObjectLink(client, repoName, "list");
+ }
+
+ /**
+ * For clientFollow tests; returns a link to the first entity in the list returned by invoking the specified repo and action
+ */
+ public static LinkRepresentation domainObjectLink(RestfulClient client, String repoName, String actionName) throws Exception {
+ return domainObjectLink(client, repoName, actionName, 0);
+ }
+
+ /**
+ * For clientFollow tests; returns a link to the Nth entity in the list returned by invoking the specified repo and action
+ */
+ public static LinkRepresentation domainObjectLink(RestfulClient client, String repoName, String actionName, int idx) throws Exception {
+
+ final DomainServiceResource serviceResource = client.getDomainServiceResource();
+
+ Response response = serviceResource.invokeActionQueryOnly(repoName, actionName, null);
+ RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+ final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
+
+ assertThat(actionResultRepr.getResultType(), is(ResultType.LIST));
+ final ListRepresentation listRepr = actionResultRepr.getResult().as(ListRepresentation.class);
+
+ assertThat(listRepr.getValue(), is(not(nullValue())));
+ assertThat(listRepr.getValue().size(), is(IsisMatchers.greaterThan(idx + 1)));
+
+ final LinkRepresentation domainObjectLinkRepr = listRepr.getValue().arrayGet(idx).as(LinkRepresentation.class);
+
+ assertThat(domainObjectLinkRepr, is(not(nullValue())));
+ assertThat(domainObjectLinkRepr, isLink().rel(Rel.ELEMENT).httpMethod(RestfulHttpMethod.GET).type(RepresentationType.DOMAIN_OBJECT.getMediaType()).arguments(JsonRepresentation.newMap()).build());
+
+ return domainObjectLinkRepr;
+ }
+
+
+
+ /**
+ * For resourceProxy tests; returns the first entity in the list returned by invoking the 'list' action on the specified repo
+ */
+ public static RestfulResponse<DomainObjectRepresentation> domainObjectJaxrsResponse(RestfulClient client, String repoName) throws Exception {
+ return domainObjectJaxrsResponse(client, repoName, "list");
+ }
+
+ /**
+ * For resourceProxy tests; returns the first entity in the list returned by invoking the specified repo and action
+ */
+ public static RestfulResponse<DomainObjectRepresentation> domainObjectJaxrsResponse(RestfulClient client, String repoName, String actionName) throws Exception {
+ return domainObjectJaxrsResponse(client, repoName, actionName, 0);
+ }
+
+ /**
+ * For resourceProxy tests; returns the Nth entity in the list returned by invoking the specified repo and action
+ */
+ public static RestfulResponse<DomainObjectRepresentation> domainObjectJaxrsResponse(RestfulClient client, String repoName, String actionName, int idx) throws Exception {
+ final LinkRepresentation link = Util.domainObjectLink(client, repoName, actionName, idx);
+ DomainObjectRepresentation domainObjectRepr = client.follow(link).getEntity().as(DomainObjectRepresentation.class);
+
+ final Response jaxrsResponse = client.getDomainObjectResource().object(domainObjectRepr.getDomainType(), domainObjectRepr.getInstanceId());
+ final RestfulResponse<DomainObjectRepresentation> restfulResponse = RestfulResponse.ofT(jaxrsResponse);
+ return restfulResponse;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get__thenResponseCode_andContentType_andContentLength_ok_TOCOMPLETE.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get__thenResponseCode_andContentType_andContentLength_ok_TOCOMPLETE.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get__thenResponseCode_andContentType_andContentLength_ok_TOCOMPLETE.java
new file mode 100644
index 0000000..cc7b933
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get__thenResponseCode_andContentType_andContentLength_ok_TOCOMPLETE.java
@@ -0,0 +1,76 @@
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
+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.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.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.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+
+public class Get__thenResponseCode_andContentType_andContentLength_ok_TOCOMPLETE {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+
+ private DomainObjectResource domainObjectResource;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ domainObjectResource = client.getDomainObjectResource();
+
+ }
+
+ @Ignore("TODO")
+ @Test
+ public void usingClientFollow() throws Exception {
+
+ // todo... same as test below
+ final LinkRepresentation link = Util.domainObjectLink(client, "PrimitiveValuedEntities");
+ final DomainObjectRepresentation objRepr = client.follow(link).getEntity().as(DomainObjectRepresentation.class);
+ objRepr.getDomainType();
+ objRepr.getInstanceId();
+
+ }
+
+
+ @Test
+ public void usingResourceProxy() throws Exception {
+
+ // when
+ final LinkRepresentation link = Util.domainObjectLink(client, "PrimitiveValuedEntities");
+ final DomainObjectRepresentation objRepr = client.follow(link).getEntity().as(DomainObjectRepresentation.class);
+ final String domainType = objRepr.getDomainType();
+ final String instanceId = objRepr.getInstanceId();
+
+ final Response jaxrsResponse = domainObjectResource.object(domainType,instanceId);
+ final RestfulResponse<DomainObjectRepresentation> restfulResponse = RestfulResponse.ofT(jaxrsResponse);
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+
+ // then
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+ assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(RestfulMediaType.APPLICATION_JSON_OBJECT));
+ assertThat(restfulResponse.getHeader(Header.CONTENT_LENGTH), is(6382));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenDisabledMembers_thenRepresentation_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenDisabledMembers_thenRepresentation_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenDisabledMembers_thenRepresentation_ok_TODO.java
new file mode 100644
index 0000000..6ab9670
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenDisabledMembers_thenRepresentation_ok_TODO.java
@@ -0,0 +1,93 @@
+/*
+ * 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.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 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.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+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.DomainObjectResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+public class Get_givenDisabledMembers_thenRepresentation_ok_TODO {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+
+ private DomainObjectResource domainObjectResource;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ domainObjectResource = client.getDomainObjectResource();
+
+ }
+
+
+ @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())));
+ }
+
+
+
+
+ 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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithActions_thenRepresentation_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithActions_thenRepresentation_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithActions_thenRepresentation_ok_TODO.java
new file mode 100644
index 0000000..7db8c12
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithActions_thenRepresentation_ok_TODO.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.domainobject.oid;
+
+import static org.apache.isis.core.commons.matchers.IsisMatchers.matches;
+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 org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.core.tck.dom.scalars.ApplibValuedEntity;
+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.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.DomainObjectResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+public class Get_givenEntityWithActions_thenRepresentation_ok_TODO {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+
+ private DomainObjectResource domainObjectResource;
+ private DomainObjectRepresentation domainObjectRepr;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ domainObjectResource = client.getDomainObjectResource();
+
+ }
+
+ @Ignore("TODO")
+ @Test
+ public void thenMembers() throws Exception {
+
+ // when
+ final Response jaxrsResponse = domainObjectResource.object("PRMV","29");
+ final RestfulResponse<DomainObjectRepresentation> restfulResponse = RestfulResponse.ofT(jaxrsResponse);
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+
+ // then
+ domainObjectRepr = restfulResponse.getEntity();
+ assertThat(domainObjectRepr, is(not(nullValue())));
+
+
+
+
+ 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));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithApplibProperties_thenRepresentation_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithApplibProperties_thenRepresentation_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithApplibProperties_thenRepresentation_ok_TODO.java
new file mode 100644
index 0000000..b8ad8fc
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithApplibProperties_thenRepresentation_ok_TODO.java
@@ -0,0 +1,80 @@
+/*
+ * 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 org.joda.time.LocalDate;
+import org.joda.time.LocalDateTime;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.core.commons.matchers.IsisMatchers;
+import org.apache.isis.core.webserver.WebServer;
+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.domainobjects.DomainObjectMemberRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ScalarValueRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+
+public class Get_givenEntityWithApplibProperties_thenRepresentation_ok_TODO {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+
+ private DomainObjectRepresentation domainObjectRepr;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ }
+
+ @Ignore("TODO")
+ @Test
+ public void thenMembers() throws Exception {
+
+ // when
+ final LinkRepresentation link = Util.domainObjectLink(client, "ApplibValuedEntities");
+ domainObjectRepr = client.follow(link).getEntity().as(DomainObjectRepresentation.class);
+
+ // and then members (types)
+ DomainObjectMemberRepresentation property;
+ ScalarValueRepresentation scalarRepr;
+
+
+ // copy from Get_givenEntityWithPrimitiveProperties_thenRepresentation_ok
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithCollections_thenRepresentation_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithCollections_thenRepresentation_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithCollections_thenRepresentation_ok_TODO.java
new file mode 100644
index 0000000..b6fcf44
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithCollections_thenRepresentation_ok_TODO.java
@@ -0,0 +1,80 @@
+/*
+ * 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.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 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.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.DomainObjectResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+public class Get_givenEntityWithCollections_thenRepresentation_ok_TODO {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+
+ private DomainObjectResource domainObjectResource;
+ private DomainObjectRepresentation domainObjectRepr;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ domainObjectResource = client.getDomainObjectResource();
+
+ }
+
+
+ @Ignore("TODO")
+ @Test
+ public void thenCollections() throws Exception {
+
+ // when
+ final Response jaxrsResponse = domainObjectResource.object("PRMV","29");
+ final RestfulResponse<DomainObjectRepresentation> restfulResponse = RestfulResponse.ofT(jaxrsResponse);
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+
+ // then
+
+ domainObjectRepr = restfulResponse.getEntity();
+ assertThat(domainObjectRepr, is(not(nullValue())));
+
+ // then collections
+
+
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithJdkProperties_thenRepresentation_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithJdkProperties_thenRepresentation_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithJdkProperties_thenRepresentation_ok_TODO.java
new file mode 100644
index 0000000..da262f2
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithJdkProperties_thenRepresentation_ok_TODO.java
@@ -0,0 +1,80 @@
+/*
+ * 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 org.joda.time.LocalDate;
+import org.joda.time.LocalDateTime;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.core.commons.matchers.IsisMatchers;
+import org.apache.isis.core.webserver.WebServer;
+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.domainobjects.DomainObjectMemberRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ScalarValueRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+
+public class Get_givenEntityWithJdkProperties_thenRepresentation_ok_TODO {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+
+ private DomainObjectRepresentation domainObjectRepr;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ }
+
+ @Ignore("TODO")
+ @Test
+ public void thenMembers() throws Exception {
+
+ // when
+ final LinkRepresentation link = Util.domainObjectLink(client, "JdkValuedEntities");
+ domainObjectRepr = client.follow(link).getEntity().as(DomainObjectRepresentation.class);
+
+ // and then members (types)
+ DomainObjectMemberRepresentation property;
+ ScalarValueRepresentation scalarRepr;
+
+
+ // copy from Get_givenEntityWithPrimitiveProperties_thenRepresentation_ok
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithJodaProperties_thenRepresentation_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithJodaProperties_thenRepresentation_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithJodaProperties_thenRepresentation_ok_TODO.java
new file mode 100644
index 0000000..6c21f23
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithJodaProperties_thenRepresentation_ok_TODO.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.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 org.joda.time.LocalDate;
+import org.joda.time.LocalDateTime;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.core.commons.matchers.IsisMatchers;
+import org.apache.isis.core.webserver.WebServer;
+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.domainobjects.DomainObjectMemberRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ScalarValueRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+
+public class Get_givenEntityWithJodaProperties_thenRepresentation_ok_TODO {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+
+ private DomainObjectRepresentation domainObjectRepr;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ }
+
+ @Ignore("TODO")
+ @Test
+ public void thenMembers() throws Exception {
+
+ // when
+ final LinkRepresentation link = Util.domainObjectLink(client, "JodaValuedEntities");
+ domainObjectRepr = client.follow(link).getEntity().as(DomainObjectRepresentation.class);
+
+ // and then members (types)
+ DomainObjectMemberRepresentation property;
+ ScalarValueRepresentation scalarRepr;
+
+ property = domainObjectRepr.getProperty("localDateProperty");
+ assertThat(property.getMemberType(), is("property"));
+ //assertThat(property.getFormat(), is(nullValue())); // should be?
+ //assertThat(property.getXIsisFormat(), is("boolean")); // should be?
+ scalarRepr = property.getRepresentation("value").as(ScalarValueRepresentation.class);
+ //assertThat(scalarRepr.isLocalDate(), is(true));
+ //LocalDate localDateValue = scalarRepr.asLocalDate(); // should be?
+ //assertThat(localDateValue, is(true));
+
+ property = domainObjectRepr.getProperty("localDateTimeProperty");
+ assertThat(property.getMemberType(), is("property"));
+ //assertThat(property.getFormat(), is(nullValue())); // should be?
+ //assertThat(property.getXIsisFormat(), is("byte")); // should be?
+ scalarRepr = property.getRepresentation("value").as(ScalarValueRepresentation.class);
+ //assertThat(scalarRepr.isDateTime(), is(true));
+ //LocalDateTime localDateTimeValue = scalarRepr.asLocalDateTime(); // should be?
+ //assertThat(localDateTimeValue, is((byte)123));
+
+
+ // and then member types have links to details (selected ones inspected only)
+ property = domainObjectRepr.getProperty("localDateProperty");
+ assertThat(property.getLinkWithRel(Rel.DETAILS),
+ isLink()
+ .href(matches(".+\\/objects\\/JODA\\/\\d+\\/properties\\/localDateProperty"))
+ .httpMethod(RestfulHttpMethod.GET)
+ .type(RepresentationType.OBJECT_PROPERTY.getMediaType()));
+
+ property = domainObjectRepr.getProperty("localDateTimeProperty");
+ assertThat(property.getLinkWithRel(Rel.DETAILS),
+ isLink()
+ .href(matches(".+\\/objects\\/JODA\\/\\d+\\/properties\\/localDateTimeProperty"))
+ .httpMethod(RestfulHttpMethod.GET)
+ .type(RepresentationType.OBJECT_PROPERTY.getMediaType()));
+ }
+
+}
[37/50] [abbrv] 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/be2b3ecf
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/be2b3ecf
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/be2b3ecf
Branch: refs/heads/master
Commit: be2b3ecf47301ba7c5ec69448160c9b82b090de0
Parents: fe01643
Author: Dan Haywood <da...@apache.org>
Authored: Thu Apr 11 15:36:30 2013 +0100
Committer: Dan Haywood <da...@apache.org>
Committed: Sat Apr 27 19:01:25 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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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/be2b3ecf/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 {
-
-}
[06/50] [abbrv] ISIS-233-ro: testing domainservices_services resource
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_xrofollowlinks.java
deleted file mode 100644
index 045b8bc..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_xrofollowlinks.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.restfulobjects.tck.resources.service.serviceId;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.Response;
-
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.webserver.WebServer;
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.RequestParameter;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-
-public class DomainServiceResourceTest_serviceId_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 withCriteria() throws Exception {
-
- final String href = givenHrefToService("simples");
-
- final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, href).withArg(RequestParameter.FOLLOW_LINKS, "members[id=%s].links[rel=details]", "list");
- final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- final DomainObjectRepresentation repr = restfulResponse.getEntity();
-
- final JsonRepresentation membersList = repr.getMembers();
- assertThat(membersList, isArray());
-
- JsonRepresentation actionRepr;
-
- actionRepr = membersList.getRepresentation("[id=%s]", "list");
- assertThat(actionRepr.getRepresentation("links[rel=details]"), is(not(nullValue())));
- assertThat(actionRepr.getRepresentation("links[rel=details].value"), is(not(nullValue()))); // followed
-
- actionRepr = membersList.getRepresentation("[id=%s]", "newTransientEntity");
- assertThat(actionRepr.getRepresentation("links[rel=details]"), is(not(nullValue())));
- assertThat(actionRepr.getRepresentation("links[rel=details].value"), is(nullValue())); // not
- // followed
- }
-
- private String givenHrefToService(final String serviceId) throws JsonParseException, JsonMappingException, IOException {
- final DomainServiceResource resource = client.getDomainServiceResource();
- final Response response = resource.services();
- final ListRepresentation services = RestfulResponse.<ListRepresentation> ofT(response).getEntity();
-
- return services.getRepresentation("values[id=%s]", serviceId).asLink().getHref();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_acceptHeader.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_acceptHeader.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_acceptHeader.java
deleted file mode 100644
index af9adf7..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_acceptHeader.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.resources.user;
-
-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 UserResourceTest_acceptHeader {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
- private RestfulRequest request;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
- request = client.createRequest(RestfulHttpMethod.GET, "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/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_representation.java
deleted file mode 100644
index 1dec9b5..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_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.resources.user;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
-import static org.hamcrest.CoreMatchers.endsWith;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status.Family;
-
-import org.apache.isis.viewer.restfulobjects.applib.Rel;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.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 UserResourceTest_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/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_responseHeaders.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_responseHeaders.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_responseHeaders.java
deleted file mode 100644
index f15a265..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_responseHeaders.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.resources.user;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isFollowableLinkToSelf;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
-import static org.hamcrest.CoreMatchers.endsWith;
-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 UserResourceTest_responseHeaders {
-
- @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/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_xrofollowlinks.java
deleted file mode 100644
index 7d683ca..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/user/UserResourceTest_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.resources.user;
-
-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 UserResourceTest_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/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_acceptHeader.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_acceptHeader.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_acceptHeader.java
deleted file mode 100644
index 2efa8e6..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_acceptHeader.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.resources.version;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jboss.resteasy.client.ClientRequest;
-import org.jboss.resteasy.client.ClientResponse;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.webserver.WebServer;
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.user.UserRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.version.VersionRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-
-public class VersionResourceTest_acceptHeader {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- private RestfulRequest request;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
- request = client.createRequest(RestfulHttpMethod.GET, "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/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_representation.java
deleted file mode 100644
index 01eff58..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_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.resources.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.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 VersionResourceTest_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/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_responseHeaders.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_responseHeaders.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_responseHeaders.java
deleted file mode 100644
index 1e29d59..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_responseHeaders.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.resources.version;
-
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
-import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.CacheControl;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.apache.isis.core.webserver.WebServer;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.Header;
-import org.apache.isis.viewer.restfulobjects.applib.version.VersionRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.version.VersionResource;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class VersionResourceTest_responseHeaders {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
- private VersionResource resource;
-
- @Before
- public void setUp() throws Exception {
- final WebServer webServer = webServerRule.getWebServer();
- client = new RestfulClient(webServer.getBase());
-
- resource = client.getVersionResource();
- }
-
-
- @Test
- public void 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/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_xrofollowlinks.java
deleted file mode 100644
index 47f0b2c..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/version/VersionResourceTest_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.resources.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 VersionResourceTest_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())));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/stories/UserStoryTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/stories/UserStoryTest.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/stories/UserStoryTest.java
deleted file mode 100644
index 32db4bb..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/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.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]+$"));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_request_header_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_request_header_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_request_header_accept.java
new file mode 100644
index 0000000..2a24d26
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_request_header_accept.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.user;
+
+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 UserResourceTest_root_request_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/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_request_queryargs_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_request_queryargs_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_request_queryargs_xrofollowlinks.java
new file mode 100644
index 0000000..ddd4b5d
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_request_queryargs_xrofollowlinks.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;
+
+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 UserResourceTest_root_request_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/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_response_headers.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_response_headers.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_response_headers.java
new file mode 100644
index 0000000..f01180d
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_response_headers.java
@@ -0,0 +1,96 @@
+/*
+ * 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;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isFollowableLinkToSelf;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.hamcrest.CoreMatchers.endsWith;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.CacheControl;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status.Family;
+
+import org.apache.isis.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 UserResourceTest_root_response_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/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_response_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_response_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_response_representation.java
new file mode 100644
index 0000000..c6b1da2
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/user/UserResourceTest_root_response_representation.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;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.hamcrest.CoreMatchers.endsWith;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status.Family;
+
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.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 UserResourceTest_root_response_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/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_request_header_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_request_header_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_request_header_accept.java
new file mode 100644
index 0000000..213ce80
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_request_header_accept.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.version;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.MediaType;
+
+import org.jboss.resteasy.client.ClientRequest;
+import org.jboss.resteasy.client.ClientResponse;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.user.UserRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.version.VersionRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+public class VersionResourceTest_root_request_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/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_request_queryargs_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_request_queryargs_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_request_queryargs_xrofollowlinks.java
new file mode 100644
index 0000000..ab966f2
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_request_queryargs_xrofollowlinks.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 VersionResourceTest_root_request_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())));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_response_headers.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_response_headers.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_response_headers.java
new file mode 100644
index 0000000..10d1cbe
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/version/VersionResourceTest_root_response_headers.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.version;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.CacheControl;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.Header;
+import org.apache.isis.viewer.restfulobjects.applib.version.VersionRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.version.VersionResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class VersionResourceTest_root_response_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));
+ }
+
+}
[08/50] [abbrv] ISIS-233-ro: testing domainservices_services resource
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_header_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_header_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_header_accept.java
new file mode 100644
index 0000000..52ea9cd
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_header_accept.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainservice;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.jboss.resteasy.client.ClientRequest;
+import org.jboss.resteasy.client.ClientResponse;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class DomainServiceResourceTest_serviceId_request_header_accept {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+ private RestfulRequest request;
+
+ private String href;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+ href = Util.givenLinkToService(client, "JdkValuedEntities");
+ request = client.createRequest(RestfulHttpMethod.GET, href);
+ }
+
+ @Test
+ public void applicationJson_noProfile_returns200() throws Exception {
+
+ request.withHeader(RestfulRequest.Header.ACCEPT, MediaType.APPLICATION_JSON_TYPE);
+ final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+ }
+
+ @Test
+ public void applicationJson_profileDomainObject_returns200() throws Exception {
+
+ request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.DOMAIN_OBJECT.getMediaType());
+ final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+ }
+
+ @Test
+ public void missingHeader_returns200() throws Exception {
+
+ final RestfulResponse<DomainObjectRepresentation> restfulResp = request.executeT();
+
+ assertThat(restfulResp.getStatus(), is(HttpStatusCode.OK));
+ }
+
+ @Test
+ public void applicationJson_profileIncorrect_returns406() throws Exception {
+
+ request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.VERSION.getMediaType());
+ final RestfulResponse<ListRepresentation> restfulResponse = request.executeT();
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
+ }
+
+ @Test
+ public void incorrectMediaType_returnsNotAcceptable() throws Exception {
+
+ // given
+ final ClientRequest clientRequest = client.getClientRequestFactory().createRequest(href);
+ clientRequest.accept(MediaType.APPLICATION_ATOM_XML_TYPE);
+
+ // when
+ final ClientResponse<?> resp = clientRequest.get();
+ final RestfulResponse<JsonRepresentation> restfulResp = RestfulResponse.of(resp);
+
+ // then
+ assertThat(restfulResp.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrodomainmodel.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrodomainmodel.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrodomainmodel.java
new file mode 100644
index 0000000..02827df
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrodomainmodel.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainservice;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.RequestParameter;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class DomainServiceResourceTest_serviceId_request_queryarg_xrodomainmodel {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+ private RestfulRequest request;
+
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+ String href = Util.givenLinkToService(client, "JdkValuedEntities");
+ request = client.createRequest(RestfulHttpMethod.GET, href);
+ }
+
+ @Test
+ public void simple_rejected() throws Exception {
+
+ request.withArg(RequestParameter.DOMAIN_MODEL, "simple");
+ final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.BAD_REQUEST));
+ assertThat(restfulResponse.getHeader(RestfulResponse.Header.WARNING), is("x-ro-domain-model of 'simple' is not supported"));
+ }
+
+ @Test
+ public void formal_accepted() throws Exception {
+
+ request.withArg(RequestParameter.DOMAIN_MODEL, "formal");
+ final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrofollowlinks.java
new file mode 100644
index 0000000..e354fe7
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_request_queryarg_xrofollowlinks.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainservice;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.Response;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.RequestParameter;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+public class DomainServiceResourceTest_serviceId_request_queryarg_xrofollowlinks {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ }
+
+ @Ignore("todo... the service Id is wrong")
+ @Test
+ public void withCriteria() throws Exception {
+
+ final String href = givenHrefToService("simples");
+
+ final RestfulRequest request = client.createRequest(RestfulHttpMethod.GET, href).withArg(RequestParameter.FOLLOW_LINKS, "members[id=%s].links[rel=details]", "list");
+ final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+ final DomainObjectRepresentation repr = restfulResponse.getEntity();
+
+ final JsonRepresentation membersList = repr.getMembers();
+ assertThat(membersList, isArray());
+
+ JsonRepresentation actionRepr;
+
+ actionRepr = membersList.getRepresentation("[id=%s]", "list");
+ assertThat(actionRepr.getRepresentation("links[rel=details]"), is(not(nullValue())));
+ assertThat(actionRepr.getRepresentation("links[rel=details].value"), is(not(nullValue()))); // followed
+
+ actionRepr = membersList.getRepresentation("[id=%s]", "newTransientEntity");
+ assertThat(actionRepr.getRepresentation("links[rel=details]"), is(not(nullValue())));
+ assertThat(actionRepr.getRepresentation("links[rel=details].value"), is(nullValue())); // not
+ // followed
+ }
+
+ private String givenHrefToService(final String serviceId) throws JsonParseException, JsonMappingException, IOException {
+ final DomainServiceResource resource = client.getDomainServiceResource();
+ final Response response = resource.services();
+ final ListRepresentation services = RestfulResponse.<ListRepresentation> ofT(response).getEntity();
+
+ return services.getRepresentation("values[id=%s]", serviceId).asLink().getHref();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_headers.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_headers.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_headers.java
new file mode 100644
index 0000000..bdac603
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_headers.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainservice;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.Response;
+
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class DomainServiceResourceTest_serviceId_response_headers {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+ private DomainServiceResource resource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+
+ resource = client.getDomainServiceResource();
+ }
+
+ @Test
+ public void headers() throws Exception {
+ // given
+ final Response resp = resource.service("JdkValuedEntities");
+
+ // when
+ final RestfulResponse<DomainObjectRepresentation> jsonResp = RestfulResponse.ofT(resp);
+
+ // then
+ assertThat(jsonResp.getStatus(), is(HttpStatusCode.OK));
+ assertThat(jsonResp.getHeader(RestfulResponse.Header.CONTENT_TYPE), is(RepresentationType.DOMAIN_OBJECT.getMediaType("x-ro-domain-type", "org.apache.isis.core.tck.dom.scalars.JdkValuedEntityRepository")));
+ assertThat(jsonResp.getHeader(RestfulResponse.Header.CACHE_CONTROL).getMaxAge(), is(24 * 60 * 60));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_representation.java
new file mode 100644
index 0000000..107c048
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_response_representation.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainservice;
+
+import static org.apache.isis.core.commons.matchers.IsisMatchers.matches;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.Response;
+
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class DomainServiceResourceTest_serviceId_response_representation {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+ private DomainServiceResource resource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+
+ resource = client.getDomainServiceResource();
+ }
+
+ @Ignore("todo... the service Id is wrong")
+ @Test
+ public void representation() throws Exception {
+
+ // given
+ final Response resp = resource.service("simples");
+
+ // when
+ final RestfulResponse<DomainObjectRepresentation> jsonResp = RestfulResponse.ofT(resp);
+
+ // then
+ assertThat(jsonResp.getStatus(), is(HttpStatusCode.OK));
+
+ final DomainObjectRepresentation repr = jsonResp.getEntity();
+
+ assertThat(repr, isMap());
+
+ assertThat(repr.getSelf(), isLink().httpMethod(RestfulHttpMethod.GET));
+ assertThat(repr.getOid(), matches("OID[:].+"));
+ assertThat(repr.getTitle(), matches("Simples"));
+
+ assertThat(repr.getMembers(), isArray());
+
+ assertThat(repr.getLinks(), isArray());
+ assertThat(repr.getLinks().size(), is(3));
+
+ assertThat(repr.getExtensions(), isMap());
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_status_notFound.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_status_notFound.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_status_notFound.java
new file mode 100644
index 0000000..aa39d8f
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_serviceId_status_notFound.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainservice;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.Response;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+
+public class DomainServiceResourceTest_serviceId_status_notFound {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+ private DomainServiceResource resource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+
+ resource = client.getDomainServiceResource();
+ }
+
+ @Test
+ public void notFound_usingTemplatedMethod() throws Exception {
+
+ // when
+ final Response resp = resource.service("nonExistentServiceId");
+ final RestfulResponse<JsonRepresentation> jsonResp = RestfulResponse.of(resp);
+
+ // then
+ assertThat(jsonResp.getStatus(), is(HttpStatusCode.NOT_FOUND));
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_header_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_header_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_header_accept.java
new file mode 100644
index 0000000..a11478d
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_header_accept.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainservice;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.jboss.resteasy.client.ClientRequest;
+import org.jboss.resteasy.client.ClientResponse;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class DomainServiceResourceTest_services_header_accept {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+ private RestfulRequest request;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+ request = client.createRequest(RestfulHttpMethod.GET, "services");
+ }
+
+ @Test
+ public void applicationJson_noProfile_returns200() throws Exception {
+
+ request.withHeader(RestfulRequest.Header.ACCEPT, MediaType.APPLICATION_JSON_TYPE);
+ final RestfulResponse<ListRepresentation> restfulResponse = request.executeT();
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+ assertThat(restfulResponse.getHeader(RestfulResponse.Header.CONTENT_TYPE), is(RepresentationType.LIST.getMediaType()));
+ }
+
+ @Test
+ public void applicationJson_profileList_returns200() throws Exception {
+
+ request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.LIST.getMediaType());
+ final RestfulResponse<ListRepresentation> restfulResponse = request.executeT();
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+ }
+
+ @Test
+ public void missingHeader_returns200() throws Exception {
+
+ final RestfulResponse<ListRepresentation> restfulResp = request.executeT();
+
+ assertThat(restfulResp.getStatus(), is(HttpStatusCode.OK));
+ }
+
+ @Test
+ public void applicationJson_profileIncorrect_returns406() throws Exception {
+
+ request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.VERSION.getMediaType());
+ final RestfulResponse<ListRepresentation> restfulResponse = request.executeT();
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
+ }
+
+ @Test
+ public void incorrectMediaType_returnsNotAcceptable() throws Exception {
+
+ // given
+ final ClientRequest clientRequest = client.getClientRequestFactory().createRelativeRequest("services");
+ clientRequest.accept(MediaType.APPLICATION_ATOM_XML_TYPE);
+
+ // when
+ final ClientResponse<?> resp = clientRequest.get();
+ final RestfulResponse<JsonRepresentation> restfulResp = RestfulResponse.of(resp);
+
+ // then
+ assertThat(restfulResp.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_queryarg_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_queryarg_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_queryarg_xrofollowlinks.java
new file mode 100644
index 0000000..5414ee9
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_queryarg_xrofollowlinks.java
@@ -0,0 +1,152 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainservice;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.Matchers.greaterThan;
+import static org.junit.Assert.assertThat;
+
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.RequestParameter;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.user.UserRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.hamcrest.Matchers;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class DomainServiceResourceTest_services_queryarg_xrofollowlinks {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ private RestfulRequest request;
+ private RestfulResponse<ListRepresentation> restfulResponse;
+ private ListRepresentation repr;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+
+ }
+
+ @Test
+ public void noFollow() throws Exception {
+
+ request = client.createRequest(RestfulHttpMethod.GET, "services");
+ restfulResponse = request.executeT();
+ repr = restfulResponse.getEntity();
+
+ assertThat(repr.getSelf().getValue(), is(nullValue()));
+ assertThat(repr.getUp().getValue(), is(nullValue()));
+ }
+
+ @Test
+ public void self() throws Exception {
+
+ request = client.createRequest(RestfulHttpMethod.GET, "services")
+ .withArg(RequestParameter.FOLLOW_LINKS, "links[rel=" + Rel.SELF.getName() + "]");
+ restfulResponse = request.executeT();
+ repr = restfulResponse.getEntity();
+
+ assertThat(repr.getSelf().getValue(), is(not(nullValue())));
+ }
+
+ @Test
+ public void up() throws Exception {
+
+ request = client.createRequest(RestfulHttpMethod.GET, "services")
+ .withArg(RequestParameter.FOLLOW_LINKS, "links[rel=" + Rel.UP.getName() + "]");
+ restfulResponse = request.executeT();
+ repr = restfulResponse.getEntity();
+
+ assertThat(repr.getUp().getValue(), is(not(nullValue())));
+ }
+
+ @Test
+ public void value_noQualifications_andSoAllOfThemEagerlyReturned() throws Exception {
+
+ request = client.createRequest(RestfulHttpMethod.GET, "services")
+ .withArg(RequestParameter.FOLLOW_LINKS, "value[rel=" + Rel.SERVICE.getName() + "]");
+ restfulResponse = request.executeT();
+ repr = restfulResponse.getEntity();
+
+ request = client.createRequest(RestfulHttpMethod.GET, "services")
+ .withArg(RequestParameter.FOLLOW_LINKS, "value");
+ restfulResponse = request.executeT();
+ repr = restfulResponse.getEntity();
+
+ // then
+ for (final LinkRepresentation link : repr.getValue().arrayIterable(LinkRepresentation.class)) {
+
+ assertThat(link, isLink(client)
+ .rel(containsString(Rel.SERVICE.getName()))
+ .href(containsString(":39393/"))
+ .httpMethod(RestfulHttpMethod.GET)
+ .type(RepresentationType.DOMAIN_OBJECT.getMediaType())
+ .value(is(not(nullValue(JsonRepresentation.class))))
+ );
+ }
+
+ }
+
+ @Test
+ public void value_withQualification_andSoSingleServiceEagerlyReturned() throws Exception {
+
+ request = client.createRequest(RestfulHttpMethod.GET, "services")
+ .withArg(RequestParameter.FOLLOW_LINKS, "value[rel=" + Rel.SERVICE.getName() + ";serviceId=\"JdkValuedEntities\"]");
+ restfulResponse = request.executeT();
+ repr = restfulResponse.getEntity();
+
+ // then
+ int numWithValue = 0;
+ int numWithoutValue = 0;
+ for (final LinkRepresentation link : repr.getValue().arrayIterable(LinkRepresentation.class)) {
+
+ if(isLink(client).value(is(not(nullValue(JsonRepresentation.class)))).build().matches(link)) {
+ numWithValue++;
+ } else {
+ numWithoutValue++;
+ }
+ }
+
+ assertThat(numWithValue, is(1));
+ assertThat(numWithoutValue, is(greaterThan(0)));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_response_headers.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_response_headers.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_response_headers.java
new file mode 100644
index 0000000..62c06c7
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_response_headers.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainservice;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.CacheControl;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.Header;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class DomainServiceResourceTest_services_response_headers {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+ private DomainServiceResource resource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+ resource = client.getDomainServiceResource();
+ }
+
+
+ @Test
+ public void contentType_and_cacheControl() throws Exception {
+ // given
+ final Response resp = resource.services();
+
+ // when
+ final RestfulResponse<ListRepresentation> restfulResponse = RestfulResponse.ofT(resp);
+
+ // then
+ final MediaType contentType = restfulResponse.getHeader(Header.CONTENT_TYPE);
+ assertThat(contentType, hasType("application"));
+ assertThat(contentType, hasSubType("json"));
+ assertThat(contentType, hasParameter("profile", "urn:org.restfulobjects:repr-types/list"));
+ assertThat(contentType, is(RepresentationType.LIST.getMediaType()));
+
+ // then
+ final CacheControl cacheControl = restfulResponse.getHeader(Header.CACHE_CONTROL);
+ assertThat(cacheControl, hasMaxAge(24 * 60 * 60));
+ assertThat(cacheControl.getMaxAge(), is(24 * 60 * 60));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_response_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_response_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_response_representation.java
new file mode 100644
index 0000000..1241c36
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/DomainServiceResourceTest_services_response_representation.java
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainservice;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.endsWith;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.Response;
+
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class DomainServiceResourceTest_services_response_representation {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+ private DomainServiceResource resource;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+
+ resource = client.getDomainServiceResource();
+ }
+
+ @Test
+ public void representation() throws Exception {
+
+ // when
+ final Response response = resource.services();
+ final RestfulResponse<ListRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ // then
+ final ListRepresentation repr = restfulResponse.getEntity();
+
+ assertThat(repr, isMap());
+
+ assertThat(repr.getSelf(), isLink(client)
+ .rel(Rel.SELF)
+ .href(endsWith(":39393/services"))
+ .httpMethod(RestfulHttpMethod.GET)
+ .type(RepresentationType.LIST.getMediaType())
+ .returning(HttpStatusCode.OK)
+ );
+ assertThat(repr.getUp(), isLink(client)
+ .rel(Rel.UP)
+ .href(endsWith(":39393/"))
+ .httpMethod(RestfulHttpMethod.GET)
+ .type(RepresentationType.HOME_PAGE.getMediaType())
+ .returning(HttpStatusCode.OK)
+ );
+
+ assertThat(repr.getValue(), isArray());
+
+ assertThat(repr.getLinks(), isArray());
+ assertThat(repr.getExtensions(), isMap());
+ }
+
+ @Test
+ public void linksToDomainServiceResources() throws Exception {
+
+ // given
+ final RestfulResponse<ListRepresentation> jsonResp = RestfulResponse.ofT(resource.services());
+ final ListRepresentation repr = jsonResp.getEntity();
+
+ // when
+ final JsonRepresentation values = repr.getValue();
+
+ // then
+ for (final LinkRepresentation link : values.arrayIterable(LinkRepresentation.class)) {
+ assertThat("HiddenRepository should not show up in services list", false, is(link.getHref().endsWith("HiddenRepository")));
+ }
+
+ // and also
+ for (final LinkRepresentation link : values.arrayIterable(LinkRepresentation.class)) {
+
+ assertThat(link, isLink(client)
+ .rel(containsString(Rel.SERVICE.getName()))
+ .href(containsString(":39393/"))
+ .httpMethod(RestfulHttpMethod.GET)
+ .type(RepresentationType.DOMAIN_OBJECT.getMediaType())
+ );
+ assertThat(link, isLink(client)
+ .returning(HttpStatusCode.OK)
+ .responseEntityWithSelfHref(link.getHref())
+ );
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/Util.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/Util.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/Util.java
new file mode 100644
index 0000000..3b64116
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/Util.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainservice;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.Response;
+
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+
+public class Util {
+
+ private Util(){}
+
+ public static String givenLinkToService(RestfulClient restfulClient, String serviceId) throws JsonParseException, JsonMappingException, IOException {
+
+ final DomainServiceResource resource = restfulClient.getDomainServiceResource();
+ final Response response = resource.services();
+ final ListRepresentation services = RestfulResponse.<ListRepresentation> ofT(response).getEntity();
+
+ final String href = services.getRepresentation("value[rel=" + Rel.SERVICE.getName() + ";serviceId=\"" +
+ serviceId +
+ "\"]").asLink().getHref();
+ return href;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_header_accept.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_header_accept.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_header_accept.java
new file mode 100644
index 0000000..8eaf96d
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_header_accept.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.homepage;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.jboss.resteasy.client.ClientRequest;
+import org.jboss.resteasy.client.ClientResponse;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class HomePageResourceTest_root_header_accept {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ private RestfulRequest request;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+ request = client.createRequest(RestfulHttpMethod.GET, "/");
+ }
+
+ @Test
+ public void applicationJson_noProfile_returns200() throws Exception {
+
+ request.withHeader(RestfulRequest.Header.ACCEPT, MediaType.APPLICATION_JSON_TYPE);
+ final RestfulResponse<HomePageRepresentation> restfulResponse = request.executeT();
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+ assertThat(restfulResponse.getHeader(RestfulResponse.Header.CONTENT_TYPE), is(RepresentationType.HOME_PAGE.getMediaType()));
+ }
+
+ @Test
+ public void applicationJson_profileHomePage_returns200() throws Exception {
+
+ request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.HOME_PAGE.getMediaType());
+ final RestfulResponse<HomePageRepresentation> restfulResponse = request.executeT();
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+ }
+
+ @Test
+ public void missingHeader_returns200() throws Exception {
+
+ final RestfulResponse<HomePageRepresentation> restfulResp = request.executeT();
+
+ assertThat(restfulResp.getStatus(), is(HttpStatusCode.OK));
+ }
+
+ @Test
+ public void applicationJson_profileIncorrect_returns406() throws Exception {
+
+ request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.USER.getMediaType());
+ final RestfulResponse<HomePageRepresentation> restfulResponse = request.executeT();
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
+ }
+
+ @Test
+ public void incorrectMediaType_returnsNotAcceptable() throws Exception {
+
+ // given
+ final ClientRequest clientRequest = client.getClientRequestFactory().createRelativeRequest("/");
+ clientRequest.accept(MediaType.APPLICATION_ATOM_XML_TYPE);
+
+ // when
+ final ClientResponse<?> resp = clientRequest.get();
+ final RestfulResponse<JsonRepresentation> restfulResp = RestfulResponse.of(resp);
+
+ // then
+ assertThat(restfulResp.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_queryargs_xrofollowlinks.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_queryargs_xrofollowlinks.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_queryargs_xrofollowlinks.java
new file mode 100644
index 0000000..b3e27d4
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_queryargs_xrofollowlinks.java
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.homepage;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.RequestParameter;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class HomePageResourceTest_root_queryargs_xrofollowlinks {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ private RestfulRequest request;
+ private RestfulResponse<HomePageRepresentation> restfulResponse;
+ private HomePageRepresentation repr;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+
+ }
+
+ @Test
+ public void noFollow() throws Exception {
+ request = client.createRequest(RestfulHttpMethod.GET, "");
+ restfulResponse = request.executeT();
+ repr = restfulResponse.getEntity();
+
+ assertThat(repr.getSelf().getValue(), is(nullValue()));
+ assertThat(repr.getUser().getValue(), is(nullValue()));
+ assertThat(repr.getVersion().getValue(), is(nullValue()));
+ assertThat(repr.getServices().getValue(), is(nullValue()));
+ }
+
+ @Test
+ public void self() throws Exception {
+
+ repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.SELF.getName() + "]");
+
+ assertThat(repr.getSelf().getValue(), is(not(nullValue())));
+ }
+
+ @Test
+ public void user() throws Exception {
+
+ repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.USER.getName() + "]");
+
+ assertThat(repr.getUser().getValue(), is(not(nullValue())));
+ }
+
+ @Test
+ public void services() throws Exception {
+
+ repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.SERVICES.getName() + "]");
+
+ assertThat(repr.getServices().getValue(), is(not(nullValue())));
+ }
+
+ @Test
+ public void version() throws Exception {
+
+ repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.VERSION.getName() + "]");
+
+ assertThat(repr.getVersion().getValue(), is(not(nullValue())));
+ }
+
+ @Test
+ public void multiple() throws Exception {
+
+ repr = whenExecuteAndFollowLinksUsing("/",
+ "links[rel=" + Rel.USER.getName() + "]," +
+ "links[rel=" + Rel.SERVICES.getName() + "]," +
+ "links[rel=" + Rel.VERSION.getName() + "]");
+
+ assertThat(repr.getServices().getValue(), is(not(nullValue())));
+ assertThat(repr.getUser().getValue(), is(not(nullValue())));
+ assertThat(repr.getVersion().getValue(), is(not(nullValue())));
+ }
+
+ @Test
+ public void allServices_Value() throws Exception {
+
+ repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.SERVICES.getName() + "].value");
+
+ final JsonRepresentation servicesValue = repr.getServices().getValue();
+ assertThat(servicesValue, is(not(nullValue())));
+ assertThat(servicesValue, isMap());
+ final JsonRepresentation serviceLinkList = servicesValue.getArray("value");
+ assertThat(serviceLinkList, isArray());
+
+ JsonRepresentation service;
+
+ service = serviceLinkList.getRepresentation("[rel=%s;serviceId=\"%s\"]", Rel.SERVICE.getName(), "JdkValuedEntities");
+ assertThat(service, isMap());
+ assertThat(service.getRepresentation("value"), is(not(nullValue())));
+
+ service = serviceLinkList.getRepresentation("[rel=%s;serviceId=\"%s\"]", Rel.SERVICE.getName(), "WrapperValuedEntities");
+ assertThat(service, isMap());
+ assertThat(service.getRepresentation("value"), is(not(nullValue())));
+ }
+
+ @Test
+ public void selectedService_Value() throws Exception {
+
+ repr = whenExecuteAndFollowLinksUsing("/", "links[rel=" + Rel.SERVICES.getName() + "].value[rel=" + Rel.SERVICE.andParam("serviceId", "WrapperValuedEntities")+"]");
+
+ final JsonRepresentation servicesValue = repr.getServices().getValue();
+ assertThat(servicesValue, is(not(nullValue())));
+ assertThat(servicesValue, isMap());
+ final JsonRepresentation serviceLinkList = servicesValue.getArray("value");
+ assertThat(serviceLinkList, isArray());
+
+ JsonRepresentation service;
+
+ service = serviceLinkList.getRepresentation("[rel=%s;serviceId=\"%s\"]", Rel.SERVICE.getName(), "WrapperValuedEntities");
+ assertThat(service, isMap());
+ assertThat(service.getRepresentation("value"), is(not(nullValue())));
+
+ service = serviceLinkList.getRepresentation("[rel=%s;serviceId=\"%s\"]", Rel.SERVICE.getName(), "JdkValuedEntities");
+ assertThat(service.getRepresentation("value"), is(nullValue()));
+ }
+
+ private HomePageRepresentation whenExecuteAndFollowLinksUsing(final String uriTemplate, final String followLinks) throws JsonParseException, JsonMappingException, IOException {
+ request = client.createRequest(RestfulHttpMethod.GET, uriTemplate).withArg(RequestParameter.FOLLOW_LINKS, followLinks);
+ restfulResponse = request.executeT();
+ return restfulResponse.getEntity();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_response_headers.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_response_headers.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_response_headers.java
new file mode 100644
index 0000000..6b8da68
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_response_headers.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.homepage;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasMaxAge;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasParameter;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasSubType;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.hasType;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.CacheControl;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.Header;
+import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class HomePageResourceTest_root_response_headers {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+ private HomePageResource resource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+ resource = client.getHomePageResource();
+ }
+
+
+ @Test
+ public void contentType_and_cacheControl() throws Exception {
+ // given
+ final Response resp = resource.homePage();
+
+ // when
+ final RestfulResponse<HomePageRepresentation> restfulResponse = RestfulResponse.ofT(resp);
+
+ // then
+ final MediaType contentType = restfulResponse.getHeader(Header.CONTENT_TYPE);
+ assertThat(contentType, hasType("application"));
+ assertThat(contentType, hasSubType("json"));
+ assertThat(contentType, hasParameter("profile", "urn:org.restfulobjects:repr-types/homepage"));
+ assertThat(contentType, is(RepresentationType.HOME_PAGE.getMediaType()));
+
+ // then
+ final CacheControl cacheControl = restfulResponse.getHeader(Header.CACHE_CONTROL);
+ assertThat(cacheControl, hasMaxAge(24 * 60 * 60));
+ assertThat(cacheControl.getMaxAge(), is(24 * 60 * 60));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_response_representation.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_response_representation.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_response_representation.java
new file mode 100644
index 0000000..282165d
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/homepage/HomePageResourceTest_root_response_representation.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.homepage;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.assertThat;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isArray;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isLink;
+import static org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.isMap;
+import static org.hamcrest.CoreMatchers.endsWith;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status.Family;
+
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
+import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class HomePageResourceTest_root_response_representation {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+ private HomePageResource resource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+ resource = client.getHomePageResource();
+ }
+
+ @Test
+ public void representation() throws Exception {
+
+ // given
+ final Response resp = resource.homePage();
+
+ // when
+ final RestfulResponse<HomePageRepresentation> restfulResponse = RestfulResponse.ofT(resp);
+ assertThat(restfulResponse.getStatus().getFamily(), is(Family.SUCCESSFUL));
+
+ // then
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+
+ final HomePageRepresentation repr = restfulResponse.getEntity();
+ assertThat(repr, is(not(nullValue())));
+ assertThat(repr, isMap());
+
+ assertThat(repr.getSelf(), isLink(client)
+ .rel(Rel.SELF)
+ .href(endsWith(":39393/"))
+ .httpMethod(RestfulHttpMethod.GET)
+ .type(RepresentationType.HOME_PAGE.getMediaType())
+ .returning(HttpStatusCode.OK)
+ );
+ assertThat(repr.getUser(), isLink(client)
+ .rel(Rel.USER)
+ .href(endsWith(":39393/user"))
+ .httpMethod(RestfulHttpMethod.GET)
+ .type(RepresentationType.USER.getMediaType())
+ .returning(HttpStatusCode.OK)
+ );
+ assertThat(repr.getServices(), isLink(client)
+ .rel(Rel.SERVICES)
+ .href(endsWith(":39393/services"))
+ .httpMethod(RestfulHttpMethod.GET)
+ .type(RepresentationType.LIST.getMediaType())
+ .returning(HttpStatusCode.OK)
+ );
+ assertThat(repr.getVersion(), isLink(client)
+ .rel(Rel.VERSION)
+ .href(endsWith(":39393/version"))
+ .httpMethod(RestfulHttpMethod.GET)
+ .type(RepresentationType.VERSION.getMediaType())
+ .returning(HttpStatusCode.OK)
+ );
+
+ assertThat(repr.getLinks(), isArray());
+ assertThat(repr.getExtensions(), isMap());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/AnyResourceTest_serverSideException_exceptionHandling.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/AnyResourceTest_serverSideException_exceptionHandling.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/AnyResourceTest_serverSideException_exceptionHandling.java
deleted file mode 100644
index 8aa79ff..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/AnyResourceTest_serverSideException_exceptionHandling.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.restfulobjects.tck.resources;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jboss.resteasy.client.ClientRequest;
-import org.jboss.resteasy.client.ClientResponse;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.webserver.WebServer;
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.Header;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.util.Parser;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-
-public class AnyResourceTest_serverSideException_exceptionHandling {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
-
- @Before
- public void setUp() throws Exception {
- final WebServer webServer = webServerRule.getWebServer();
- client = new RestfulClient(webServer.getBase());
- }
-
- @Test
- public void runtimeException_isMapped() throws Exception {
-
- // given
- final RestfulRequest restfulReq = client.createRequest(RestfulHttpMethod.GET, "version");
- final Header<Boolean> header = new Header<Boolean>("X-FAIL", Parser.forBoolean());
- restfulReq.withHeader(header, true);
-
- // when
- final RestfulResponse<JsonRepresentation> jsonResp = restfulReq.execute();
-
- // then
- assertThat(jsonResp.getStatus(), is(HttpStatusCode.METHOD_FAILURE));
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/1b9a2a74/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_acceptHeader.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_acceptHeader.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_acceptHeader.java
deleted file mode 100644
index c62e641..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/resources/domainService/DomainServiceResourceTest_services_acceptHeader.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.restfulobjects.tck.resources.domainService;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import javax.ws.rs.core.MediaType;
-
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
-import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.user.UserRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-import org.jboss.resteasy.client.ClientRequest;
-import org.jboss.resteasy.client.ClientResponse;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class DomainServiceResourceTest_services_acceptHeader {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- private RestfulClient client;
- private RestfulRequest request;
-
- @Before
- public void setUp() throws Exception {
- client = webServerRule.getClient();
- request = client.createRequest(RestfulHttpMethod.GET, "services");
- }
-
- @Test
- public void applicationJson_noProfile_returns200() throws Exception {
-
- request.withHeader(RestfulRequest.Header.ACCEPT, MediaType.APPLICATION_JSON_TYPE);
- final RestfulResponse<ListRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- assertThat(restfulResponse.getHeader(RestfulResponse.Header.CONTENT_TYPE), is(RepresentationType.LIST.getMediaType()));
- }
-
- @Test
- public void applicationJson_profileList_returns200() throws Exception {
-
- request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.LIST.getMediaType());
- final RestfulResponse<ListRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- }
-
- @Test
- public void missingHeader_returns200() throws Exception {
-
- final RestfulResponse<ListRepresentation> restfulResp = request.executeT();
-
- assertThat(restfulResp.getStatus(), is(HttpStatusCode.OK));
- }
-
- @Test
- public void applicationJson_profileIncorrect_returns406() throws Exception {
-
- request.withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.VERSION.getMediaType());
- final RestfulResponse<ListRepresentation> restfulResponse = request.executeT();
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
- }
-
- @Test
- public void incorrectMediaType_returnsNotAcceptable() throws Exception {
-
- // given
- final ClientRequest clientRequest = client.getClientRequestFactory().createRelativeRequest("services");
- clientRequest.accept(MediaType.APPLICATION_ATOM_XML_TYPE);
-
- // when
- final ClientResponse<?> resp = clientRequest.get();
- final RestfulResponse<JsonRepresentation> restfulResp = RestfulResponse.of(resp);
-
- // then
- assertThat(restfulResp.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
- }
-}
[22/50] [abbrv] git commit: ISIS-233: more testing on actions
Posted by da...@apache.org.
ISIS-233: more testing on actions
... as of this commit, things aren't compiling (in flight)
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/646a07ce
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/646a07ce
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/646a07ce
Branch: refs/heads/master
Commit: 646a07ce0f9cf0c019306dead4326318d7c6c297
Parents: 62bda8d
Author: Dan Haywood <da...@apache.org>
Authored: Thu Mar 7 09:43:13 2013 +0000
Committer: Dan Haywood <da...@apache.org>
Committed: Sat Apr 27 18:59:43 2013 +0100
----------------------------------------------------------------------
.../applib/client/RestfulResponse.java | 24 +
.../applib/domainobjects/DomainObjectResource.java | 3 +-
.../restfulobjects/rendering/util/OidUtils.java | 1 +
.../restfulobjects/server/ResourceContext.java | 25 +-
.../resources/DomainObjectResourceServerside.java | 59 +-
.../server/resources/DomainResourceHelper.java | 50 +-
.../resources/DomainServiceResourceServerside.java | 21 +-
.../server/resources/ResourceAbstract.java | 25 +-
.../restfulobjects/server/util/OidUtils.java | 55 ++-
.../restfulobjects/server/util/UrlParserUtils.java | 16 +-
...ceContextTest_ensureCompatibleAcceptHeader.java | 2 +-
.../server/ResourceContextTest_getArg.java | 4 +-
.../server/util/UrlParserUtilsTest.java | 2 +-
.../restfulobjects/tck/RepresentationMatchers.java | 527 --------------
.../viewer/restfulobjects/tck/RestfulMatchers.java | 560 +++++++++++++++
...ainServiceTest_req_queryarg_xrofollowlinks.java | 8 +-
.../root/DomainServiceTest_resp_headers.java | 8 +-
.../DomainServiceTest_resp_representation.java | 8 +-
...ainServiceTest_req_queryarg_xrofollowlinks.java | 4 +-
.../DomainServiceTest_resp_representation.java | 8 +-
...DomainServiceTest_req_safe_noarg_resp_list.java | 106 +++
.../DomainServiceTest_req_safe_refarg_bad.java | 157 ++++
...ainServiceTest_req_safe_refarg_resp_scalar.java | 177 +++++
...inServiceTest_req_safe_simplearg_resp_list.java | 118 +++
.../invoke/DomainServiceTest_safe_noarg_list.java | 106 ---
.../DomainServiceTest_safe_simplearg_list.java | 123 ----
.../HomePageTest_req_queryargs_xrofollowlinks.java | 4 +-
.../homepage/root/HomePageTest_resp_headers.java | 8 +-
.../root/HomePageTest_resp_representation.java | 8 +-
.../tck/user/root/UserTest_resp_headers.java | 18 +-
.../user/root/UserTest_resp_representation.java | 8 +-
.../tck/version/VersionTest_resp_headers.java | 8 +-
.../version/VersionTest_resp_representation.java | 8 +-
.../DomainObjectTest_get_resp_representation.java | 4 +-
.../core/metamodel/adapter/mgr/AdapterManager.java | 5 +-
.../persistence/ObjectNotFoundException.java | 42 ++
.../persistence/ObjectPersistenceException.java | 42 ++
.../persistence/ObjectNotFoundException.java | 42 --
.../persistence/ObjectPersistenceException.java | 42 --
.../adaptermanager/AdapterManagerDefault.java | 9 +-
.../tck/dom/actions/ActionsEntityRepository.java | 9 +-
41 files changed, 1462 insertions(+), 992 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java
index 371c34e..6357be1 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/client/RestfulResponse.java
@@ -33,6 +33,8 @@ import javax.ws.rs.core.Response.StatusType;
import org.apache.isis.core.commons.lang.StringUtils;
import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ActionResultRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.errors.ErrorRepresentation;
import org.apache.isis.viewer.restfulobjects.applib.util.JsonMapper;
import org.apache.isis.viewer.restfulobjects.applib.util.Parser;
import org.codehaus.jackson.JsonParseException;
@@ -153,8 +155,12 @@ public class RestfulResponse<T> {
public final static HttpStatusCode METHOD_FAILURE = new HttpStatusCode(420, new StatusTypeImpl(420, Family.CLIENT_ERROR, "Method failure"));
// public static final int SC_UNPROCESSABLE_ENTITY = 422;
+ public final static HttpStatusCode VALIDATION_FAILED = new HttpStatusCode(422, new StatusTypeImpl(422, Family.CLIENT_ERROR, "Validation failed"));
+
// public static final int SC_LOCKED = 423;
// public static final int SC_FAILED_DEPENDENCY = 424;
+
+ public final static HttpStatusCode PRECONDITION_HEADER_MISSING = new HttpStatusCode(428, new StatusTypeImpl(428, Family.CLIENT_ERROR, "Precondition header missing"));
public final static HttpStatusCode INTERNAL_SERVER_ERROR = new HttpStatusCode(500, Status.INTERNAL_SERVER_ERROR);
public final static HttpStatusCode NOT_IMPLEMENTED = new HttpStatusCode(501, new StatusTypeImpl(501, Family.SERVER_ERROR, "Not implemented"));
@@ -325,4 +331,22 @@ public class RestfulResponse<T> {
return header.parse(value);
}
+ /**
+ * Convenience that recasts this response as wrapping some other
+ * representation.
+ *
+ * <p>
+ * This would typically be as the results of a content type being an
+ * error rather than a representation returned on success.
+ */
+ @SuppressWarnings("unchecked")
+ public <Q extends JsonRepresentation> RestfulResponse<Q> wraps(Class<Q> cls) {
+ return (RestfulResponse<Q>) this;
+ }
+
+ @Override
+ public String toString() {
+ return "RestfulResponse [httpStatusCode=" + httpStatusCode + "]";
+ }
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectResource.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectResource.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectResource.java
index 2bb58f8..e597e08 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectResource.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectResource.java
@@ -28,6 +28,7 @@ import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@@ -131,7 +132,7 @@ public interface DomainObjectResource {
@Path("/{domainType}/{instanceId}/actions/{actionId}/invoke")
@Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_ACTION_RESULT, RestfulMediaType.APPLICATION_JSON_ERROR })
@ClientResponseType(entityType = String.class)
- public Response invokeActionQueryOnly(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId, @PathParam("actionId") final String actionId);
+ public Response invokeActionQueryOnly(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId, @PathParam("actionId") final String actionId, @QueryParam("x-isis-querystring") final String xIsisQueryString);
@PUT
@Path("/{domainType}/{instanceId}/actions/{actionId}/invoke")
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/util/OidUtils.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/util/OidUtils.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/util/OidUtils.java
index e202bf8..04144a0 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/util/OidUtils.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/util/OidUtils.java
@@ -45,6 +45,7 @@ public final class OidUtils {
return oidStr != null ? getOidMarshaller().splitInstanceId(oidStr): null;
}
+
public static String getOidStr(final RendererContext renderContext, final ObjectAdapter objectAdapter) {
final Oid oid = objectAdapter.getOid();
if(!(oid instanceof RootOid)) {
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/ResourceContext.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/ResourceContext.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/ResourceContext.java
index 016002d..d7a4f58 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/ResourceContext.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/ResourceContext.java
@@ -18,6 +18,7 @@
*/
package org.apache.isis.viewer.restfulobjects.server;
+import java.io.InputStream;
import java.util.Collections;
import java.util.List;
@@ -70,6 +71,7 @@ public class ResourceContext implements RendererContext {
private List<List<String>> followLinks;
private final Where where;
+ private final String queryString;
private JsonRepresentation readQueryStringAsMap;
//////////////////////////////////////////////////////////////////
@@ -78,17 +80,24 @@ public class ResourceContext implements RendererContext {
public ResourceContext(
final RepresentationType representationType,
- final HttpHeaders httpHeaders, final UriInfo uriInfo,
+ final HttpHeaders httpHeaders,
+ final UriInfo uriInfo,
final Request request,
- final HttpServletRequest httpServletRequest, final HttpServletResponse httpServletResponse,
- final SecurityContext securityContext,
- final Localization localization,
- final AuthenticationSession authenticationSession, final PersistenceSession persistenceSession,
- final AdapterManager objectAdapterLookup, final SpecificationLoader specificationLookup, final IsisConfiguration configuration, final Where where) {
+ final Where where,
+ final String queryStringIfAny,
+ final HttpServletRequest httpServletRequest,
+ final HttpServletResponse httpServletResponse,
+ final SecurityContext securityContext,
+ final Localization localization, final AuthenticationSession authenticationSession,
+ final PersistenceSession persistenceSession,
+ final AdapterManager objectAdapterLookup,
+ final SpecificationLoader specificationLookup,
+ final IsisConfiguration configuration) {
this.httpHeaders = httpHeaders;
this.uriInfo = uriInfo;
this.request = request;
+ this.queryString = queryStringIfAny;
this.httpServletRequest = httpServletRequest;
this.httpServletResponse = httpServletResponse;
this.securityContext = securityContext;
@@ -103,6 +112,7 @@ public class ResourceContext implements RendererContext {
init(representationType);
}
+
void init(final RepresentationType representationType) {
ensureCompatibleAcceptHeader(representationType);
ensureDomainModelQueryParamSupported();
@@ -151,6 +161,9 @@ public class ResourceContext implements RendererContext {
}
public String getQueryString() {
+ if(queryString != null) {
+ return queryString;
+ }
return getHttpServletRequest().getQueryString();
}
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainObjectResourceServerside.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainObjectResourceServerside.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainObjectResourceServerside.java
index 56ea459..35ce708 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainObjectResourceServerside.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainObjectResourceServerside.java
@@ -26,6 +26,7 @@ import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@@ -38,7 +39,6 @@ import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
import org.apache.isis.viewer.restfulobjects.applib.RestfulMediaType;
import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
@@ -46,7 +46,6 @@ import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRe
import org.apache.isis.viewer.restfulobjects.server.RestfulObjectsApplicationException;
import org.apache.isis.viewer.restfulobjects.server.resources.DomainResourceHelper.Intent;
import org.apache.isis.viewer.restfulobjects.server.resources.DomainResourceHelper.MemberMode;
-import org.apache.isis.viewer.restfulobjects.server.util.UrlParserUtils;
import org.jboss.resteasy.annotations.ClientResponseType;
@Path("/objects")
@@ -107,7 +106,7 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
public Response object(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId) {
init(RepresentationType.DOMAIN_OBJECT, Where.OBJECT_FORMS);
- final ObjectAdapter objectAdapter = getObjectAdapter(domainType, instanceId);
+ final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, instanceId);
final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), objectAdapter);
return helper.objectRepresentation();
@@ -128,7 +127,7 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
throw RestfulObjectsApplicationException.create(HttpStatusCode.BAD_REQUEST, "Body is not a map; got %s", objectRepr);
}
- final ObjectAdapter objectAdapter = getObjectAdapter(domainType, oidStr);
+ final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, oidStr);
final JsonRepresentation propertiesList = objectRepr.getArrayEnsured("members[memberType=property]");
if (propertiesList == null) {
@@ -173,10 +172,10 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
public Response propertyDetails(@PathParam("domainType") String domainType, @PathParam("instanceId") final String oidStr, @PathParam("propertyId") final String propertyId) {
init(RepresentationType.OBJECT_PROPERTY, Where.OBJECT_FORMS);
- final ObjectAdapter objectAdapter = getObjectAdapter(domainType, oidStr);
+ final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, oidStr);
final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), objectAdapter);
- return helper.propertyDetails(objectAdapter, propertyId, MemberMode.NOT_MUTATING, Caching.NONE, getResourceContext().getWhere());
+ return helper.propertyDetails(propertyId, MemberMode.NOT_MUTATING, Caching.NONE, getResourceContext().getWhere());
}
@Override
@@ -187,7 +186,7 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
public Response modifyProperty(@PathParam("domainType") String domainType, @PathParam("instanceId") final String oidStr, @PathParam("propertyId") final String propertyId, final InputStream body) {
init(Where.OBJECT_FORMS);
- final ObjectAdapter objectAdapter = getObjectAdapter(domainType, oidStr);
+ final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, oidStr);
final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), objectAdapter);
final OneToOneAssociation property = helper.getPropertyThatIsVisibleAndUsable(propertyId, Intent.MUTATE, getResourceContext().getWhere());
@@ -204,7 +203,7 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
property.set(objectAdapter, argAdapter);
- return helper.propertyDetails(objectAdapter, propertyId, MemberMode.MUTATING, Caching.NONE, getResourceContext().getWhere());
+ return helper.propertyDetails(propertyId, MemberMode.MUTATING, Caching.NONE, getResourceContext().getWhere());
}
@Override
@@ -214,7 +213,7 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
public Response clearProperty(@PathParam("domainType") String domainType, @PathParam("instanceId") final String oidStr, @PathParam("propertyId") final String propertyId) {
init(Where.OBJECT_FORMS);
- final ObjectAdapter objectAdapter = getObjectAdapter(domainType, oidStr);
+ final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, oidStr);
final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), objectAdapter);
final OneToOneAssociation property = helper.getPropertyThatIsVisibleAndUsable(propertyId, Intent.MUTATE, getResourceContext().getWhere());
@@ -226,7 +225,7 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
property.set(objectAdapter, null);
- return helper.propertyDetails(objectAdapter, propertyId, MemberMode.MUTATING, Caching.NONE, getResourceContext().getWhere());
+ return helper.propertyDetails(propertyId, MemberMode.MUTATING, Caching.NONE, getResourceContext().getWhere());
}
// //////////////////////////////////////////////////////////
@@ -240,10 +239,10 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
public Response accessCollection(@PathParam("domainType") String domainType, @PathParam("instanceId") final String oidStr, @PathParam("collectionId") final String collectionId) {
init(RepresentationType.OBJECT_COLLECTION, Where.PARENTED_TABLES);
- final ObjectAdapter objectAdapter = getObjectAdapter(domainType, oidStr);
+ final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, oidStr);
final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), objectAdapter);
- return helper.collectionDetails(objectAdapter, collectionId, MemberMode.NOT_MUTATING, Caching.NONE, getResourceContext().getWhere());
+ return helper.collectionDetails(collectionId, MemberMode.NOT_MUTATING, Caching.NONE, getResourceContext().getWhere());
}
@Override
@@ -254,7 +253,7 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
public Response addToSet(@PathParam("domainType") String domainType, @PathParam("instanceId") final String oidStr, @PathParam("collectionId") final String collectionId, final InputStream body) {
init(Where.PARENTED_TABLES);
- final ObjectAdapter objectAdapter = getObjectAdapter(domainType, oidStr);
+ final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, oidStr);
final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), objectAdapter);
final OneToManyAssociation collection = helper.getCollectionThatIsVisibleAndUsable(collectionId, Intent.MUTATE, getResourceContext().getWhere());
@@ -274,7 +273,7 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
collection.addElement(objectAdapter, argAdapter);
- return helper.collectionDetails(objectAdapter, collectionId, MemberMode.MUTATING, Caching.NONE, getResourceContext().getWhere());
+ return helper.collectionDetails(collectionId, MemberMode.MUTATING, Caching.NONE, getResourceContext().getWhere());
}
@Override
@@ -285,7 +284,7 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
public Response addToList(@PathParam("domainType") String domainType, @PathParam("instanceId") final String oidStr, @PathParam("collectionId") final String collectionId, final InputStream body) {
init(Where.PARENTED_TABLES);
- final ObjectAdapter objectAdapter = getObjectAdapter(domainType, oidStr);
+ final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, oidStr);
final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), objectAdapter);
final OneToManyAssociation collection = helper.getCollectionThatIsVisibleAndUsable(collectionId, Intent.MUTATE, getResourceContext().getWhere());
@@ -305,7 +304,7 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
collection.addElement(objectAdapter, argAdapter);
- return helper.collectionDetails(objectAdapter, collectionId, MemberMode.MUTATING, Caching.NONE, getResourceContext().getWhere());
+ return helper.collectionDetails(collectionId, MemberMode.MUTATING, Caching.NONE, getResourceContext().getWhere());
}
@Override
@@ -315,7 +314,7 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
public Response removeFromCollection(@PathParam("domainType") String domainType, @PathParam("instanceId") final String oidStr, @PathParam("collectionId") final String collectionId) {
init(Where.PARENTED_TABLES);
- final ObjectAdapter objectAdapter = getObjectAdapter(domainType, oidStr);
+ final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, oidStr);
final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), objectAdapter);
final OneToManyAssociation collection = helper.getCollectionThatIsVisibleAndUsable(collectionId, Intent.MUTATE, getResourceContext().getWhere());
@@ -330,7 +329,7 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
collection.removeElement(objectAdapter, argAdapter);
- return helper.collectionDetails(objectAdapter, collectionId, MemberMode.MUTATING, Caching.NONE, getResourceContext().getWhere());
+ return helper.collectionDetails(collectionId, MemberMode.MUTATING, Caching.NONE, getResourceContext().getWhere());
}
// //////////////////////////////////////////////////////////
@@ -344,7 +343,7 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
public Response actionPrompt(@PathParam("domainType") String domainType, @PathParam("instanceId") final String oidStr, @PathParam("actionId") final String actionId) {
init(RepresentationType.OBJECT_ACTION, Where.OBJECT_FORMS);
- final ObjectAdapter objectAdapter = getObjectAdapter(domainType, oidStr);
+ final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, oidStr);
final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), objectAdapter);
return helper.actionPrompt(actionId, getResourceContext().getWhere());
@@ -358,12 +357,12 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
@GET
@Path("/{domainType}/{instanceId}/actions/{actionId}/invoke")
@Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_ACTION_RESULT, RestfulMediaType.APPLICATION_JSON_ERROR })
- public Response invokeActionQueryOnly(@PathParam("domainType") String domainType, @PathParam("instanceId") final String oidStr, @PathParam("actionId") final String actionId) {
- init(RepresentationType.ACTION_RESULT, Where.STANDALONE_TABLES);
+ public Response invokeActionQueryOnly(@PathParam("domainType") String domainType, @PathParam("instanceId") final String oidStr, @PathParam("actionId") final String actionId, @QueryParam("x-isis-querystring") final String xIsisQueryString) {
+ init(RepresentationType.ACTION_RESULT, Where.STANDALONE_TABLES, xIsisQueryString);
final JsonRepresentation arguments = getResourceContext().getQueryStringAsJsonRepr();
- final ObjectAdapter objectAdapter = getObjectAdapter(domainType, oidStr);
+ final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, oidStr);
final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), objectAdapter);
return helper.invokeActionQueryOnly(actionId, arguments, getResourceContext().getWhere());
@@ -374,10 +373,12 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
@Path("/{domainType}/{instanceId}/actions/{actionId}/invoke")
@Consumes({ MediaType.WILDCARD })
@Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_ACTION_RESULT, RestfulMediaType.APPLICATION_JSON_ERROR })
- public Response invokeActionIdempotent(@PathParam("domainType") String domainType, @PathParam("instanceId") final String oidStr, @PathParam("actionId") final String actionId, final InputStream arguments) {
- init(RepresentationType.ACTION_RESULT, Where.STANDALONE_TABLES);
+ public Response invokeActionIdempotent(@PathParam("domainType") String domainType, @PathParam("instanceId") final String oidStr, @PathParam("actionId") final String actionId, final InputStream body) {
+ init(RepresentationType.ACTION_RESULT, Where.STANDALONE_TABLES, body);
- final ObjectAdapter objectAdapter = getObjectAdapter(domainType, oidStr);
+ final JsonRepresentation arguments = getResourceContext().getQueryStringAsJsonRepr();
+
+ final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, oidStr);
final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), objectAdapter);
return helper.invokeActionIdempotent(actionId, arguments, getResourceContext().getWhere());
@@ -389,12 +390,14 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
@Consumes({ MediaType.WILDCARD })
@Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_ACTION_RESULT, RestfulMediaType.APPLICATION_JSON_ERROR })
public Response invokeAction(@PathParam("domainType") String domainType, @PathParam("instanceId") final String oidStr, @PathParam("actionId") final String actionId, final InputStream body) {
- init(RepresentationType.ACTION_RESULT, Where.STANDALONE_TABLES);
+ init(RepresentationType.ACTION_RESULT, Where.STANDALONE_TABLES, body);
- final ObjectAdapter objectAdapter = getObjectAdapter(domainType, oidStr);
+ final JsonRepresentation arguments = getResourceContext().getQueryStringAsJsonRepr();
+
+ final ObjectAdapter objectAdapter = getObjectAdapterElseThrowNotFound(domainType, oidStr);
final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), objectAdapter);
- return helper.invokeAction(actionId, body, getResourceContext().getWhere());
+ return helper.invokeAction(actionId, arguments, getResourceContext().getWhere());
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
index 9fcbb3a..e1a8d85 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainResourceHelper.java
@@ -32,6 +32,7 @@ import org.apache.isis.applib.annotation.ActionSemantics;
import org.apache.isis.applib.annotation.Where;
import org.apache.isis.core.commons.authentication.AuthenticationSession;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.oid.RootOid;
import org.apache.isis.core.metamodel.adapter.version.Version;
import org.apache.isis.core.metamodel.consent.Consent;
import org.apache.isis.core.metamodel.facets.object.value.ValueFacet;
@@ -125,7 +126,14 @@ public final class DomainResourceHelper {
allOk = false;
continue;
}
- final ObjectAdapter valueAdapter = objectAdapterFor(resourceContext, propertySpec, valueRepr);
+ final ObjectAdapter valueAdapter;
+ try {
+ valueAdapter = objectAdapterFor(resourceContext, propertySpec, valueRepr);
+ } catch(IllegalArgumentException ex) {
+ propertyRepr.mapPut("invalidReason", ex.getMessage());
+ allOk = false;
+ continue;
+ }
final Consent consent = property.isAssociationValid(objectAdapter, valueAdapter);
if (consent.isAllowed()) {
try {
@@ -181,7 +189,7 @@ public final class DomainResourceHelper {
public abstract void apply(AbstractObjectMemberReprRenderer<?, ?> renderer);
}
- Response propertyDetails(final ObjectAdapter objectAdapter, final String propertyId, final MemberMode memberMode, final Caching caching, Where where) {
+ Response propertyDetails(final String propertyId, final MemberMode memberMode, final Caching caching, Where where) {
final OneToOneAssociation property = getPropertyThatIsVisibleAndUsable(propertyId, Intent.ACCESS, where);
@@ -198,7 +206,7 @@ public final class DomainResourceHelper {
// collectionDetails
// //////////////////////////////////////////////////////////////
- Response collectionDetails(final ObjectAdapter objectAdapter, final String collectionId, final MemberMode memberMode, final Caching caching, Where where) {
+ Response collectionDetails(final String collectionId, final MemberMode memberMode, final Caching caching, Where where) {
final OneToManyAssociation collection = getCollectionThatIsVisibleAndUsable(collectionId, Intent.ACCESS, where);
@@ -248,7 +256,7 @@ public final class DomainResourceHelper {
return invokeActionUsingAdapters(action, arguments);
}
- Response invokeActionIdempotent(final String actionId, final InputStream body, Where where) {
+ Response invokeActionIdempotent(final String actionId, final JsonRepresentation arguments, Where where) {
final ObjectAction action = getObjectActionThatIsVisibleAndUsable(actionId, Intent.MUTATE, where);
@@ -256,22 +264,16 @@ public final class DomainResourceHelper {
if (!actionSemantics.isIdempotentInNature()) {
throw RestfulObjectsApplicationException.create(HttpStatusCode.METHOD_NOT_ALLOWED, "Method not allowed; action '%s' is not idempotent", action.getId());
}
- final String bodyAsString = asStringUtf8(body);
- final JsonRepresentation arguments = readAsMap(bodyAsString);
-
return invokeActionUsingAdapters(action, arguments);
}
- Response invokeAction(final String actionId, final InputStream body, Where where) {
+ Response invokeAction(final String actionId, final JsonRepresentation arguments, Where where) {
final ObjectAction action = getObjectActionThatIsVisibleAndUsable(actionId, Intent.MUTATE, where);
- final String bodyAsString = asStringUtf8(body);
- final JsonRepresentation arguments = readAsMap(bodyAsString);
-
return invokeActionUsingAdapters(action, arguments);
}
- Response invokeActionUsingAdapters(final ObjectAction action, final JsonRepresentation arguments) {
+ private Response invokeActionUsingAdapters(final ObjectAction action, final JsonRepresentation arguments) {
final List<ObjectAdapter> argAdapters = parseArguments(action, arguments);
@@ -322,7 +324,7 @@ public final class DomainResourceHelper {
* @param resourceContext
* @param objectSpec
* - the {@link ObjectSpecification} to interpret the object as.
- * @param node
+ * @param representation
* - expected to be either a String or a Map (ie from within a
* List, built by parsing a JSON structure).
*/
@@ -339,17 +341,16 @@ public final class DomainResourceHelper {
// reference
if (!representation.isLink()) {
- throw new ExpectedMapRepresentingLinkException();
+ throw new IllegalArgumentException("Expected a link (because this object's type is not a value) but found no 'href'");
}
- final JsonRepresentation argLink = representation.asLink();
- final String oidFromHref = UrlParserUtils.oidFromLink(argLink);
+ final String oidFromHref = UrlParserUtils.encodedOidFromLink(representation);
if (oidFromHref == null) {
- throw new ExpectedMapRepresentingLinkException();
+ throw new IllegalArgumentException("Could not parse 'href' to identify the object's OID");
}
- final ObjectAdapter objectAdapter = OidUtils.getObjectAdapter(resourceContext, oidFromHref);
+ final ObjectAdapter objectAdapter = OidUtils.getObjectAdapterElseNull(resourceContext, oidFromHref);
if (objectAdapter == null) {
- throw new UnknownOidException(oidFromHref);
+ throw new IllegalArgumentException("Object not found for 'href'");
}
return objectAdapter;
}
@@ -371,17 +372,6 @@ public final class DomainResourceHelper {
return objectAdapterFor(resourceContext, spec, representation);
}
- private static class ExpectedMapRepresentingLinkException extends IllegalArgumentException {
- private static final long serialVersionUID = 1L;
- }
-
- private static class UnknownOidException extends IllegalArgumentException {
- private static final long serialVersionUID = 1L;
-
- public UnknownOidException(final String oid) {
- super(UrlDecoderUtils.urlDecode(oid));
- }
- }
// ///////////////////////////////////////////////////////////////////
// get{MemberType}ThatIsVisibleAndUsable
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java
index da3254a..60d81ce 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java
@@ -98,7 +98,7 @@ public class DomainServiceResourceServerside extends ResourceAbstract implements
final ObjectAdapter serviceAdapter = getServiceAdapter(serviceId);
final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), serviceAdapter).using(new DomainServiceLinkTo());
- return helper.propertyDetails(serviceAdapter, propertyId, MemberMode.NOT_MUTATING, Caching.ONE_DAY, getResourceContext().getWhere());
+ return helper.propertyDetails(propertyId, MemberMode.NOT_MUTATING, Caching.ONE_DAY, getResourceContext().getWhere());
}
// //////////////////////////////////////////////////////////
@@ -127,10 +127,9 @@ public class DomainServiceResourceServerside extends ResourceAbstract implements
@Path("/{serviceId}/actions/{actionId}/invoke")
@Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_ACTION_RESULT, RestfulMediaType.APPLICATION_JSON_ERROR })
public Response invokeActionQueryOnly(@PathParam("serviceId") final String serviceId, @PathParam("actionId") final String actionId, @QueryParam("x-isis-querystring") final String xIsisQueryString) {
- init(RepresentationType.ACTION_RESULT, Where.STANDALONE_TABLES);
+ init(RepresentationType.ACTION_RESULT, Where.STANDALONE_TABLES, xIsisQueryString);
- final JsonRepresentation arguments = DomainResourceHelper.readQueryStringAsMap(
- xIsisQueryString != null? xIsisQueryString : getResourceContext().getQueryString());
+ final JsonRepresentation arguments = getResourceContext().getQueryStringAsJsonRepr();
final ObjectAdapter serviceAdapter = getServiceAdapter(serviceId);
final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), serviceAdapter).using(new DomainServiceLinkTo());
@@ -138,30 +137,36 @@ public class DomainServiceResourceServerside extends ResourceAbstract implements
return helper.invokeActionQueryOnly(actionId, arguments, getResourceContext().getWhere());
}
+
@Override
@PUT
@Path("/{serviceId}/actions/{actionId}/invoke")
@Consumes({ MediaType.WILDCARD })
// to save the client having to specify a Content-Type: application/json
@Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_ACTION_RESULT, RestfulMediaType.APPLICATION_JSON_ERROR })
- public Response invokeActionIdempotent(@PathParam("serviceId") final String serviceId, @PathParam("actionId") final String actionId, final InputStream arguments) {
- init(RepresentationType.ACTION_RESULT, Where.STANDALONE_TABLES);
+ public Response invokeActionIdempotent(@PathParam("serviceId") final String serviceId, @PathParam("actionId") final String actionId, final InputStream body) {
+ init(RepresentationType.ACTION_RESULT, Where.STANDALONE_TABLES, body);
+ final JsonRepresentation arguments = getResourceContext().getQueryStringAsJsonRepr();
+
final ObjectAdapter serviceAdapter = getServiceAdapter(serviceId);
final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), serviceAdapter).using(new DomainServiceLinkTo());
return helper.invokeActionIdempotent(actionId, arguments, getResourceContext().getWhere());
}
+
@Override
@POST
@Path("/{serviceId}/actions/{actionId}/invoke")
@Consumes({ MediaType.WILDCARD })
// to save the client having to specify a Content-Type: application/json
@Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_ACTION_RESULT, RestfulMediaType.APPLICATION_JSON_ERROR })
- public Response invokeAction(@PathParam("serviceId") final String serviceId, @PathParam("actionId") final String actionId, final InputStream arguments) {
- init(RepresentationType.ACTION_RESULT, Where.STANDALONE_TABLES);
+ public Response invokeAction(@PathParam("serviceId") final String serviceId, @PathParam("actionId") final String actionId, final InputStream body) {
+ init(RepresentationType.ACTION_RESULT, Where.STANDALONE_TABLES, body);
+ final JsonRepresentation arguments = getResourceContext().getQueryStringAsJsonRepr();
+
final ObjectAdapter serviceAdapter = getServiceAdapter(serviceId);
final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), serviceAdapter).using(new DomainServiceLinkTo());
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java
index 248f408..b3a5a69 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java
@@ -19,6 +19,7 @@
package org.apache.isis.viewer.restfulobjects.server.resources;
import java.io.IOException;
+import java.io.InputStream;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -50,6 +51,7 @@ import org.apache.isis.core.metamodel.services.ServiceUtil;
import org.apache.isis.core.metamodel.spec.ActionType;
import org.apache.isis.core.metamodel.spec.ObjectSpecification;
import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
+import org.apache.isis.core.runtime.persistence.ObjectNotFoundException;
import org.apache.isis.core.runtime.system.context.IsisContext;
import org.apache.isis.core.runtime.system.persistence.OidGenerator;
import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
@@ -118,6 +120,15 @@ public abstract class ResourceAbstract {
}
protected void init(final RepresentationType representationType, Where where) {
+ init(representationType, where, (String)null);
+ }
+
+ protected void init(RepresentationType representationType, Where where, InputStream arguments) {
+ final String queryString = DomainResourceHelper.asStringUtf8(arguments);
+ init(representationType, where, queryString);
+ }
+
+ protected void init(RepresentationType representationType, Where where, String queryString) {
if (!IsisContext.inSession()) {
throw RestfulObjectsApplicationException.create(HttpStatusCode.UNAUTHORIZED);
}
@@ -125,7 +136,9 @@ public abstract class ResourceAbstract {
throw RestfulObjectsApplicationException.create(HttpStatusCode.UNAUTHORIZED);
}
- this.resourceContext = new ResourceContext(representationType, httpHeaders, uriInfo, request, httpServletRequest, httpServletResponse, securityContext, getLocalization(), getAuthenticationSession(), getPersistenceSession(), getAdapterManager(), getSpecificationLoader(), getConfiguration(), where);
+ this.resourceContext = new ResourceContext(
+ representationType, httpHeaders, uriInfo, request, where, queryString, httpServletRequest, httpServletResponse,
+ securityContext, getLocalization(), getAuthenticationSession(), getPersistenceSession(), getAdapterManager(), getSpecificationLoader(), getConfiguration());
}
protected ResourceContext getResourceContext() {
@@ -156,9 +169,8 @@ public abstract class ResourceAbstract {
return getSpecificationLoader().loadSpecification(specFullName);
}
- protected ObjectAdapter getObjectAdapter(String domainType, final String instanceId) {
-
- final ObjectAdapter objectAdapter = OidUtils.getObjectAdapter(resourceContext, domainType, instanceId);
+ protected ObjectAdapter getObjectAdapterElseThrowNotFound(String domainType, final String instanceId) {
+ ObjectAdapter objectAdapter = getObjectAdapterElseNull(domainType, instanceId);
if (objectAdapter == null) {
final String instanceIdUnencoded = UrlDecoderUtils.urlDecode(instanceId);
@@ -167,6 +179,11 @@ public abstract class ResourceAbstract {
return objectAdapter;
}
+ protected ObjectAdapter getObjectAdapterElseNull(String domainType, final String instanceId) {
+ return OidUtils.getObjectAdapterElseNull(resourceContext, domainType, instanceId);
+ }
+
+ // REVIEW: a bit of a hack to just 'new' up the OidMarshaller...
OidMarshaller getOidMarshaller() {
return new OidMarshaller();
}
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/util/OidUtils.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/util/OidUtils.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/util/OidUtils.java
index 93798e2..9785adf 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/util/OidUtils.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/util/OidUtils.java
@@ -22,6 +22,7 @@ import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
import org.apache.isis.core.metamodel.adapter.oid.RootOid;
import org.apache.isis.core.metamodel.adapter.oid.RootOidDefault;
+import org.apache.isis.core.runtime.persistence.ObjectNotFoundException;
import org.apache.isis.viewer.restfulobjects.rendering.RendererContext;
public final class OidUtils {
@@ -36,23 +37,57 @@ public final class OidUtils {
public static String getInstanceId(final RendererContext renderContext, final ObjectAdapter objectAdapter) {
return org.apache.isis.viewer.restfulobjects.rendering.util.OidUtils.getInstanceId(renderContext, objectAdapter);
}
-
- public static ObjectAdapter getObjectAdapter(final RendererContext resourceContext, final String domainType, final String instanceId) {
- final String instanceIdUnencoded = UrlDecoderUtils.urlDecode(instanceId);
-
- // REVIEW: it's a bit hokey to join these together just to split them out again.
- final String oidStr = getOidMarshaller().joinAsOid(domainType, instanceIdUnencoded);
+ // REVIEW: it's a bit hokey to join these together just to split them out again.
+ public static String joinAsOid(final String domainType, final String instanceIdEncoded) {
+ final String instanceIdUnencoded = UrlDecoderUtils.urlDecode(instanceIdEncoded);
- return getObjectAdapterForUnencoded(resourceContext, oidStr);
+ return getOidMarshaller().joinAsOid(domainType, instanceIdUnencoded);
+ }
+
+ /**
+ *
+ * @return {@code null} if not found.
+ */
+ public static ObjectAdapter getObjectAdapterElseNull(final RendererContext resourceContext, final String domainType, final String instanceId) throws ObjectNotFoundException {
+ try {
+ return getObjectAdapterElseThrowNotFound(resourceContext, domainType, instanceId);
+ } catch(ObjectNotFoundException ex) {
+ return null;
+ }
+ }
+
+ /**
+ *
+ * @throws {@link ObjectNotFoundException} if not found
+ */
+ public static ObjectAdapter getObjectAdapterElseThrowNotFound(final RendererContext resourceContext, final String domainType, final String instanceId) throws ObjectNotFoundException {
+ final String oidStr = joinAsOid(domainType, instanceId);
+ return getObjectAdapterForUnencodedElseThrowNotFound(resourceContext, oidStr);
+ }
+
+ /**
+ *
+ * @return {@code null} if not found.
+ */
+ public static ObjectAdapter getObjectAdapterElseNull(final RendererContext resourceContext, final String oidEncodedStr) {
+ try {
+ return getObjectAdapterElseThrowNotFound(resourceContext, oidEncodedStr);
+ } catch(ObjectNotFoundException ex) {
+ return null;
+ }
}
- public static ObjectAdapter getObjectAdapter(final RendererContext resourceContext, final String oidEncodedStr) {
+ /**
+ *
+ * @throws {@link ObjectNotFoundException} if not found
+ */
+ public static ObjectAdapter getObjectAdapterElseThrowNotFound(final RendererContext resourceContext, final String oidEncodedStr) {
final String oidStr = UrlDecoderUtils.urlDecode(oidEncodedStr);
- return getObjectAdapterForUnencoded(resourceContext, oidStr);
+ return getObjectAdapterForUnencodedElseThrowNotFound(resourceContext, oidStr);
}
- private static ObjectAdapter getObjectAdapterForUnencoded(final RendererContext resourceContext, final String oidStr) {
+ private static ObjectAdapter getObjectAdapterForUnencodedElseThrowNotFound(final RendererContext resourceContext, final String oidStr) {
final RootOid rootOid = RootOidDefault.deStringEncoded(oidStr, getOidMarshaller());
return resourceContext.getAdapterManager().adapterFor(rootOid);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/util/UrlParserUtils.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/util/UrlParserUtils.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/util/UrlParserUtils.java
index f54520c..4921a1b 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/util/UrlParserUtils.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/util/UrlParserUtils.java
@@ -21,20 +21,24 @@ package org.apache.isis.viewer.restfulobjects.server.util;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
public final class UrlParserUtils {
- private final static Pattern OBJECT_OID = Pattern.compile(".*objects\\/(.+)");;
- private final static Pattern DOMAIN_TYPE = Pattern.compile(".*domainTypes\\/([^/]+).*");;
+ private final static Pattern OBJECT_OID = Pattern.compile(".*objects\\/([^/]+)\\/(.+)");;
+ private final static Pattern DOMAIN_TYPE = Pattern.compile(".*domain-types\\/([^/]+).*");;
- public final static String oidFromLink(final JsonRepresentation link) {
+ public final static String encodedOidFromLink(final JsonRepresentation link) {
final String href = link.getString("href");
+
final Matcher matcher = OBJECT_OID.matcher(href);
if (!matcher.matches()) {
return null;
}
- return matcher.group(1);
+ String domainType = matcher.group(1);
+ String instanceId = matcher.group(2);
+ return getOidMarshaller().joinAsOid(domainType, instanceId);
}
public final static String domainTypeFrom(final JsonRepresentation link) {
@@ -49,4 +53,8 @@ public final class UrlParserUtils {
return matcher.group(1);
}
+ private static OidMarshaller getOidMarshaller() {
+ return new OidMarshaller();
+ }
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/ResourceContextTest_ensureCompatibleAcceptHeader.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/ResourceContextTest_ensureCompatibleAcceptHeader.java b/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/ResourceContextTest_ensureCompatibleAcceptHeader.java
index cd27f5a..37dcd89 100644
--- a/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/ResourceContextTest_ensureCompatibleAcceptHeader.java
+++ b/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/ResourceContextTest_ensureCompatibleAcceptHeader.java
@@ -141,7 +141,7 @@ public class ResourceContextTest_ensureCompatibleAcceptHeader {
}
private ResourceContext instantiateResourceContext(final RepresentationType representationType) {
- return new ResourceContext(representationType, httpHeaders, null, null, httpServletRequest, null, null, null, null, null, null, null, null, null);
+ return new ResourceContext(representationType, httpHeaders, null, null, null, (String)null, httpServletRequest, null, null, null, null, null, null, null, null);
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/ResourceContextTest_getArg.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/ResourceContextTest_getArg.java b/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/ResourceContextTest_getArg.java
index ba17f93..ba7a1d5 100644
--- a/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/ResourceContextTest_getArg.java
+++ b/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/ResourceContextTest_getArg.java
@@ -56,7 +56,7 @@ public class ResourceContextTest_getArg {
will(returnValue(queryString));
}
});
- resourceContext = new ResourceContext(null, null, null, null, httpServletRequest, null, null, null, null, null, null, null, null, null) {
+ resourceContext = new ResourceContext(null, null, null, null, null, (String)null, httpServletRequest, null, null, null, null, null, null, null, null) {
@Override
void init(final RepresentationType representationType) {
//
@@ -76,7 +76,7 @@ public class ResourceContextTest_getArg {
will(returnValue(queryString));
}
});
- resourceContext = new ResourceContext(null, null, null, null, httpServletRequest, null, null, null, null, null, null, null, null, null) {
+ resourceContext = new ResourceContext(null, null, null, null, null, (String)null, httpServletRequest, null, null, null, null, null, null, null, null) {
@Override
void init(final RepresentationType representationType) {
//
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/util/UrlParserUtilsTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/util/UrlParserUtilsTest.java b/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/util/UrlParserUtilsTest.java
index b57e173..f564834 100644
--- a/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/util/UrlParserUtilsTest.java
+++ b/component/viewer/restfulobjects/server/src/test/java/org/apache/isis/viewer/restfulobjects/server/util/UrlParserUtilsTest.java
@@ -29,7 +29,7 @@ public class UrlParserUtilsTest {
public void oidFromLink() throws Exception {
final JsonRepresentation link = JsonRepresentation.newMap();
link.mapPut("href", "http://localhost/objects/OID:1");
- final String oidFromHref = UrlParserUtils.oidFromLink(link);
+ final String oidFromHref = UrlParserUtils.encodedOidFromLink(link);
assertEquals("OID:1", oidFromHref);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/RepresentationMatchers.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/RepresentationMatchers.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/RepresentationMatchers.java
deleted file mode 100644
index b9cc167..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/RepresentationMatchers.java
+++ /dev/null
@@ -1,527 +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;
-
-import java.io.IOException;
-
-import javax.ws.rs.core.CacheControl;
-import javax.ws.rs.core.MediaType;
-
-import com.google.common.base.Objects;
-
-import org.hamcrest.Description;
-import org.hamcrest.Matcher;
-import org.hamcrest.TypeSafeMatcher;
-import org.junit.Assert;
-
-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.JsonRepresentation.HasLinkToSelf;
-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.tck.RepresentationMatchers.AbstractMatcherBuilder;
-import org.apache.isis.viewer.restfulobjects.tck.RepresentationMatchers.LinkMatcherBuilder;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-
-public class RepresentationMatchers {
-
- 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);
- }
- };
- }
-
-}
[46/50] [abbrv] ISIS-233: more tck tests for RO viewer.
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_ContentLength_ok_TODO.java
index 5905a2c..7de8aa6 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_ContentLength_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_ContentLength_ok_TODO.java
@@ -39,23 +39,4 @@ public class Put_thenResponseHeaders_ContentLength_ok_TODO {
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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_ContentType_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_ContentType_ok_TODO.java
index 8b1edee..78ab327 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_ContentType_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/collection/Put_thenResponseHeaders_ContentType_ok_TODO.java
@@ -39,23 +39,4 @@ public class Put_thenResponseHeaders_ContentType_ok_TODO {
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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_CacheControl_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_CacheControl_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_CacheControl_ok_TODO.java
index 080558e..828224c 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_CacheControl_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_CacheControl_ok_TODO.java
@@ -39,23 +39,4 @@ public class Delete_thenResponseHeaders_CacheControl_ok_TODO {
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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_ContentLength_ok_TODO.java
index 6817fbc..5fcfd83 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_ContentLength_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_ContentLength_ok_TODO.java
@@ -39,23 +39,5 @@ public class Delete_thenResponseHeaders_ContentLength_ok_TODO {
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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_ContentType_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_ContentType_ok_TODO.java
index e943156..7438f08 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_ContentType_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Delete_thenResponseHeaders_ContentType_ok_TODO.java
@@ -39,23 +39,4 @@ public class Delete_thenResponseHeaders_ContentType_ok_TODO {
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/430e8b3c/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
index ef674ce..05ef7a9 100644
--- 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
@@ -1,5 +1,78 @@
package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+import static org.apache.isis.core.commons.matchers.IsisMatchers.matches;
+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.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.core.tck.dom.scalars.ApplibValuedEntityRepository;
+import org.apache.isis.core.webserver.WebServer;
+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.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectPropertyRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
public class Get_thenRepresentation_ok_TODO {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+ private DomainObjectResource domainObjectResource;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ domainObjectResource = client.getDomainObjectResource();
+ }
+
+
+ @Ignore("to get working again")
+ @Test
+ public void propertyDetails() throws Exception {
+
+ // 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())));
+ }
}
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_CacheControl_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_CacheControl_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_CacheControl_ok_TODO.java
index eeb6ea1..00b2de8 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_CacheControl_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_CacheControl_ok_TODO.java
@@ -39,23 +39,4 @@ public class Get_thenResponseHeaders_CacheControl_ok_TODO {
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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_ContentLength_ok_TODO.java
index a7f8bd4..97b45d1 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_ContentLength_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_ContentLength_ok_TODO.java
@@ -18,13 +18,12 @@
*/
package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+import org.junit.Before;
+import org.junit.Rule;
+
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_ContentLength_ok_TODO {
@@ -39,23 +38,5 @@ public class Get_thenResponseHeaders_ContentLength_ok_TODO {
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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_ContentType_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_ContentType_ok_TODO.java
index 6fa75c7..68eeefa 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_ContentType_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_thenResponseHeaders_ContentType_ok_TODO.java
@@ -39,23 +39,4 @@ public class Get_thenResponseHeaders_ContentType_ok_TODO {
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/430e8b3c/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
index 5a93877..49e8c1b 100644
--- 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
@@ -39,23 +39,5 @@ public class Get_whenResponseHeaders_CacheControl_ok_TODO {
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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenResponseHeaders_ContentLength_ok_TODO.java
index a59b276..6e5e668 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenResponseHeaders_ContentLength_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenResponseHeaders_ContentLength_ok_TODO.java
@@ -39,23 +39,4 @@ public class Get_whenResponseHeaders_ContentLength_ok_TODO {
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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenResponseHeaders_ContentType_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenResponseHeaders_ContentType_ok_TODO.java
index 59572fb..b304818 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenResponseHeaders_ContentType_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Get_whenResponseHeaders_ContentType_ok_TODO.java
@@ -39,23 +39,4 @@ public class Get_whenResponseHeaders_ContentType_ok_TODO {
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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_CacheControl_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_CacheControl_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_CacheControl_ok_TODO.java
index 6023482..0c1b0f3 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_CacheControl_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_CacheControl_ok_TODO.java
@@ -39,23 +39,4 @@ public class Put_thenResponseHeaders_CacheControl_ok_TODO {
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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_ContentLength_ok_TODO.java
index 098594d..bca850b 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_ContentLength_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_ContentLength_ok_TODO.java
@@ -39,23 +39,5 @@ public class Put_thenResponseHeaders_ContentLength_ok_TODO {
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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_ContentType_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_ContentType_ok_TODO.java
index 9788f94..42880d5 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_ContentType_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_thenResponseHeaders_ContentType_ok_TODO.java
@@ -39,23 +39,4 @@ public class Put_thenResponseHeaders_ContentType_ok_TODO {
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/430e8b3c/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
index d4cc93b..f0e94fb 100644
--- 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
@@ -1,5 +1,86 @@
package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action;
+import static org.apache.isis.core.commons.matchers.IsisMatchers.matches;
+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.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.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.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
public class Get_thenRepresentation_ok_TODO {
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+ private DomainObjectResource domainObjectResource;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ domainObjectResource = client.getDomainObjectResource();
+ }
+
+ @Ignore("to get working again")
+ @Test
+ public void actionPrompt() throws Exception {
+
+ // 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));
+ }
+
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/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
index c767beb..5735936 100644
--- 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
@@ -39,23 +39,5 @@ public class Get_thenResponseHeaders_CacheControl_ok_TODO {
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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenResponseHeaders_ContentLength_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenResponseHeaders_ContentLength_ok_TODO.java
index 00d1d50..5b1facb 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenResponseHeaders_ContentLength_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenResponseHeaders_ContentLength_ok_TODO.java
@@ -39,23 +39,4 @@ public class Get_thenResponseHeaders_ContentLength_ok_TODO {
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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenResponseHeaders_ContentType_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenResponseHeaders_ContentType_ok_TODO.java
index 261e4b2..dc9bbc5 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenResponseHeaders_ContentType_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Get_thenResponseHeaders_ContentType_ok_TODO.java
@@ -39,23 +39,4 @@ public class Get_thenResponseHeaders_ContentType_ok_TODO {
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/430e8b3c/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
deleted file mode 100644
index 4ccc054..0000000
--- 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
+++ /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.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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenActionSemanticsOfNotIdempotent_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/Get_givenActionSemanticsOfNotIdempotent_thenResponseCode_205_bad_TOFIX.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenActionSemanticsOfNotIdempotent_thenResponseCode_205_bad_TOFIX.java
new file mode 100644
index 0000000..6f8bada
--- /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_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 Get_givenActionSemanticsOfNotIdempotent_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("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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenNoValidatableArgs_whenQueryArg_XroValidateOnly_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_whenQueryArg_XroValidateOnly_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenNoValidatableArgs_whenQueryArg_XroValidateOnly_ok_TODO.java
index cd56d2b..5056aa9 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenNoValidatableArgs_whenQueryArg_XroValidateOnly_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenNoValidatableArgs_whenQueryArg_XroValidateOnly_ok_TODO.java
@@ -1,10 +1,28 @@
package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+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.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
public class Get_givenNoValidatableArgs_whenQueryArg_XroValidateOnly_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 success() throws Exception {
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenRefArg_whnArgIsHrefAndLinksToEntityOfWrongType_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenRefArg_whnArgIsHrefAndLinksToEntityOfWrongType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenRefArg_whnArgIsHrefAndLinksToEntityOfWrongType_ok_TODO.java
index b8b0415..9671e8d 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenRefArg_whnArgIsHrefAndLinksToEntityOfWrongType_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_givenRefArg_whnArgIsHrefAndLinksToEntityOfWrongType_ok_TODO.java
@@ -1,10 +1,27 @@
package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+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.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
public class Get_givenRefArg_whnArgIsHrefAndLinksToEntityOfWrongType_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 success() throws Exception {
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_thenRespHeaders_ContentType_andContentLength_andRespCode_200_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_thenRespHeaders_ContentType_andContentLength_andRespCode_200_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_thenRespHeaders_ContentType_andContentLength_andRespCode_200_ok.java
new file mode 100644
index 0000000..b44a5ea
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_thenRespHeaders_ContentType_andContentLength_andRespCode_200_ok.java
@@ -0,0 +1,117 @@
+/*
+ * 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.core.commons.matchers.IsisMatchers.matches;
+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.*;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status.Family;
+
+import org.apache.isis.core.commons.matchers.IsisMatchers;
+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.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.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.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class Get_thenRespHeaders_ContentType_andContentLength_andRespCode_200_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);
+ }
+
+ @Test
+ public void usingResourceProxy() throws Exception {
+
+ // given, when
+ Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "list", null);
+ RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ then(restfulResponse);
+ }
+
+ private static void then(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
+
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+ assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(RestfulMediaType.APPLICATION_JSON_ACTION_RESULT));
+ assertThat(restfulResponse.getHeader(Header.CONTENT_LENGTH), is(IsisMatchers.greaterThan(1000)));
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/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
index 38b3aa3..dbdedb6 100644
--- 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
@@ -39,23 +39,4 @@ public class Get_thenResponseHeaders_CacheControl_ok_TODO {
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/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenArgIsValid_and_thenQueryArg_XroValidateOnly_2xx_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenArgIsValid_and_thenQueryArg_XroValidateOnly_2xx_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenArgIsValid_and_thenQueryArg_XroValidateOnly_2xx_TODO.java
index 176d22f..b604cee 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenArgIsValid_and_thenQueryArg_XroValidateOnly_2xx_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenArgIsValid_and_thenQueryArg_XroValidateOnly_2xx_TODO.java
@@ -1,10 +1,27 @@
package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+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.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
public class Get_whenArgIsValid_and_thenQueryArg_XroValidateOnly_2xx_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 success() throws Exception {
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/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
index 9245a59..c88eb8e 100644
--- 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
@@ -1,10 +1,27 @@
package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+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.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
public class Get_whenCreatedNewObject_thenResponseCode_201_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 todo() throws Exception {
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/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
index baedd69..8404d32 100644
--- 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
@@ -1,10 +1,27 @@
package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+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.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
public class Get_whenErrorThrown_thenRepresentation_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 todo() throws Exception {
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenInvalidArg_andQueryArg_XroValidateOnly_then_4xx_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenInvalidArg_andQueryArg_XroValidateOnly_then_4xx_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenInvalidArg_andQueryArg_XroValidateOnly_then_4xx_TODO.java
index 6abcaa9..faab93e 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenInvalidArg_andQueryArg_XroValidateOnly_then_4xx_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenInvalidArg_andQueryArg_XroValidateOnly_then_4xx_TODO.java
@@ -1,10 +1,27 @@
package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+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.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
public class Get_whenInvalidArg_andQueryArg_XroValidateOnly_then_4xx_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 success() throws Exception {
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenRepr_andRespHeaders_ContentType_andContentLength_andRespCode_200_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenRepr_andRespHeaders_ContentType_andContentLength_andRespCode_200_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenRepr_andRespHeaders_ContentType_andContentLength_andRespCode_200_ok.java
deleted file mode 100644
index 2ead161..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenList_thenRepr_andRespHeaders_ContentType_andContentLength_andRespCode_200_ok.java
+++ /dev/null
@@ -1,115 +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.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.*;
-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.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.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_thenRepr_andRespHeaders_ContentType_andContentLength_andRespCode_200_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);
- }
-
- @Test
- public void usingResourceProxy() throws Exception {
-
- // given, when
- Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "list", null);
- RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
-
- then(restfulResponse);
- }
-
- private static void then(final RestfulResponse<ActionResultRepresentation> restfulResponse) throws JsonParseException, JsonMappingException, IOException {
-
- assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
- assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(RestfulMediaType.APPLICATION_JSON_ACTION_RESULT));
- assertThat(restfulResponse.getHeader(Header.CONTENT_LENGTH), is(2090));
-
- 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/430e8b3c/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..6e4f1ef
--- /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,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.domainobjectorservice.id.action.invoke;
+
+import static org.apache.isis.core.commons.matchers.IsisMatchers.matches;
+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.*;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status.Family;
+
+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.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.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.Ignore;
+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 usingResourceProxy() throws Exception {
+
+ // given, when
+ Response response = serviceResource.invokeActionQueryOnly("ActionsEntities", "list", null);
+ RestfulResponse<ActionResultRepresentation> restfulResponse = RestfulResponse.ofT(response);
+
+ // then
+ assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+
+ final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
+
+ assertThat(actionResultRepr.getResultType(), is(ResultType.LIST));
+ final ListRepresentation listRepr = actionResultRepr.getResult().as(ListRepresentation.class);
+
+ // then list value
+ assertThat(listRepr.getValue(), is(not(nullValue())));
+ assertThat(listRepr.getValue().size(), is(5));
+
+ final JsonRepresentation domainObjectLinkRepr = listRepr.getValue().arrayGet(0);
+
+ assertThat(domainObjectLinkRepr, is(not(nullValue())));
+ assertThat(domainObjectLinkRepr, isLink()
+ .rel(Rel.ELEMENT)
+ .title("Untitled Actions Entity")
+ .httpMethod(RestfulHttpMethod.GET)
+ .href(matches("http://localhost:\\d+/objects/RTNE/67"))
+ .type(RepresentationType.DOMAIN_OBJECT.getMediaType())
+ .arguments(JsonRepresentation.newMap())
+ .build());
+
+ // then list link element-type
+ assertThat(listRepr.getLinks(), is(not(nullValue())));
+ final LinkRepresentation elementTypeLink = listRepr.getLinkWithRel(Rel.ELEMENT_TYPE);
+ assertThat(elementTypeLink, is(not(nullValue())));
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_isNotNull_thenRepr_ok_andRespHeaders_ContentType_andContentLength__andRespCode_200_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_isNotNull_thenRepr_ok_andRespHeaders_ContentType_andContentLength__andRespCode_200_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_isNotNull_thenRepr_ok_andRespHeaders_ContentType_andContentLength__andRespCode_200_ok.java
index a7b1856..b9a05ad 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_isNotNull_thenRepr_ok_andRespHeaders_ContentType_andContentLength__andRespCode_200_ok.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenObject_isNotNull_thenRepr_ok_andRespHeaders_ContentType_andContentLength__andRespCode_200_ok.java
@@ -19,6 +19,7 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
+import org.apache.isis.core.commons.matchers.IsisMatchers;
import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
import org.apache.isis.viewer.restfulobjects.applib.RestfulMediaType;
@@ -90,7 +91,7 @@ public class Get_whenObject_isNotNull_thenRepr_ok_andRespHeaders_ContentType_and
assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
assertThat(restfulResponse.getHeader(Header.CONTENT_TYPE), hasProfile(RestfulMediaType.APPLICATION_JSON_ACTION_RESULT));
- assertThat(restfulResponse.getHeader(Header.CONTENT_LENGTH), is(3248));
+ assertThat(restfulResponse.getHeader(Header.CONTENT_LENGTH), is(IsisMatchers.greaterThan(1000)));
final ActionResultRepresentation actionResultRepr = restfulResponse.getEntity();
@@ -98,30 +99,15 @@ public class Get_whenObject_isNotNull_thenRepr_ok_andRespHeaders_ContentType_and
final DomainObjectRepresentation objRepr = actionResultRepr.getResult().as(DomainObjectRepresentation.class);
assertThat(objRepr.getMembers(), is(not(nullValue())));
- assertThat(objRepr.getMembers().size(), is(greaterThan(0)));
+ assertThat(objRepr.getMembers().size(), is(IsisMatchers.greaterThan(0)));
assertThat(objRepr.getTitle(), is(not(nullValue())));
assertThat(objRepr.getLinks(), is(not(nullValue())));
- assertThat(objRepr.getMembers().size(), is(greaterThan(0)));
+ assertThat(objRepr.getMembers().size(), is(IsisMatchers.greaterThan(0)));
assertThat(objRepr.getExtensions(), is(not(nullValue())));
}
- private static Matcher<Integer> greaterThan(final int i) {
- return new TypeSafeMatcher<Integer>() {
-
- @Override
- public void describeTo(Description description) {
- description.appendText("greater than " + i);
- }
-
- @Override
- protected boolean matchesSafely(Integer item) {
- return item > i;
- }
- };
- }
-
}
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/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
index b5703a1..21ec3c9 100644
--- 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
@@ -1,13 +1,24 @@
package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+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.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
public class Get_whenScalar_thenRepresentation_ok_TODO {
- @Ignore
- @Test
- public void todo() throws Exception {
-
+ @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());
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenScalar_thenResponseHeaders_ContentLength_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_thenResponseHeaders_ContentLength_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenScalar_thenResponseHeaders_ContentLength_ok_TODO.java
index 04e261c..b0d6d93 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenScalar_thenResponseHeaders_ContentLength_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenScalar_thenResponseHeaders_ContentLength_ok_TODO.java
@@ -1,10 +1,27 @@
package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+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.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
public class Get_whenScalar_thenResponseHeaders_ContentLength_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 todo() throws Exception {
http://git-wip-us.apache.org/repos/asf/isis/blob/430e8b3c/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenScalar_thenResponseHeaders_ContentType_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_thenResponseHeaders_ContentType_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenScalar_thenResponseHeaders_ContentType_ok_TODO.java
index cafafa2..490d8788 100644
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenScalar_thenResponseHeaders_ContentType_ok_TODO.java
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Get_whenScalar_thenResponseHeaders_ContentType_ok_TODO.java
@@ -1,10 +1,27 @@
package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+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.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
public class Get_whenScalar_thenResponseHeaders_ContentType_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 todo() throws Exception {