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 2011/10/04 09:49:28 UTC
svn commit: r1178710 - in
/incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck:
./ home/ resources/ resources/capabilities/ resources/home/
resources/object/ resources/service/ resources/user/ stories/ user/
Author: danhaywood
Date: Tue Oct 4 07:49:27 2011
New Revision: 1178710
URL: http://svn.apache.org/viewvc?rev=1178710&view=rev
Log:
ISIS-109: back to writing tests...
Added:
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/home/
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/AnyResourceTest_exceptionHandling.java
- copied, changed from r1177294, incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/AnyResourceTest_exceptionHandling.java
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/capabilities/
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/capabilities/CapabilitiesResourceTest.java
- copied, changed from r1176828, incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/CapabilitiesResourceTest.java
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/home/
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/home/HomePageResourceTest_representationAndHeaders.java
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/home/HomePageResourceTest_xrofollowlinks.java
- copied, changed from r1178705, incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/HomePageResourceTest.java
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/object/
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/object/DomainObjectResourceTest.java
- copied, changed from r1176828, incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/DomainObjectResourceTest.java
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/DomainServiceResourceTest_invokeAction.java
- copied, changed from r1167411, incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/DomainServiceResourceTest_invokeAction.java
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/DomainServiceResourceTest_service_serviceId.java
- copied, changed from r1178596, incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/DomainServiceResourceTest_service_serviceId.java
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/DomainServiceResourceTest_services.java
- copied, changed from r1176828, incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/DomainServiceResourceTest_services.java
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/user/
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/user/UserResourceTest.java
- copied, changed from r1177294, incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/UserResourceTest.java
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/stories/
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/stories/UserStoryTest.java
- copied, changed from r1167069, incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/UserStoryTest.java
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/user/
Removed:
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/AnyResourceTest_exceptionHandling.java
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/CapabilitiesResourceTest.java
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/DomainObjectResourceTest.java
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/DomainServiceResourceTest_invokeAction.java
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/DomainServiceResourceTest_service_serviceId.java
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/DomainServiceResourceTest_services.java
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/HomePageResourceTest.java
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/UserResourceTest.java
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/UserStoryTest.java
Modified:
incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/RepresentationMatchers.java
Modified: incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/RepresentationMatchers.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/RepresentationMatchers.java?rev=1178710&r1=1178709&r2=1178710&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/RepresentationMatchers.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/RepresentationMatchers.java Tue Oct 4 07:49:27 2011
@@ -2,6 +2,7 @@ package org.apache.isis.viewer.json.tck;
import java.io.IOException;
+import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.isis.viewer.json.applib.JsonRepresentation;
@@ -18,30 +19,10 @@ import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
import org.junit.Assert;
+import com.google.common.base.Objects;
-public class RepresentationMatchers {
-
- public static <T extends JsonRepresentation> T entityOf(Response resp, Class<T> returnType) throws JsonParseException, JsonMappingException, IOException {
- RestfulResponse<T> jsonResp = RestfulResponse.ofT(resp);
- return jsonResp.getEntity();
- }
-
-
-// public static Matcher<String> matchers(final Method method) {
-// return new TypeSafeMatcher<Link>() {
-//
-// @Override
-// public void describeTo(Description description) {
-// description.appendText("link with method " + method.name());
-// }
-//
-// @Override
-// public boolean matchesSafely(Link item) {
-// return item != null && item.getMethod() == method;
-// }
-// };
-// }
+public class RepresentationMatchers {
public static <T extends JsonRepresentation> Matcher<T> isMap() {
return new TypeSafeMatcher<T>() {
@@ -322,5 +303,53 @@ public class RepresentationMatchers {
}
+ public static Matcher<MediaType> hasType(final String type) {
+ return new TypeSafeMatcher<MediaType>() {
+
+ @Override
+ public void describeTo(Description description) {
+ description.appendText("has type " + type);
+ }
+
+ @Override
+ public boolean matchesSafely(MediaType item) {
+ return Objects.equal(type, item.getType());
+ }
+ };
+ }
+
+ public static Matcher<MediaType> hasSubType(final String subtype) {
+ return new TypeSafeMatcher<MediaType>() {
+
+ @Override
+ public void describeTo(Description description) {
+ description.appendText("has subtype " + subtype);
+ }
+
+ @Override
+ public boolean matchesSafely(MediaType item) {
+ return Objects.equal(subtype, item.getSubtype());
+ }
+ };
+ }
+
+ public static Matcher<MediaType> hasParameter(final String parameterName, final String parameterValue) {
+ return new TypeSafeMatcher<MediaType>() {
+
+ @Override
+ public void describeTo(Description description) {
+ description.appendText(String.format("has parameter '%s' with value '%s'", parameterName, parameterValue));
+ }
+
+ @Override
+ public boolean matchesSafely(MediaType item) {
+ final String paramValue = item.getParameters().get(parameterName);
+ return Objects.equal(paramValue, parameterValue);
+ }
+ };
+ }
+
+
+
}
\ No newline at end of file
Copied: incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/AnyResourceTest_exceptionHandling.java (from r1177294, incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/AnyResourceTest_exceptionHandling.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/AnyResourceTest_exceptionHandling.java?p2=incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/AnyResourceTest_exceptionHandling.java&p1=incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/AnyResourceTest_exceptionHandling.java&r1=1177294&r2=1178710&rev=1178710&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/AnyResourceTest_exceptionHandling.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/AnyResourceTest_exceptionHandling.java Tue Oct 4 07:49:27 2011
@@ -1,4 +1,4 @@
-package org.apache.isis.viewer.json.tck;
+package org.apache.isis.viewer.json.tck.resources;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
@@ -14,6 +14,7 @@ import org.apache.isis.viewer.json.appli
import org.apache.isis.viewer.json.applib.RestfulResponse;
import org.apache.isis.viewer.json.applib.RestfulResponse.HttpStatusCode;
import org.apache.isis.viewer.json.applib.homepage.HomePageRepresentation;
+import org.apache.isis.viewer.json.tck.IsisWebServerRule;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.util.HttpHeaderNames;
Copied: incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/capabilities/CapabilitiesResourceTest.java (from r1176828, incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/CapabilitiesResourceTest.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/capabilities/CapabilitiesResourceTest.java?p2=incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/capabilities/CapabilitiesResourceTest.java&p1=incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/CapabilitiesResourceTest.java&r1=1176828&r2=1178710&rev=1178710&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/CapabilitiesResourceTest.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/capabilities/CapabilitiesResourceTest.java Tue Oct 4 07:49:27 2011
@@ -1,4 +1,4 @@
-package org.apache.isis.viewer.json.tck;
+package org.apache.isis.viewer.json.tck.resources.capabilities;
import static org.apache.isis.viewer.json.tck.RepresentationMatchers.assertThat;
import static org.apache.isis.viewer.json.tck.RepresentationMatchers.isFollowableLinkToSelf;
@@ -21,6 +21,8 @@ import org.apache.isis.viewer.json.appli
import org.apache.isis.viewer.json.applib.blocks.Method;
import org.apache.isis.viewer.json.applib.capabilities.CapabilitiesRepresentation;
import org.apache.isis.viewer.json.applib.capabilities.CapabilitiesResource;
+import org.apache.isis.viewer.json.tck.IsisWebServerRule;
+import org.apache.isis.viewer.json.tck.RepresentationMatchers;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
import org.junit.Before;
@@ -89,7 +91,8 @@ public class CapabilitiesResourceTest {
private CapabilitiesRepresentation givenRepresentation() throws JsonParseException, JsonMappingException, IOException {
- return RepresentationMatchers.entityOf(resource.capabilities(), CapabilitiesRepresentation.class);
+ RestfulResponse<CapabilitiesRepresentation> jsonResp = RestfulResponse.ofT(resource.capabilities());
+ return jsonResp.getEntity();
}
Added: incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/home/HomePageResourceTest_representationAndHeaders.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/home/HomePageResourceTest_representationAndHeaders.java?rev=1178710&view=auto
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/home/HomePageResourceTest_representationAndHeaders.java (added)
+++ incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/home/HomePageResourceTest_representationAndHeaders.java Tue Oct 4 07:49:27 2011
@@ -0,0 +1,126 @@
+package org.apache.isis.viewer.json.tck.resources.home;
+
+import static org.apache.isis.viewer.json.tck.RepresentationMatchers.assertThat;
+import static org.apache.isis.viewer.json.tck.RepresentationMatchers.hasParameter;
+import static org.apache.isis.viewer.json.tck.RepresentationMatchers.hasSubType;
+import static org.apache.isis.viewer.json.tck.RepresentationMatchers.hasType;
+import static org.apache.isis.viewer.json.tck.RepresentationMatchers.isArray;
+import static org.apache.isis.viewer.json.tck.RepresentationMatchers.isFollowableLinkToSelf;
+import static org.apache.isis.viewer.json.tck.RepresentationMatchers.isLink;
+import static org.apache.isis.viewer.json.tck.RepresentationMatchers.isMap;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status.Family;
+
+import org.apache.isis.runtimes.dflt.webserver.WebServer;
+import org.apache.isis.viewer.json.applib.RepresentationType;
+import org.apache.isis.viewer.json.applib.RestfulClient;
+import org.apache.isis.viewer.json.applib.RestfulResponse;
+import org.apache.isis.viewer.json.applib.RestfulResponse.Header;
+import org.apache.isis.viewer.json.applib.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.json.applib.blocks.Method;
+import org.apache.isis.viewer.json.applib.homepage.HomePageRepresentation;
+import org.apache.isis.viewer.json.applib.homepage.HomePageResource;
+import org.apache.isis.viewer.json.tck.IsisWebServerRule;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+
+public class HomePageResourceTest_representationAndHeaders {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+ private HomePageResource resource;
+
+ @Before
+ public void setUp() throws Exception {
+ WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+
+ resource = client.getHomePageResource();
+ }
+
+ @Test
+ public void representation() throws Exception {
+
+ // given
+ Response resp = resource.resources();
+
+ // when
+ RestfulResponse<HomePageRepresentation> jsonResp = RestfulResponse.ofT(resp);
+ assertThat(jsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));
+
+ // then
+ assertThat(jsonResp.getStatus(), is(HttpStatusCode.OK));
+ assertThat(jsonResp.getHeader(RestfulResponse.Header.CONTENT_TYPE), is(RepresentationType.HOME_PAGE.getMediaType()));
+ assertThat(jsonResp.getHeader(RestfulResponse.Header.CACHE_CONTROL).getMaxAge(), is(24*60*60));
+
+ HomePageRepresentation repr = jsonResp.getEntity();
+ assertThat(repr, is(not(nullValue())));
+ assertThat(repr.isMap(), is(true));
+
+ assertThat(repr.getSelf(), isLink(client).method(Method.GET));
+ assertThat(repr.getUser(), isLink(client).method(Method.GET));
+ assertThat(repr.getServices(), isLink(client).method(Method.GET));
+ assertThat(repr.getCapabilities(), isLink(client).method(Method.GET));
+
+ assertThat(repr.getLinks(), isArray());
+ assertThat(repr.getExtensions(), isMap());
+ }
+
+ @Test
+ public void headers() throws Exception {
+ // given
+ Response resp = resource.resources();
+
+ // when
+ RestfulResponse<HomePageRepresentation> jsonResp = RestfulResponse.ofT(resp);
+ final MediaType contentType = jsonResp.getHeader(Header.CONTENT_TYPE);
+
+ // then
+ assertThat(contentType, hasType("application"));
+ assertThat(contentType, hasSubType("json"));
+ assertThat(contentType, hasParameter("profile", "http://restfulobjects.org/profiles/homepage"));
+ }
+
+ @Test
+ public void self_isFollowable() throws Exception {
+ // given
+ HomePageRepresentation repr = givenRepresentation();
+
+ // when, then
+ assertThat(repr, isFollowableLinkToSelf(client));
+ }
+
+ @Test
+ public void links() throws Exception {
+ // given
+ HomePageRepresentation repr = givenRepresentation();
+
+ // when, then
+ assertThat(repr.getServices(), isLink(client).returning(HttpStatusCode.OK));
+ assertThat(repr.getUser(), isLink(client).returning(HttpStatusCode.OK));
+ assertThat(repr.getCapabilities(), isLink(client).returning(HttpStatusCode.OK));
+ }
+
+ private HomePageRepresentation givenRepresentation() throws JsonParseException, JsonMappingException, IOException {
+ RestfulResponse<HomePageRepresentation> jsonResp = RestfulResponse.ofT(resource.resources());
+ return jsonResp.getEntity();
+ }
+
+}
+
+
+
\ No newline at end of file
Copied: incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/home/HomePageResourceTest_xrofollowlinks.java (from r1178705, incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/HomePageResourceTest.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/home/HomePageResourceTest_xrofollowlinks.java?p2=incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/home/HomePageResourceTest_xrofollowlinks.java&p1=incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/HomePageResourceTest.java&r1=1178705&r2=1178710&rev=1178710&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/HomePageResourceTest.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/home/HomePageResourceTest_xrofollowlinks.java Tue Oct 4 07:49:27 2011
@@ -1,7 +1,6 @@
-package org.apache.isis.viewer.json.tck;
+package org.apache.isis.viewer.json.tck.resources.home;
import static org.apache.isis.viewer.json.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.json.tck.RepresentationMatchers.entityOf;
import static org.apache.isis.viewer.json.tck.RepresentationMatchers.isArray;
import static org.apache.isis.viewer.json.tck.RepresentationMatchers.isFollowableLinkToSelf;
import static org.apache.isis.viewer.json.tck.RepresentationMatchers.isLink;
@@ -27,6 +26,7 @@ import org.apache.isis.viewer.json.appli
import org.apache.isis.viewer.json.applib.blocks.Method;
import org.apache.isis.viewer.json.applib.homepage.HomePageRepresentation;
import org.apache.isis.viewer.json.applib.homepage.HomePageResource;
+import org.apache.isis.viewer.json.tck.IsisWebServerRule;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
import org.junit.Before;
@@ -35,7 +35,7 @@ import org.junit.Rule;
import org.junit.Test;
-public class HomePageResourceTest {
+public class HomePageResourceTest_xrofollowlinks {
@Rule
public IsisWebServerRule webServerRule = new IsisWebServerRule();
@@ -51,59 +51,6 @@ public class HomePageResourceTest {
resource = client.getHomePageResource();
}
- @Test
- public void representation() throws Exception {
-
- // given
- Response resp = resource.resources();
-
- // when
- RestfulResponse<HomePageRepresentation> jsonResp = RestfulResponse.ofT(resp);
- assertThat(jsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));
-
- // then
- assertThat(jsonResp.getStatus(), is(HttpStatusCode.OK));
- assertThat(jsonResp.getHeader(RestfulResponse.Header.CONTENT_TYPE), is(RepresentationType.HOME_PAGE.getMediaType()));
- assertThat(jsonResp.getHeader(RestfulResponse.Header.CACHE_CONTROL).getMaxAge(), is(24*60*60));
-
- HomePageRepresentation repr = jsonResp.getEntity();
- assertThat(repr, is(not(nullValue())));
- assertThat(repr.isMap(), is(true));
-
- assertThat(repr.getSelf(), isLink(client).method(Method.GET));
- assertThat(repr.getUser(), isLink(client).method(Method.GET));
- assertThat(repr.getServices(), isLink(client).method(Method.GET));
- assertThat(repr.getCapabilities(), isLink(client).method(Method.GET));
-
- assertThat(repr.getLinks(), isArray());
- assertThat(repr.getExtensions(), isMap());
- }
-
- @Test
- public void self_isFollowable() throws Exception {
- // given
- HomePageRepresentation repr = givenRepresentation();
-
- // when, then
- assertThat(repr, isFollowableLinkToSelf(client));
- }
-
- @Test
- public void links() throws Exception {
- // given
- HomePageRepresentation repr = givenRepresentation();
-
- // when, then
- assertThat(repr.getServices(), isLink(client).returning(HttpStatusCode.OK));
- assertThat(repr.getUser(), isLink(client).returning(HttpStatusCode.OK));
- assertThat(repr.getCapabilities(), isLink(client).returning(HttpStatusCode.OK));
- }
-
- private HomePageRepresentation givenRepresentation() throws JsonParseException, JsonMappingException, IOException {
- return entityOf(resource.resources(), HomePageRepresentation.class);
- }
-
-
@Ignore("in progress")
@Test
public void xrofollowLinks() throws Exception {
Copied: incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/object/DomainObjectResourceTest.java (from r1176828, incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/DomainObjectResourceTest.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/object/DomainObjectResourceTest.java?p2=incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/object/DomainObjectResourceTest.java&p1=incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/DomainObjectResourceTest.java&r1=1176828&r2=1178710&rev=1178710&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/DomainObjectResourceTest.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/object/DomainObjectResourceTest.java Tue Oct 4 07:49:27 2011
@@ -1,4 +1,4 @@
-package org.apache.isis.viewer.json.tck;
+package org.apache.isis.viewer.json.tck.resources.object;
import static org.apache.isis.core.commons.matchers.IsisMatchers.matches;
import static org.apache.isis.viewer.json.tck.RepresentationMatchers.assertThat;
@@ -24,6 +24,7 @@ import org.apache.isis.viewer.json.appli
import org.apache.isis.viewer.json.applib.domainobjects.ObjectActionRepresentation;
import org.apache.isis.viewer.json.applib.domainobjects.ObjectPropertyRepresentation;
import org.apache.isis.viewer.json.applib.domainobjects.ScalarValueRepresentation;
+import org.apache.isis.viewer.json.tck.IsisWebServerRule;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
Copied: incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/DomainServiceResourceTest_invokeAction.java (from r1167411, incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/DomainServiceResourceTest_invokeAction.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/DomainServiceResourceTest_invokeAction.java?p2=incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/DomainServiceResourceTest_invokeAction.java&p1=incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/DomainServiceResourceTest_invokeAction.java&r1=1167411&r2=1178710&rev=1178710&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/DomainServiceResourceTest_invokeAction.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/DomainServiceResourceTest_invokeAction.java Tue Oct 4 07:49:27 2011
@@ -1,11 +1,14 @@
-package org.apache.isis.viewer.json.tck;
+package org.apache.isis.viewer.json.tck.resources.service;
import java.io.IOException;
import org.apache.isis.runtimes.dflt.webserver.WebServer;
import org.apache.isis.viewer.json.applib.RestfulClient;
+import org.apache.isis.viewer.json.applib.RestfulResponse;
import org.apache.isis.viewer.json.applib.domainobjects.DomainObjectRepresentation;
import org.apache.isis.viewer.json.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.json.tck.IsisWebServerRule;
+import org.apache.isis.viewer.json.tck.RepresentationMatchers;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
import org.junit.Before;
@@ -42,7 +45,8 @@ public class DomainServiceResourceTest_i
private DomainObjectRepresentation givenRepresentation(String serviceId) throws JsonParseException, JsonMappingException, IOException {
- return RepresentationMatchers.entityOf(resource.service(serviceId), DomainObjectRepresentation.class);
+ RestfulResponse<DomainObjectRepresentation> jsonResp = RestfulResponse.ofT(resource.service(serviceId));
+ return jsonResp.getEntity();
}
Copied: incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/DomainServiceResourceTest_service_serviceId.java (from r1178596, incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/DomainServiceResourceTest_service_serviceId.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/DomainServiceResourceTest_service_serviceId.java?p2=incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/DomainServiceResourceTest_service_serviceId.java&p1=incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/DomainServiceResourceTest_service_serviceId.java&r1=1178596&r2=1178710&rev=1178710&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/DomainServiceResourceTest_service_serviceId.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/DomainServiceResourceTest_service_serviceId.java Tue Oct 4 07:49:27 2011
@@ -1,4 +1,4 @@
-package org.apache.isis.viewer.json.tck;
+package org.apache.isis.viewer.json.tck.resources.service;
import static org.apache.isis.core.commons.matchers.IsisMatchers.matches;
import static org.apache.isis.viewer.json.tck.RepresentationMatchers.assertThat;
@@ -26,6 +26,8 @@ import org.apache.isis.viewer.json.appli
import org.apache.isis.viewer.json.applib.domainobjects.DomainObjectRepresentation;
import org.apache.isis.viewer.json.applib.domainobjects.DomainServiceResource;
import org.apache.isis.viewer.json.applib.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.json.tck.IsisWebServerRule;
+import org.apache.isis.viewer.json.tck.RepresentationMatchers;
import org.apache.isis.viewer.json.viewer.resources.domainobjects.MemberType;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
@@ -158,7 +160,8 @@ public class DomainServiceResourceTest_s
private DomainObjectRepresentation givenRepresentation(String serviceId) throws JsonParseException, JsonMappingException, IOException {
- return RepresentationMatchers.entityOf(resource.service(serviceId), DomainObjectRepresentation.class);
+ RestfulResponse<DomainObjectRepresentation> jsonResp = RestfulResponse.ofT(resource.service(serviceId));
+ return jsonResp.getEntity();
}
Copied: incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/DomainServiceResourceTest_services.java (from r1176828, incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/DomainServiceResourceTest_services.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/DomainServiceResourceTest_services.java?p2=incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/DomainServiceResourceTest_services.java&p1=incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/DomainServiceResourceTest_services.java&r1=1176828&r2=1178710&rev=1178710&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/DomainServiceResourceTest_services.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/DomainServiceResourceTest_services.java Tue Oct 4 07:49:27 2011
@@ -1,4 +1,4 @@
-package org.apache.isis.viewer.json.tck;
+package org.apache.isis.viewer.json.tck.resources.service;
import static org.apache.isis.viewer.json.tck.RepresentationMatchers.assertThat;
import static org.apache.isis.viewer.json.tck.RepresentationMatchers.isArray;
@@ -23,6 +23,8 @@ import org.apache.isis.viewer.json.appli
import org.apache.isis.viewer.json.applib.blocks.Method;
import org.apache.isis.viewer.json.applib.domainobjects.DomainServiceResource;
import org.apache.isis.viewer.json.applib.domainobjects.ListRepresentation;
+import org.apache.isis.viewer.json.tck.IsisWebServerRule;
+import org.apache.isis.viewer.json.tck.RepresentationMatchers;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
import org.junit.Before;
@@ -106,7 +108,8 @@ public class DomainServiceResourceTest_s
private ListRepresentation givenRepresentation() throws JsonParseException, JsonMappingException, IOException {
- return RepresentationMatchers.entityOf(resource.services(), ListRepresentation.class);
+ RestfulResponse<ListRepresentation> jsonResp = RestfulResponse.ofT(resource.services());
+ return jsonResp.getEntity();
}
Copied: incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/user/UserResourceTest.java (from r1177294, incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/UserResourceTest.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/user/UserResourceTest.java?p2=incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/user/UserResourceTest.java&p1=incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/UserResourceTest.java&r1=1177294&r2=1178710&rev=1178710&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/UserResourceTest.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/user/UserResourceTest.java Tue Oct 4 07:49:27 2011
@@ -1,7 +1,6 @@
-package org.apache.isis.viewer.json.tck;
+package org.apache.isis.viewer.json.tck.resources.user;
import static org.apache.isis.viewer.json.tck.RepresentationMatchers.assertThat;
-import static org.apache.isis.viewer.json.tck.RepresentationMatchers.entityOf;
import static org.apache.isis.viewer.json.tck.RepresentationMatchers.isArray;
import static org.apache.isis.viewer.json.tck.RepresentationMatchers.isFollowableLinkToSelf;
import static org.apache.isis.viewer.json.tck.RepresentationMatchers.isLink;
@@ -24,6 +23,7 @@ import org.apache.isis.viewer.json.appli
import org.apache.isis.viewer.json.applib.blocks.Method;
import org.apache.isis.viewer.json.applib.user.UserRepresentation;
import org.apache.isis.viewer.json.applib.user.UserResource;
+import org.apache.isis.viewer.json.tck.IsisWebServerRule;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
import org.junit.Before;
@@ -89,7 +89,8 @@ public class UserResourceTest {
}
private UserRepresentation givenRepresentation() throws JsonParseException, JsonMappingException, IOException {
- return entityOf(resource.user(), UserRepresentation.class);
+ RestfulResponse<UserRepresentation> jsonResp = RestfulResponse.ofT(resource.user());
+ return jsonResp.getEntity();
}
}
Copied: incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/stories/UserStoryTest.java (from r1167069, incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/UserStoryTest.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/stories/UserStoryTest.java?p2=incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/stories/UserStoryTest.java&p1=incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/UserStoryTest.java&r1=1167069&r2=1178710&rev=1178710&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/UserStoryTest.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/stories/UserStoryTest.java Tue Oct 4 07:49:27 2011
@@ -1,4 +1,4 @@
-package org.apache.isis.viewer.json.tck;
+package org.apache.isis.viewer.json.tck.stories;
import static org.apache.isis.core.commons.matchers.IsisMatchers.matches;
import static org.junit.Assert.assertThat;
@@ -10,6 +10,7 @@ import org.apache.isis.viewer.json.appli
import org.apache.isis.viewer.json.applib.RepresentationWalker;
import org.apache.isis.viewer.json.applib.RestfulClient;
import org.apache.isis.viewer.json.applib.homepage.HomePageResource;
+import org.apache.isis.viewer.json.tck.IsisWebServerRule;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;