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 2014/04/23 21:43:52 UTC
[09/14] git commit: ISIS-421: working on RO TCK tests.
ISIS-421: working on RO TCK tests.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/9c832045
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/9c832045
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/9c832045
Branch: refs/heads/master
Commit: 9c832045c0dd7380f90d0d319dd64e3eb6157c19
Parents: bc621d0
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Wed Apr 2 09:43:52 2014 +0200
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Tue Apr 22 17:37:01 2014 +0100
----------------------------------------------------------------------
.../applib/client/RestfulRequest.java | 11 +-
.../AbstractObjectMemberReprRenderer.java | 17 +--
.../domainobjects/DomainObjectLinkTo.java | 2 +-
.../domainobjects/ObjectActionReprRenderer.java | 2 +-
.../domainobjects/ObjectAdapterLinkTo.java | 1 -
.../ObjectCollectionReprRenderer.java | 3 +-
.../ObjectPropertyReprRenderer.java | 10 +-
.../AbstractTypeMemberReprRenderer.java | 2 +-
.../DomainObjectResourceServerside.java | 5 +-
.../resources/HomePageResourceServerside.java | 7 +-
.../restfulobjects/tck/RestfulMatchers.java | 39 +++++-
.../tck/all/stories/UserStoryTest_TOFIX.java | 2 +-
.../oid/Delete_thenResponseCode_405_bad.java | 68 -----------
.../domainobject/oid/Delete_then_405_bad.java | 68 +++++++++++
...hemeIsFormal_thenRepresentation_ok_TODO.java | 52 ++++++++
...hemeIsSimple_thenRepresentation_ok_TODO.java | 52 ++++++++
...EntityWithActions_thenRepresentation_ok.java | 94 +++++++++++++++
...yWithActions_thenRepresentation_ok_TODO.java | 118 -------------------
...hCollections_thenRepresentation_ok_TODO.java | 13 +-
...imitiveProperties_thenRepresentation_ok.java | 34 ++++--
...ivenHiddenMembers_thenRepresentation_ok.java | 80 +++++++++++++
...iddenMembers_thenRepresentation_ok_TODO.java | 80 -------------
...Code_andContentType_andContentLength_ok.java | 88 ++++++++++++++
...tentType_andContentLength_ok_TOCOMPLETE.java | 94 ---------------
...Get_thenResponseHeaders_CacheControl_ok.java | 93 +++++++++++++++
...henResponseHeaders_CacheControl_ok_TODO.java | 111 -----------------
...whenDoesntExistOid_thenResponseCode_404.java | 86 --------------
.../oid/Get_whenDoesntExistOid_then_404.java | 86 ++++++++++++++
...equestHeaders_Accept_isInvalid_bad_TODO.java | 23 ----
.../oid/Get_whenRequestHeaders_Accept_ok.java | 78 ++++++++++++
.../Get_whenRequestHeaders_Accept_ok_TODO.java | 23 ----
...enRequestHeaders_Accept_whenInvalid_406.java | 79 +++++++++++++
.../oid/Post_thenResponseCode_405_bad.java | 65 ----------
.../tck/domainobject/oid/Post_then_405_bad.java | 65 ++++++++++
...givenDisabled_thenResponseCode_203_TODO.java | 23 ----
.../oid/Put_givenDisabled_then_203_TODO.java | 23 ++++
.../oid/Put_thenResponseCode_200_ok_TODO.java | 23 ----
.../domainobject/oid/Put_then_200_ok_TODO.java | 23 ++++
...oesntExistOid_thenResponseCode_404_TODO.java | 23 ----
.../Put_whenDoesntExistOid_then_404_TODO.java | 23 ++++
...givenDisabled_thenResponseCode_203_TODO.java | 23 ----
.../Delete_givenDisabled_then_203_TODO.java | 23 ++++
...e_givenHidden_thenResponseCode_404_TODO.java | 23 ----
.../Delete_givenHidden_then_404_TODO.java | 23 ++++
.../Delete_thenResponseCode_200_ok_TODO.java | 23 ----
.../oid/collection/Delete_then_200_ok_TODO.java | 23 ++++
...esntExistColl_thenResponseCode_404_TODO.java | 23 ----
...elete_whenDoesntExistColl_then_404_TODO.java | 23 ++++
...oesntExistOid_thenResponseCode_404_TODO.java | 23 ----
...Delete_whenDoesntExistOid_then_404_TODO.java | 23 ++++
...lSchemeIsFormal_thenRepresentation_TODO.java | 51 ++++++++
...lSchemeIsSimple_thenRepresentation_TODO.java | 51 ++++++++
.../collection/Get_thenRepresentation_ok.java | 10 +-
.../collection/Get_thenResponseCode_200_ok.java | 61 ----------
...et_thenResponseHeaders_ContentLength_ok.java | 4 +-
...thenResponseHeaders_ContentType_ok_TODO.java | 1 +
.../oid/collection/Get_then_200_ok.java | 61 ++++++++++
...t_whenArg_thenResponseCode_205_bad_TODO.java | 23 ----
.../Get_whenArg_then_405_bad_TODO.java | 23 ++++
...esntExistColl_thenResponseCode_404_TODO.java | 23 ----
.../Get_whenDoesntExistColl_then_404.java | 58 +++++++++
...oesntExistOid_thenResponseCode_404_TODO.java | 23 ----
.../Get_whenDoesntExistOid_then_404.java | 67 +++++++++++
.../collection/Get_whenHiddenColl_then_404.java | 58 +++++++++
.../Get_whenQueryArg_xRoDomainModel_ok.java | 2 +-
...equestHeaders_Accept_isInvalid_bad_TODO.java | 23 ----
.../Get_whenRequestHeaders_Accept_ok_TODO.java | 55 +++++++++
...uestHeaders_Accept_whenInvalid_406_TODO.java | 23 ++++
...givenDisabled_thenResponseCode_203_TODO.java | 23 ----
.../Post_givenDisabled_then_203_TODO.java | 23 ++++
...t_givenHidden_thenResponseCode_404_TODO.java | 23 ----
.../Post_givenHidden_then_404_TODO.java | 23 ++++
.../Post_thenResponseCode_200_ok_TODO.java | 23 ----
.../oid/collection/Post_then_200_ok_TODO.java | 23 ++++
...givenDisabled_thenResponseCode_203_TODO.java | 23 ----
.../Put_givenDisabled_then_403_TODO.java | 23 ++++
...t_givenHidden_thenResponseCode_404_TODO.java | 23 ----
.../Put_givenHidden_then_404_TODO.java | 23 ++++
.../Put_thenResponseCode_200_ok_TODO.java | 23 ----
.../oid/collection/Put_then_200_ok_TODO.java | 23 ++++
...esntExistColl_thenResponseCode_404_TODO.java | 23 ----
.../Put_whenDoesntExistColl_then_404_TODO.java | 23 ++++
...oesntExistOid_thenResponseCode_404_TODO.java | 23 ----
.../Put_whenDoesntExistOid_then_404_TODO.java | 23 ++++
...givenDisabled_thenResponseCode_203_TODO.java | 23 ----
.../Delete_givenDisabled_then_203_TODO.java | 23 ++++
.../Delete_thenResponseCode_200_ok_TODO.java | 23 ----
.../oid/property/Delete_then_200_ok_TODO.java | 23 ++++
...oesntExistOid_thenResponseCode_404_TODO.java | 23 ----
...Delete_whenDoesntExistOid_then_404_TODO.java | 23 ++++
...esntExistProp_thenResponseCode_404_TODO.java | 23 ----
...elete_whenDoesntExistProp_then_404_TODO.java | 23 ++++
...hemeIsFormal_thenRepresentation_ok_TODO.java | 51 ++++++++
...hemeIsSimple_thenRepresentation_ok_TODO.java | 51 ++++++++
.../oid/property/Get_thenRepresentation_ok.java | 2 +-
.../property/Get_thenResponseCode_200_ok.java | 63 ----------
.../oid/property/Get_then_200_ok.java | 63 ++++++++++
...t_whenArg_thenResponseCode_205_bad_TODO.java | 23 ----
.../property/Get_whenArg_then_405_bad_TODO.java | 23 ++++
...whenDoesntExistOid_thenResponseCode_404.java | 68 -----------
.../Get_whenDoesntExistOid_then_404.java | 68 +++++++++++
...henDoesntExistProp_thenResponseCode_404.java | 68 -----------
.../Get_whenDoesntExistProp_then_404.java | 67 +++++++++++
.../property/Get_whenHiddenProp_then_404.java | 58 +++++++++
.../Get_whenRequestHeaders_Accept_ok.java | 78 ++++++++++++
.../Get_whenRequestHeaders_Accept_ok_TODO.java | 23 ----
...enRequestHeaders_Accept_whenInvalid_406.java | 79 +++++++++++++
...uestHeaders_Accept_whenInvalid_bad_TODO.java | 23 ----
.../property/Post_thenResponseCode_405_bad.java | 75 ------------
.../oid/property/Post_then_405_bad.java | 75 ++++++++++++
.../Put_thenResponseCode_200_ok_TODO.java | 23 ----
.../oid/property/Put_then_200_ok_TODO.java | 23 ++++
...ObjectResource_thenResponseCode_405_bad.java | 72 -----------
...Delete_givenObjectResource_then_405_bad.java | 72 +++++++++++
...erviceResource_thenResponseCode_405_bad.java | 74 ------------
...elete_givenServiceResource_then_405_bad.java | 74 ++++++++++++
...givenDisabled_thenResponseCode_203_TODO.java | 23 ----
.../action/Get_givenDisabled_then_403_TODO.java | 23 ++++
...lSchemeIsFormal_thenRepresentation_TODO.java | 50 ++++++++
...lSchemeIsSimple_thenRepresentation_TODO.java | 50 ++++++++
...t_givenHidden_thenResponseCode_404_TODO.java | 23 ----
.../id/action/Get_givenHidden_then_404.java | 58 +++++++++
.../id/action/Get_thenRepresentation_ok.java | 2 +-
...esntExistActn_thenResponseCode_404_TODO.java | 23 ----
.../Get_whenDoesntExistActn_then_404_TODO.java | 23 ++++
...whenDoesntExistOid_thenResponseCode_404.java | 70 -----------
.../action/Get_whenDoesntExistOid_then_404.java | 70 +++++++++++
...ObjectResource_thenResponseCode_405_bad.java | 72 -----------
.../Post_givenObjectResource_then_405_bad.java | 72 +++++++++++
...erviceResource_thenResponseCode_405_bad.java | 74 ------------
.../Post_givenServiceResource_then_405_bad.java | 74 ++++++++++++
...ObjectResource_thenResponseCode_405_bad.java | 72 -----------
.../Put_givenObjectResource_then_405_bad.java | 72 +++++++++++
...erviceResource_thenResponseCode_405_bad.java | 73 ------------
.../Put_givenServiceResource_then_405_bad.java | 73 ++++++++++++
...nServiceAction_thenResponseCode_405_bad.java | 3 -
...dempotent_thenResponseCode_205_bad_TODO.java | 6 +-
...empotent_thenResponseCode_205_bad_TOFIX.java | 6 +-
.../Get_givenActionSemanticsOfSafe_ok.java | 4 +-
.../Get_givenDisabled_thenResponseCode_203.java | 8 +-
...enMandatorySimpleArg_whenArgMissing_bad.java | 4 +-
...MandatorySimpleArg_whenArgNullValue_bad.java | 4 +-
...givenNoArgRequired_whenNoArgProvided_ok.java | 4 +-
...t_givenOptionalArg_whenNoArgProvided_ok.java | 5 +-
...rgIsHrefAndLinksToNonExistentEntity_bad.java | 5 +-
.../Get_givenRefArg_whenArgProvided_ok.java | 4 +-
...larArgInteger_whenArgMalformed_bad_TODO.java | 5 +-
...ivenScalarArgInteger_whenArgProvided_ok.java | 5 +-
...rg_whenArgMalformedMissingValueNode_bad.java | 4 +-
.../Get_givenScalarArg_whenArgSurplus_bad.java | 4 +-
...lidationRuleForAllArgs_whenArgFails_bad.java | 8 +-
...dationRuleForSingleArg_whenArgFails_bad.java | 8 +-
.../invoke/Get_givenViewModel_ok_TODO.java | 15 ---
...ype_andContentLength_andRespCode_200_ok.java | 12 +-
...dNewObject_thenResponseCode_201_ok_TODO.java | 49 --------
...t_whenCreatedNewObject_then_201_ok_TODO.java | 49 ++++++++
...Null_thenRepr_andRespHeaders_and_200_ok.java | 4 +-
...whenObject_isNull_thenRepresentation_ok.java | 4 +-
...equestHeaders_Accept_isInvalid_bad_TODO.java | 23 ----
...uestHeaders_Accept_whenInvalid_406_TODO.java | 23 ++++
...dempotent_thenResponseCode_205_bad_TODO.java | 110 -----------------
...SemanticsOfIdempotent_then_205_bad_TODO.java | 110 +++++++++++++++++
...csOfSafe_thenResponseCode_205_bad_TOFIX.java | 110 -----------------
...ctionSemanticsOfSafe_then_205_bad_TOFIX.java | 110 +++++++++++++++++
.../Post_whenRequestHeaders_Accept_ok_TODO.java | 23 ++++
...uestHeaders_Accept_whenInvalid_406_TODO.java | 23 ++++
...dempotent_thenResponseCode_205_bad_TODO.java | 110 -----------------
...anticsOfNotIdempotent_then_205_bad_TODO.java | 110 +++++++++++++++++
...icsOfSafe_thenResponseCode_205_bad_TODO.java | 110 -----------------
...ActionSemanticsOfSafe_then_205_bad_TODO.java | 110 +++++++++++++++++
.../Put_whenRequestHeaders_Accept_ok_TODO.java | 23 ++++
...uestHeaders_Accept_whenInvalid_406_TODO.java | 23 ++++
.../root/Delete_thenResponseCode_405_bad.java | 72 -----------
.../domainservice/root/Delete_then_405_bad.java | 72 +++++++++++
...lSchemeIsFormal_thenRepresentation_TODO.java | 52 ++++++++
...lSchemeIsSimple_thenRepresentation_TODO.java | 61 ++++++++++
.../Get_thenResponseHeaders_ContentType_ok.java | 4 +-
.../root/Post_thenResponseCode_405_bad.java | 72 -----------
.../domainservice/root/Post_then_405_bad.java | 72 +++++++++++
.../root/Put_thenResponseCode_405_bad.java | 72 -----------
.../domainservice/root/Put_then_405_bad.java | 72 +++++++++++
.../Delete_thenResponseCode_405_bad.java | 72 -----------
.../serviceId/Delete_then_405_bad.java | 72 +++++++++++
...lSchemeIsFormal_thenRepresentation_TODO.java | 51 ++++++++
...lSchemeIsSimple_thenRepresentation_TODO.java | 51 ++++++++
.../serviceId/Get_thenResponseCode_200_ok.java | 64 ----------
.../serviceId/Get_then_200_ok.java | 64 ++++++++++
.../Post_thenResponseCode_405_bad.java | 72 -----------
.../serviceId/Post_then_405_bad.java | 72 +++++++++++
.../serviceId/Put_thenResponseCode_405_bad.java | 72 -----------
.../serviceId/Put_then_405_bad.java | 72 +++++++++++
.../root/Delete_thenResponseCode_405_bad.java | 73 ------------
.../tck/homepage/root/Delete_then_405_bad.java | 73 ++++++++++++
...lSchemeIsFormal_thenRepresentation_TODO.java | 48 ++++++++
...lSchemeIsSimple_thenRepresentation_TODO.java | 48 ++++++++
.../Get_thenResponseHeaders_ContentType_ok.java | 4 +-
...equestHeaders_Accept_isInvalid_bad_TODO.java | 23 ----
.../root/Get_whenRequestHeaders_Accept_ok.java | 81 +++++++++++++
.../Get_whenRequestHeaders_Accept_ok_TODO.java | 23 ----
...Headers_Accept_whenInvalid_then_406_bad.java | 80 +++++++++++++
.../root/Post_thenResponseCode_405_bad.java | 73 ------------
.../tck/homepage/root/Post_then_405_bad.java | 73 ++++++++++++
.../root/Put_thenResponseCode_405_bad.java | 73 ------------
.../tck/homepage/root/Put_then_405_bad.java | 73 ++++++++++++
.../Delete_thenResponseCode_205_bad_TODO.java | 23 ----
.../objectsoftype/Delete_then_405_bad_TODO.java | 23 ++++
.../Get_thenResponseCode_205_bad_TODO.java | 23 ----
.../objectsoftype/Get_then_405_bad_TODO.java | 23 ++++
.../Post_thenResponseCode_201_ok_TODO.java | 23 ----
.../objectsoftype/Post_then_201_ok_TODO.java | 23 ++++
.../Put_thenResponseCode_205_bad_TODO.java | 23 ----
.../objectsoftype/Put_then_405_bad_TODO.java | 23 ++++
.../root/Delete_thenResponseCode_405_bad.java | 73 ------------
.../tck/user/root/Delete_then_405_bad.java | 73 ++++++++++++
...lSchemeIsFormal_thenRepresentation_TODO.java | 50 ++++++++
...lSchemeIsSimple_thenRepresentation_TODO.java | 50 ++++++++
.../Get_thenResponseHeaders_ContentType_ok.java | 4 +-
...Headers_Accept_whenInvalid_then_406_bad.java | 80 +++++++++++++
.../root/Get_whenRequestHeaders_accept_ok.java | 82 +++++++++++++
.../root/Post_thenResponseCode_405_bad.java | 72 -----------
.../tck/user/root/Post_then_405_bad.java | 72 +++++++++++
.../user/root/Put_thenResponseCode_405_bad.java | 72 -----------
.../tck/user/root/Put_then_405_bad.java | 72 +++++++++++
.../tck/user/root/RequestHeaders_accept_ok.java | 105 -----------------
...uestHeaders_accept_whenInvalid_bad_TODO.java | 23 ----
.../Delete_thenResponseCode_405_bad.java | 73 ------------
.../tck/version/Delete_then_405_bad.java | 73 ++++++++++++
...lSchemeIsFormal_thenRepresentation_TODO.java | 51 ++++++++
...lSchemeIsSimple_thenRepresentation_TODO.java | 51 ++++++++
.../Get_thenResponseHeaders_ContentType_ok.java | 4 +-
...equestHeaders_Accept_isInvalid_bad_TODO.java | 23 ----
.../Get_whenRequestHeaders_Accept_ok.java | 23 ----
...Headers_Accept_whenInvalid_then_406_bad.java | 81 +++++++++++++
.../version/Post_thenResponseCode_405_bad.java | 71 -----------
.../tck/version/Post_then_405_bad.java | 71 +++++++++++
.../version/Put_thenResponseCode_405_bad.java | 71 -----------
.../tck/version/Put_then_405_bad.java | 71 +++++++++++
.../core/tck/dom/busrules/BusRulesEntity.java | 1 +
238 files changed, 5995 insertions(+), 4356 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/9c832045/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 22e7bea..77e0ac2 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
@@ -22,15 +22,13 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
-
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-
+import com.google.common.collect.Maps;
+import org.jboss.resteasy.client.ClientRequest;
+import org.jboss.resteasy.client.core.BaseClientResponse;
import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
import org.apache.isis.viewer.restfulobjects.applib.util.Parser;
-import org.jboss.resteasy.client.core.BaseClientResponse;
-
-import com.google.common.collect.Maps;
public final class RestfulRequest {
@@ -172,7 +170,8 @@ public final class RestfulRequest {
if (!args.isEmpty()) {
clientRequestConfigurer.configureArgs(args);
}
- final Response response = clientRequestConfigurer.getClientRequest().execute();
+ final ClientRequest clientRequest = clientRequestConfigurer.getClientRequest();
+ final Response response = clientRequest.execute();
// this is a bit hacky
@SuppressWarnings("unchecked")
http://git-wip-us.apache.org/repos/asf/isis/blob/9c832045/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 68870f4..4b9871d 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
@@ -64,9 +64,12 @@ public abstract class AbstractObjectMemberReprRenderer<R extends ReprRendererAbs
protected ObjectAdapterLinkTo linkTo;
protected ObjectAdapter objectAdapter;
- protected MemberType memberType;
- protected T objectMember;
protected Mode mode = Mode.INLINE; // unless we determine otherwise
+ /**
+ * Derived from {@link #objectMember} using {@link org.apache.isis.viewer.restfulobjects.rendering.domainobjects.MemberType#determineFrom(org.apache.isis.core.metamodel.spec.feature.ObjectFeature)}
+ */
+ protected MemberType objectMemberType;
+ protected T objectMember;
/**
* Not for rendering, but is the key that the representation being rendered will be held under.
@@ -91,7 +94,7 @@ public abstract class AbstractObjectMemberReprRenderer<R extends ReprRendererAbs
public R with(final ObjectAndMember<T> objectAndMember) {
this.objectAdapter = objectAndMember.getObjectAdapter();
this.objectMember = objectAndMember.getMember();
- this.memberType = MemberType.determineFrom(objectMember);
+ this.objectMemberType = MemberType.determineFrom(objectMember);
usingLinkTo(new DomainObjectLinkTo());
return cast(this);
@@ -177,7 +180,7 @@ public abstract class AbstractObjectMemberReprRenderer<R extends ReprRendererAbs
}
private void addLinkToSelf() {
- getLinks().arrayAdd(linkTo.memberBuilder(Rel.SELF, memberType, objectMember).build());
+ getLinks().arrayAdd(linkTo.memberBuilder(Rel.SELF, objectMemberType, objectMember).build());
}
private void addLinkToUp() {
@@ -195,8 +198,8 @@ public abstract class AbstractObjectMemberReprRenderer<R extends ReprRendererAbs
return;
}
final JsonRepresentation arguments = mutatorArgs(mutatorSpec);
- final RepresentationType representationType = memberType.getRepresentationType();
- final JsonRepresentation mutatorLink = linkToForMutatorInvoke().memberBuilder(mutatorSpec.rel, memberType, objectMember, representationType, mutatorSpec.suffix).withHttpMethod(mutatorSpec.httpMethod).withArguments(arguments).build();
+ final RepresentationType representationType = objectMemberType.getRepresentationType();
+ final JsonRepresentation mutatorLink = linkToForMutatorInvoke().memberBuilder(mutatorSpec.rel, objectMemberType, objectMember, representationType, mutatorSpec.suffix).withHttpMethod(mutatorSpec.httpMethod).withArguments(arguments).build();
getLinks().arrayAdd(mutatorLink);
}
@@ -230,7 +233,7 @@ public abstract class AbstractObjectMemberReprRenderer<R extends ReprRendererAbs
if (!objectAdapter.representsPersistent()) {
return;
}
- final JsonRepresentation link = linkTo.memberBuilder(Rel.DETAILS, memberType, objectMember).build();
+ final JsonRepresentation link = linkTo.memberBuilder(Rel.DETAILS, objectMemberType, objectMember).build();
getLinks().arrayAdd(link);
final LinkFollowSpecs membersLinkFollower = getLinkFollowSpecs();
http://git-wip-us.apache.org/repos/asf/isis/blob/9c832045/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectLinkTo.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectLinkTo.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectLinkTo.java
index d48df63..fe37480 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectLinkTo.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/DomainObjectLinkTo.java
@@ -91,7 +91,7 @@ public class DomainObjectLinkTo implements ObjectAdapterLinkTo {
buf.append("/").append(part);
}
final String url = buf.toString();
- return LinkBuilder.newBuilder(rendererContext, rel.getName(), representationType, url);
+ return LinkBuilder.newBuilder(rendererContext, rel.andParam(memberType.getName(), objectMember.getId()), representationType, url);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/9c832045/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 8e4c13a..187c448 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
@@ -79,7 +79,7 @@ public class ObjectActionReprRenderer extends AbstractObjectMemberReprRenderer<O
if (usability().isVetoed()) {
return;
}
- final Map<String, MutatorSpec> mutators = memberType.getMutators();
+ final Map<String, MutatorSpec> mutators = objectMemberType.getMutators();
final ActionSemantics.Of actionSemantics = objectMember.getSemantics();
final String mutator = InvokeKeys.getKeyFor(actionSemantics);
http://git-wip-us.apache.org/repos/asf/isis/blob/9c832045/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectAdapterLinkTo.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectAdapterLinkTo.java b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectAdapterLinkTo.java
index d59246f..209209b 100644
--- a/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectAdapterLinkTo.java
+++ b/component/viewer/restfulobjects/rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/domainobjects/ObjectAdapterLinkTo.java
@@ -38,5 +38,4 @@ public interface ObjectAdapterLinkTo {
LinkBuilder memberBuilder(Rel rel, MemberType memberType, ObjectMember objectMember, String... parts);
LinkBuilder memberBuilder(Rel rel, MemberType memberType, ObjectMember objectMember, RepresentationType representationType, String... parts);
-
}
http://git-wip-us.apache.org/repos/asf/isis/blob/9c832045/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 d938f75..6d92925 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
@@ -19,7 +19,6 @@ package org.apache.isis.viewer.restfulobjects.rendering.domainobjects;
import java.util.List;
import java.util.Map;
-import org.apache.isis.applib.annotation.Render;
import org.apache.isis.applib.annotation.Render.Type;
import org.apache.isis.applib.annotation.Where;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
@@ -131,7 +130,7 @@ public class ObjectCollectionReprRenderer extends AbstractObjectMemberReprRender
}
private void addMutatorLink(final String key) {
- final Map<String, MutatorSpec> mutators = memberType.getMutators();
+ final Map<String, MutatorSpec> mutators = objectMemberType.getMutators();
final MutatorSpec mutatorSpec = mutators.get(key);
addLinkFor(mutatorSpec);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/9c832045/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 fc52296..c131991 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
@@ -18,9 +18,10 @@ package org.apache.isis.viewer.restfulobjects.rendering.domainobjects;
import java.util.List;
import java.util.Map;
-
-import org.apache.isis.applib.annotation.Where;
+import com.google.common.collect.Lists;
+import org.codehaus.jackson.node.NullNode;
import org.apache.isis.applib.annotation.Render.Type;
+import org.apache.isis.applib.annotation.Where;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.metamodel.facets.members.resolve.RenderFacet;
import org.apache.isis.core.metamodel.facets.object.title.TitleFacet;
@@ -34,9 +35,6 @@ 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.domaintypes.PropertyDescriptionReprRenderer;
-import org.codehaus.jackson.node.NullNode;
-
-import com.google.common.collect.Lists;
public class ObjectPropertyReprRenderer extends AbstractObjectMemberReprRenderer<ObjectPropertyReprRenderer, OneToOneAssociation> {
@@ -125,7 +123,7 @@ public class ObjectPropertyReprRenderer extends AbstractObjectMemberReprRenderer
if (usability().isVetoed()) {
return;
}
- final Map<String, MutatorSpec> mutators = memberType.getMutators();
+ final Map<String, MutatorSpec> mutators = objectMemberType.getMutators();
for (final String mutator : mutators.keySet()) {
final MutatorSpec mutatorSpec = mutators.get(mutator);
addLinkFor(mutatorSpec);
http://git-wip-us.apache.org/repos/asf/isis/blob/9c832045/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 19e6627..ee59131 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
@@ -50,7 +50,7 @@ public abstract class AbstractTypeMemberReprRenderer<R extends ReprRendererAbstr
// done eagerly so can use as criteria for x-ro-follow-links
representation.mapPut("id", objectFeature.getId());
- representation.mapPut("memberType", memberType.getName());
+ representation.mapPut("objectMemberType", memberType.getName());
return cast(this);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/9c832045/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 dcd3843..405edb1 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
@@ -79,9 +79,9 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
final ObjectAdapter objectAdapter = getResourceContext().getPersistenceSession().createTransientInstance(domainTypeSpec);
- final JsonRepresentation propertiesList = objectRepr.getArrayEnsured("members[memberType=property]");
+ final JsonRepresentation propertiesList = objectRepr.getArrayEnsured("members[objectMemberType=property]");
if (propertiesList == null) {
- throw RestfulObjectsApplicationException.createWithMessage(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[objectMemberType=property]); got %s", objectRepr);
}
if (!DomainResourceHelper.copyOverProperties(getResourceContext(), objectAdapter, propertiesList)) {
throw RestfulObjectsApplicationException.createWithBody(HttpStatusCode.BAD_REQUEST, objectRepr, "Illegal property value");
@@ -160,7 +160,6 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
@Override
@GET
@Path("/{domainType}/{instanceId}/properties/{propertyId}")
- @Consumes({ MediaType.WILDCARD })
@Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_OBJECT_PROPERTY, RestfulMediaType.APPLICATION_JSON_ERROR })
public Response propertyDetails(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId, @PathParam("propertyId") final String propertyId) {
init(RepresentationType.OBJECT_PROPERTY, Where.OBJECT_FORMS);
http://git-wip-us.apache.org/repos/asf/isis/blob/9c832045/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/HomePageResourceServerside.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/HomePageResourceServerside.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/HomePageResourceServerside.java
index 5dd3f56..b340730 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/HomePageResourceServerside.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/HomePageResourceServerside.java
@@ -33,15 +33,10 @@ import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpS
import org.apache.isis.viewer.restfulobjects.applib.homepage.HomePageResource;
import org.apache.isis.viewer.restfulobjects.server.RestfulObjectsApplicationException;
-/**
- * Implementation note: it seems to be necessary to annotate the implementation
- * with {@link Path} rather than the interface (at least under RestEasy 1.0.2
- * and 1.1-RC2).
- */
public class HomePageResourceServerside extends ResourceAbstract implements HomePageResource {
@Override
- @Produces({ RestfulMediaType.APPLICATION_JSON_HOME_PAGE })
+ @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_HOME_PAGE })
public Response homePage() {
init(RepresentationType.HOME_PAGE, Where.NOWHERE);
http://git-wip-us.apache.org/repos/asf/isis/blob/9c832045/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 aee0ec2..bb3c24a 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
@@ -486,7 +486,7 @@ public class RestfulMatchers {
}
- public static Matcher<MediaType> hasType(final String type) {
+ public static Matcher<MediaType> hasMediaType(final String type) {
return new TypeSafeMatcher<MediaType>() {
@Override
@@ -496,7 +496,8 @@ public class RestfulMatchers {
@Override
public boolean matchesSafely(final MediaType item) {
- return Objects.equal(type, item.getType());
+ final String expectedType = item.getType();
+ return expectedType != null && type.contains(expectedType);
}
};
}
@@ -562,7 +563,7 @@ public class RestfulMatchers {
};
}
- public static Matcher<? super MediaType> hasProfile(final String expectedMediaTypeAndProfileStr) {
+ public static Matcher<? super MediaType> hasMediaTypeProfile(final String expectedMediaTypeAndProfileStr) {
final MediaType expectedMediaType = Header.CONTENT_TYPE.parse(expectedMediaTypeAndProfileStr);
final String expectedProfileIfAny = expectedMediaType.getParameters().get("profile");
return new TypeSafeMatcher<MediaType>() {
@@ -584,6 +585,38 @@ public class RestfulMatchers {
};
}
+ public static Matcher<? super MediaType> hasMediaTypeXRoDomainType(final String expectedXRoDomainType) {
+ return new TypeSafeMatcher<MediaType>() {
+
+ @Override
+ public void describeTo(Description description) {
+ description.appendText("is a media type with an 'x-ro-domain-type' parameter of '" + expectedXRoDomainType + '"');
+ }
+
+ @Override
+ protected boolean matchesSafely(MediaType item) {
+ String actualXRoDomainTypeIfany = item.getParameters().get("x-ro-domain-type");
+ return actualXRoDomainTypeIfany != null && actualXRoDomainTypeIfany.contains(expectedXRoDomainType);
+ }
+ };
+ }
+
+ public static Matcher<? super MediaType> hasMediaTypeXRoElementType(final String expectedXRoElementTypeIfAny) {
+ return new TypeSafeMatcher<MediaType>() {
+
+ @Override
+ public void describeTo(Description description) {
+ description.appendText("is a media type with an 'x-ro-element-type' parameter of '" + expectedXRoElementTypeIfAny + '"');
+ }
+
+ @Override
+ protected boolean matchesSafely(MediaType item) {
+ String actualXRoElementTypeIfany = item.getParameters().get("x-ro-element-type");
+ return actualXRoElementTypeIfany != null && actualXRoElementTypeIfany.contains(expectedXRoElementTypeIfAny);
+ }
+ };
+ }
+
public static Matcher<? super RestfulResponse<?>> hasStatus(final HttpStatusCode statusCode) {
return new TypeSafeMatcher<RestfulResponse<?>>() {
http://git-wip-us.apache.org/repos/asf/isis/blob/9c832045/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
index 5e7adb3..4ca4583 100644
--- 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
@@ -67,7 +67,7 @@ public class UserStoryTest_TOFIX {
// and when locate the AppLibValues repo's "newEntity" action and walk
// to its details
- walker.walk("values[memberType=action].details");
+ walker.walk("values[objectMemberType=action].details");
// and when find the invoke body for the "newEntity" action and then
// walk the action using the body
http://git-wip-us.apache.org/repos/asf/isis/blob/9c832045/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Delete_thenResponseCode_405_bad.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Delete_thenResponseCode_405_bad.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Delete_thenResponseCode_405_bad.java
deleted file mode 100644
index 2b8d7b3..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Delete_thenResponseCode_405_bad.java
+++ /dev/null
@@ -1,68 +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.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.*;
-import 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.errors.ErrorRepresentation;
-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 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.junit.Assert.assertThat;
-
-public class Delete_thenResponseCode_405_bad {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- protected RestfulClient client;
-
- private ErrorRepresentation errorRepresentation;
-
- @Before
- public void setUp() throws Exception {
- final WebServer webServer = webServerRule.getWebServer();
- client = new RestfulClient(webServer.getBase());
- }
-
- @Test
- public void followLink() throws Exception {
-
- // when
- final LinkRepresentation link = Util.domainObjectLink(client, "PrimitiveValuedEntities");
- final LinkRepresentation deleteLink = link.withMethod(RestfulHttpMethod.DELETE);
- final RestfulResponse<JsonRepresentation> restfulResponse = client.follow(deleteLink);
-
- assertThat(restfulResponse.getStatus(), is(RestfulResponse.HttpStatusCode.METHOD_NOT_ALLOWED));
- assertThat(restfulResponse.getHeader(RestfulResponse.Header.WARNING), is("Deleting objects is not supported."));
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/9c832045/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Delete_then_405_bad.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Delete_then_405_bad.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Delete_then_405_bad.java
new file mode 100644
index 0000000..7a49348
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Delete_then_405_bad.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.domainobject.oid;
+
+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.*;
+import 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.errors.ErrorRepresentation;
+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 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.junit.Assert.assertThat;
+
+public class Delete_then_405_bad {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+
+ private ErrorRepresentation errorRepresentation;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ }
+
+ @Test
+ public void followLink() throws Exception {
+
+ // when
+ final LinkRepresentation link = Util.domainObjectLink(client, "PrimitiveValuedEntities");
+ final LinkRepresentation deleteLink = link.withMethod(RestfulHttpMethod.DELETE);
+ final RestfulResponse<JsonRepresentation> restfulResponse = client.follow(deleteLink);
+
+ assertThat(restfulResponse.getStatus(), is(RestfulResponse.HttpStatusCode.METHOD_NOT_ALLOWED));
+ assertThat(restfulResponse.getHeader(RestfulResponse.Header.WARNING), is("Deleting objects is not supported."));
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/9c832045/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenDomainModelSchemeIsFormal_thenRepresentation_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenDomainModelSchemeIsFormal_thenRepresentation_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenDomainModelSchemeIsFormal_thenRepresentation_ok_TODO.java
new file mode 100644
index 0000000..2982489
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenDomainModelSchemeIsFormal_thenRepresentation_ok_TODO.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.viewer.restfulobjects.tck.domainobject.oid;
+
+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.domainobjects.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+public class Get_givenDomainModelSchemeIsFormal_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 {
+
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/9c832045/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenDomainModelSchemeIsSimple_thenRepresentation_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenDomainModelSchemeIsSimple_thenRepresentation_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenDomainModelSchemeIsSimple_thenRepresentation_ok_TODO.java
new file mode 100644
index 0000000..8f4a162
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenDomainModelSchemeIsSimple_thenRepresentation_ok_TODO.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.viewer.restfulobjects.tck.domainobject.oid;
+
+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.domainobjects.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+public class Get_givenDomainModelSchemeIsSimple_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 {
+
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/9c832045/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithActions_thenRepresentation_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithActions_thenRepresentation_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithActions_thenRepresentation_ok.java
new file mode 100644
index 0000000..88b4b65
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithActions_thenRepresentation_ok.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either 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 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.*;
+import org.apache.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.DomainObjectResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.assertThat;
+
+public class Get_givenEntityWithActions_thenRepresentation_ok {
+
+ @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();
+
+ }
+
+ @Test
+ public void thenMembers() throws Exception {
+
+ // when
+ final Response jaxrsResponse = domainObjectResource.object("RTNE","67");
+ 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(3));
+
+ final DomainObjectMemberRepresentation containsAction = domainObjectRepr.getAction("contains");
+ assertThat(containsAction.getString("objectMemberType"), is("action"));
+ assertThat(containsAction.getString("id"), is("contains"));
+
+ LinkRepresentation containsActionLink = containsAction.getLinkWithRel(Rel.DETAILS.andParam("action", "contains"));
+ assertThat(containsActionLink.getRel(), is(Rel.DETAILS.andParam("action", "contains")));
+ assertThat(containsActionLink.getHref(), is(self.getHref() + "/actions/contains"));
+ assertThat(containsActionLink.getType(), is(RepresentationType.OBJECT_ACTION.getMediaType()));
+ assertThat(containsActionLink.getHttpMethod(), is(RestfulHttpMethod.GET));
+
+ // can also look up with abbreviated parameterized version of Rel
+ containsActionLink = containsAction.getLinkWithRel(Rel.DETAILS);
+ assertThat(containsActionLink.getRel(), is("action"));
+ assertThat(containsActionLink.getHref(), is(self.getHref() + "/actions/contains"));
+ assertThat(containsActionLink.getType(), is(RepresentationType.OBJECT_ACTION.getMediaType()));
+ assertThat(containsActionLink.getHttpMethod(), is(RestfulHttpMethod.GET));
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/9c832045/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
deleted file mode 100644
index 7db8c12..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenEntityWithActions_thenRepresentation_ok_TODO.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.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/9c832045/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
index b6fcf44..c1dad12 100644
--- 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
@@ -18,18 +18,11 @@
*/
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;
@@ -38,6 +31,9 @@ import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRe
import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectResource;
import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.assertThat;
+
public class Get_givenEntityWithCollections_thenRepresentation_ok_TODO {
@Rule
@@ -57,12 +53,11 @@ public class Get_givenEntityWithCollections_thenRepresentation_ok_TODO {
}
- @Ignore("TODO")
@Test
public void thenCollections() throws Exception {
// when
- final Response jaxrsResponse = domainObjectResource.object("PRMV","29");
+ final Response jaxrsResponse = domainObjectResource.object("PRMV","31");
final RestfulResponse<DomainObjectRepresentation> restfulResponse = RestfulResponse.ofT(jaxrsResponse);
assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
http://git-wip-us.apache.org/repos/asf/isis/blob/9c832045/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
index 2214785..9fb70ac 100644
--- 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
@@ -18,19 +18,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.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;
@@ -43,6 +33,13 @@ import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ScalarValueRep
import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
import org.apache.isis.viewer.restfulobjects.tck.Util;
+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.nullValue;
+import static org.junit.Assert.assertThat;
+
public class Get_givenEntityWithPrimitiveProperties_thenRepresentation_ok {
@Rule
@@ -142,17 +139,18 @@ public class Get_givenEntityWithPrimitiveProperties_thenRepresentation_ok {
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),
+ 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),
+ assertThat(property.getLinkWithRel(Rel.DETAILS),
isLink()
.href(matches(".+\\/objects\\/PRMV\\/\\d+\\/properties\\/byteProperty"))
.httpMethod(RestfulHttpMethod.GET)
@@ -164,6 +162,16 @@ public class Get_givenEntityWithPrimitiveProperties_thenRepresentation_ok {
.href(matches(".+\\/objects\\/PRMV\\/\\d+\\/properties\\/shortProperty"))
.httpMethod(RestfulHttpMethod.GET)
.type(RepresentationType.OBJECT_PROPERTY.getMediaType()));
+
+ // can navigate using fully qualified form of Rel
+ property = domainObjectRepr.getProperty("booleanProperty");
+ assertThat(property.getLinkWithRel(Rel.DETAILS.andParam("property", "booleanProperty")),
+ isLink()
+ .href(matches(".+\\/objects\\/PRMV\\/\\d+\\/properties\\/booleanProperty"))
+ .httpMethod(RestfulHttpMethod.GET)
+ .type(RepresentationType.OBJECT_PROPERTY.getMediaType()));
+
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/9c832045/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenHiddenMembers_thenRepresentation_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenHiddenMembers_thenRepresentation_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenHiddenMembers_thenRepresentation_ok.java
new file mode 100644
index 0000000..3a91f87
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenHiddenMembers_thenRepresentation_ok.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 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.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;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+public class Get_givenHiddenMembers_thenRepresentation_ok {
+
+ @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();
+
+ }
+
+ @Test
+ public void domainObjectWithHiddenMembers() throws Exception {
+
+ // given, when
+ final DomainObjectRepresentation domainObjectRepr = givenDomainObjectRepresentationFor("BSRL","64");
+
+ // property ('invisibleProperty')
+ final JsonRepresentation properties = domainObjectRepr.getProperties();
+ final JsonRepresentation nameProperty = properties.getRepresentation("invisibleProperty");
+ assertThat(nameProperty, is(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(Response.Status.Family.SUCCESSFUL));
+
+ return domainObjectJsonResp.getEntity();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/9c832045/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
deleted file mode 100644
index 65f0489..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_givenHiddenMembers_thenRepresentation_ok_TODO.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.domainobject.oid;
-
-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.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;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-public class Get_givenHiddenMembers_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();
-
- }
-
- @Test
- public void domainObjectWithHiddenMembers() throws Exception {
-
- // given, when
- final DomainObjectRepresentation domainObjectRepr = givenDomainObjectRepresentationFor("BSRL","64");
-
- // property ('invisibleProperty')
- final JsonRepresentation properties = domainObjectRepr.getProperties();
- final JsonRepresentation nameProperty = properties.getRepresentation("invisibleProperty");
- assertThat(nameProperty, is(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(Response.Status.Family.SUCCESSFUL));
-
- return domainObjectJsonResp.getEntity();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/9c832045/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseCode_andContentType_andContentLength_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseCode_andContentType_andContentLength_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseCode_andContentType_andContentLength_ok.java
new file mode 100644
index 0000000..4e0b8db
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/Get_thenResponseCode_andContentType_andContentLength_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.domainobject.oid;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasMediaTypeProfile;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasMediaType;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasMediaTypeXRoDomainType;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.Matchers.greaterThan;
+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.core.webserver.WebServer;
+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 {
+
+ @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();
+
+ }
+
+ @Test
+ public void usingClientFollow() 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_LENGTH), is(greaterThan(6000)));
+
+ final MediaType actualHeader = restfulResponse.getHeader(Header.CONTENT_TYPE);
+ assertThat(actualHeader, hasMediaType(MediaType.APPLICATION_JSON));
+ assertThat(actualHeader, hasMediaTypeProfile(RestfulMediaType.APPLICATION_JSON_OBJECT));
+ assertThat(actualHeader, hasMediaTypeXRoDomainType("domain-types/PRMV"));
+ }
+
+}