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 18:53:34 UTC
[4/4] git commit: ISIS-233: more tck tests for RO viewer.
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/262a90b8
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/262a90b8
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/262a90b8
Branch: refs/heads/dan/ISIS-233-ro
Commit: 262a90b8e566779151b615050db7251b89c1beca
Parents: 8617b45
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 17:53:09 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/262a90b8/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/262a90b8/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/262a90b8/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/262a90b8/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/262a90b8/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/262a90b8/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/262a90b8/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/262a90b8/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 f5501c2..fe0a727 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/262a90b8/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/262a90b8/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/262a90b8/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/262a90b8/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/262a90b8/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/262a90b8/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/262a90b8/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/262a90b8/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/262a90b8/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/262a90b8/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/262a90b8/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()));
+ }
+
+}