You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2014/03/28 12:42:30 UTC
[3/3] git commit: ISIS-421: RO TCK tests (405 status)
ISIS-421: RO TCK tests (405 status)
Lots more tests checking for 405 response code when hit resource with invalid HTTP method.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/430a836a
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/430a836a
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/430a836a
Branch: refs/heads/master
Commit: 430a836ab4337b69777150fae89ef643caa774df
Parents: 99a87cc
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Fri Mar 28 11:30:42 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Fri Mar 28 11:30:42 2014 +0000
----------------------------------------------------------------------
.../domainobjects/DomainObjectResource.java | 21 ++++++
.../domainobjects/DomainServiceResource.java | 17 ++++-
.../DomainObjectResourceServerside.java | 26 +++++++
.../DomainServiceResourceServerside.java | 21 ++++++
.../Post_thenResponseCode_205_bad_TODO.java | 23 ------
.../property/Post_thenResponseCode_405_bad.java | 75 ++++++++++++++++++++
.../Delete_thenResponseCode_205_bad_TODO.java | 23 ------
.../action/Delete_thenResponseCode_405_bad.java | 72 +++++++++++++++++++
.../Post_thenResponseCode_205_bad_TODO.java | 23 ------
.../action/Post_thenResponseCode_405_bad.java | 72 +++++++++++++++++++
.../Put_thenResponseCode_205_bad_TODO.java | 23 ------
.../id/action/Put_thenResponseCode_405_bad.java | 72 +++++++++++++++++++
...enObjectAction_thenResponseCode_405_bad.java | 23 ++++++
...nServiceAction_thenResponseCode_405_bad.java | 75 ++++++++++++++++++++
.../Delete_thenResponseCode_205_bad_TODO.java | 23 ------
.../Delete_thenResponseCode_205_bad_TODO.java | 23 ------
.../root/Delete_thenResponseCode_405_bad.java | 72 +++++++++++++++++++
.../Post_thenResponseCode_205_bad_TODO.java | 23 ------
.../root/Post_thenResponseCode_405_bad.java | 72 +++++++++++++++++++
.../root/Put_thenResponseCode_205_bad_TODO.java | 23 ------
.../root/Put_thenResponseCode_405_bad.java | 72 +++++++++++++++++++
21 files changed, 689 insertions(+), 185 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/430a836a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectResource.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectResource.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectResource.java
index f376e98..c4b2099 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectResource.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainObjectResource.java
@@ -94,6 +94,11 @@ public interface DomainObjectResource {
@ClientResponseType(entityType = String.class)
public Response clearProperty(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId, @PathParam("propertyId") final String propertyId);
+ @POST
+ @Path("/{domainType}/{instanceId}/properties/{propertyId}")
+ public Response postPropertyNotAllowed(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId, @PathParam("propertyId") final String propertyId);
+
+
// //////////////////////////////////////////////////////////
// domain object collection
// //////////////////////////////////////////////////////////
@@ -133,6 +138,18 @@ public interface DomainObjectResource {
@ClientResponseType(entityType = String.class)
public Response actionPrompt(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId, @PathParam("actionId") final String actionId);
+ @DELETE
+ @Path("/{domainType}/{instanceId}/actions/{actionId}")
+ public Response deleteActionPromptNotAllowed(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId, @PathParam("actionId") final String actionId);
+
+ @PUT
+ @Path("/{domainType}/{instanceId}/actions/{actionId}")
+ public Response putActionPromptNotAllowed(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId, @PathParam("actionId") final String actionId);
+
+ @POST
+ @Path("/{domainType}/{instanceId}/actions/{actionId}")
+ public Response postActionPromptNotAllowed(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId, @PathParam("actionId") final String actionId);
+
// //////////////////////////////////////////////////////////
// domain object action invoke
// //////////////////////////////////////////////////////////
@@ -157,4 +174,8 @@ public interface DomainObjectResource {
@ClientResponseType(entityType = String.class)
public Response invokeAction(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId, @PathParam("actionId") final String actionId, final InputStream arguments);
+ @DELETE
+ @Path("/{domainType}/{instanceId}/actions/{actionId}/invoke")
+ public Response deleteInvokeActionNotAllowed(@PathParam("domainType") String domainType, @PathParam("instanceId") final String instanceId, @PathParam("actionId") final String actionId);
+
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/430a836a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainServiceResource.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainServiceResource.java b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainServiceResource.java
index d67aa4a..da2c4ac 100644
--- a/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainServiceResource.java
+++ b/component/viewer/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/domainobjects/DomainServiceResource.java
@@ -55,6 +55,18 @@ public interface DomainServiceResource {
@ClientResponseType(entityType = String.class)
public Response service(@PathParam("serviceId") final String serviceId);
+ @DELETE
+ @Path("/{serviceId}")
+ public Response deleteServiceNotAllowed(@PathParam("serviceId") final String serviceId);
+
+ @PUT
+ @Path("/{serviceId}")
+ public Response putServiceNotAllowed(@PathParam("serviceId") final String serviceId);
+
+ @POST
+ @Path("/{serviceId}")
+ public Response postServiceNotAllowed(@PathParam("serviceId") final String serviceId);
+
// //////////////////////////////////////////////////////////
// domain service property
// //////////////////////////////////////////////////////////
@@ -65,7 +77,6 @@ public interface DomainServiceResource {
@ClientResponseType(entityType = String.class)
public Response propertyDetails(@PathParam("serviceId") final String serviceId, @PathParam("propertyId") final String propertyId);
-
// //////////////////////////////////////////////////////////
// domain service collection
// //////////////////////////////////////////////////////////
@@ -117,4 +128,8 @@ public interface DomainServiceResource {
@Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_ACTION_RESULT, RestfulMediaType.APPLICATION_JSON_ERROR })
@ClientResponseType(entityType = String.class)
public Response invokeAction(@PathParam("serviceId") final String serviceId, @PathParam("actionId") final String actionId, final InputStream arguments);
+
+ @DELETE
+ @Path("/{serviceId}/actions/{actionId}/invoke")
+ public Response deleteInvokeActionNotAllowed(@PathParam("serviceId") final String serviceId, @PathParam("actionId") final String actionId);
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/430a836a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainObjectResourceServerside.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainObjectResourceServerside.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainObjectResourceServerside.java
index 8841c69..dcd3843 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainObjectResourceServerside.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainObjectResourceServerside.java
@@ -42,6 +42,7 @@ import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
import org.apache.isis.viewer.restfulobjects.applib.RestfulMediaType;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectResource;
import org.apache.isis.viewer.restfulobjects.server.RestfulObjectsApplicationException;
@@ -220,6 +221,11 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
return helper.propertyDetails(propertyId, MemberMode.MUTATING, Caching.NONE, getResourceContext().getWhere());
}
+ @Override
+ public Response postPropertyNotAllowed(@PathParam("domainType") String domainType, @PathParam("instanceId") String instanceId, @PathParam("propertyId") String propertyId) {
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.METHOD_NOT_ALLOWED, "Posting to a property resource is not allowed.");
+ }
+
// //////////////////////////////////////////////////////////
// domain object collection
// //////////////////////////////////////////////////////////
@@ -341,6 +347,21 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
return helper.actionPrompt(actionId, getResourceContext().getWhere());
}
+ @Override
+ public Response deleteActionPromptNotAllowed(@PathParam("domainType") String domainType, @PathParam("instanceId") String instanceId, @PathParam("actionId") String actionId) {
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.METHOD_NOT_ALLOWED, "Deleting action prompt resource is not allowed.");
+ }
+
+ @Override
+ public Response postActionPromptNotAllowed(@PathParam("domainType") String domainType, @PathParam("instanceId") String instanceId, @PathParam("actionId") String actionId) {
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.METHOD_NOT_ALLOWED, "Posting to an action prompt resource is not allowed.");
+ }
+
+ @Override
+ public Response putActionPromptNotAllowed(@PathParam("domainType") String domainType, @PathParam("instanceId") String instanceId, @PathParam("actionId") String actionId) {
+ throw RestfulObjectsApplicationException.createWithMessage(HttpStatusCode.METHOD_NOT_ALLOWED, "Putting to an action prompt resource is not allowed.");
+ }
+
// //////////////////////////////////////////////////////////
// domain object action invoke
// //////////////////////////////////////////////////////////
@@ -392,4 +413,9 @@ public class DomainObjectResourceServerside extends ResourceAbstract implements
return helper.invokeAction(actionId, arguments, getResourceContext().getWhere());
}
+ @Override
+ public Response deleteInvokeActionNotAllowed(@PathParam("domainType") String domainType, @PathParam("instanceId") String instanceId, @PathParam("actionId") String actionId) {
+ throw RestfulObjectsApplicationException.createWithMessage(RestfulResponse.HttpStatusCode.METHOD_NOT_ALLOWED, "Deleting an action invocation resource is not allowed.");
+ }
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/430a836a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java
index 66fac6e..c110fee 100644
--- a/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java
+++ b/component/viewer/restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/DomainServiceResourceServerside.java
@@ -37,9 +37,11 @@ import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
import org.apache.isis.viewer.restfulobjects.applib.RestfulMediaType;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
import org.apache.isis.viewer.restfulobjects.rendering.domainobjects.DomainObjectReprRenderer;
import org.apache.isis.viewer.restfulobjects.rendering.domainobjects.DomainServiceLinkTo;
+import org.apache.isis.viewer.restfulobjects.server.RestfulObjectsApplicationException;
import org.apache.isis.viewer.restfulobjects.server.resources.DomainResourceHelper.MemberMode;
import org.apache.isis.viewer.restfulobjects.server.resources.ResourceAbstract.Caching;
@@ -84,6 +86,21 @@ public class DomainServiceResourceServerside extends ResourceAbstract implements
return responseOfOk(renderer, Caching.ONE_DAY).build();
}
+ @Override
+ public Response deleteServiceNotAllowed(@PathParam("serviceId") String serviceId) {
+ throw RestfulObjectsApplicationException.createWithMessage(RestfulResponse.HttpStatusCode.METHOD_NOT_ALLOWED, "Deleting a service resource is not allowed.");
+ }
+
+ @Override
+ public Response putServiceNotAllowed(@PathParam("serviceId") String serviceId) {
+ throw RestfulObjectsApplicationException.createWithMessage(RestfulResponse.HttpStatusCode.METHOD_NOT_ALLOWED, "Putting to a service resource is not allowed.");
+ }
+
+ @Override
+ public Response postServiceNotAllowed(@PathParam("serviceId") String serviceId) {
+ throw RestfulObjectsApplicationException.createWithMessage(RestfulResponse.HttpStatusCode.METHOD_NOT_ALLOWED, "Posting to a service resource is not allowed.");
+ }
+
// //////////////////////////////////////////////////////////
// domain service property
// //////////////////////////////////////////////////////////
@@ -186,5 +203,9 @@ public class DomainServiceResourceServerside extends ResourceAbstract implements
return helper.invokeAction(actionId, arguments, getResourceContext().getWhere());
}
+ @Override
+ public Response deleteInvokeActionNotAllowed(@PathParam("serviceId") String serviceId, @PathParam("actionId") String actionId) {
+ throw RestfulObjectsApplicationException.createWithMessage(RestfulResponse.HttpStatusCode.METHOD_NOT_ALLOWED, "Deleting an action invocation resource is not allowed.");
+ }
}
http://git-wip-us.apache.org/repos/asf/isis/blob/430a836a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Post_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Post_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Post_thenResponseCode_205_bad_TODO.java
deleted file mode 100644
index 60ea1b5..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Post_thenResponseCode_205_bad_TODO.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
-
-public class Post_thenResponseCode_205_bad_TODO {
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/430a836a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Post_thenResponseCode_405_bad.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Post_thenResponseCode_405_bad.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Post_thenResponseCode_405_bad.java
new file mode 100644
index 0000000..db727be
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Post_thenResponseCode_405_bad.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+import javax.ws.rs.core.Response;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.*;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectPropertyRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isMap;
+import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.CoreMatchers.endsWith;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public class Post_thenResponseCode_405_bad {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+ private DomainObjectResource domainObjectResource;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ domainObjectResource = client.getDomainObjectResource();
+ }
+
+
+ @Test
+ public void representation() throws Exception {
+
+ // given
+ final Response idPropertyResp = domainObjectResource.propertyDetails("org.apache.isis.core.tck.dom.defaults.WithDefaultsEntity","58", "anInt");
+ final RestfulResponse<ObjectPropertyRepresentation> idPropertyJsonResp = RestfulResponse.ofT(idPropertyResp);
+ final ObjectPropertyRepresentation propertyRepr = idPropertyJsonResp.getEntity();
+ final LinkRepresentation selfLink = propertyRepr.getLinkWithRel(Rel.SELF);
+ final LinkRepresentation postLink = selfLink.withMethod(RestfulHttpMethod.POST);
+
+ // when
+ final RestfulResponse<JsonRepresentation> restfulResponse = client.follow(postLink);
+
+ // then
+ assertThat(restfulResponse.getStatus(), is(RestfulResponse.HttpStatusCode.METHOD_NOT_ALLOWED));
+ assertThat(restfulResponse.getHeader(RestfulResponse.Header.WARNING), is("Posting to a property resource is not allowed."));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/430a836a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Delete_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Delete_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Delete_thenResponseCode_205_bad_TODO.java
deleted file mode 100644
index adc4c79..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Delete_thenResponseCode_205_bad_TODO.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action;
-
-public class Delete_thenResponseCode_205_bad_TODO {
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/430a836a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Delete_thenResponseCode_405_bad.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Delete_thenResponseCode_405_bad.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Delete_thenResponseCode_405_bad.java
new file mode 100644
index 0000000..58218e5
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Delete_thenResponseCode_405_bad.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action;
+
+import javax.ws.rs.core.Response;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public class Delete_thenResponseCode_405_bad {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+ private DomainObjectResource domainObjectResource;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ domainObjectResource = client.getDomainObjectResource();
+ }
+
+ @Test
+ public void representation() throws Exception {
+
+ // given
+ final Response actionPromptResp = domainObjectResource.actionPrompt("RTNE", "67", "contains");
+ final RestfulResponse<ObjectActionRepresentation> actionPromptJsonResp = RestfulResponse.ofT(actionPromptResp);
+ final ObjectActionRepresentation actionPromptRepr = actionPromptJsonResp.getEntity();
+ final LinkRepresentation selfLink = actionPromptRepr.getLinkWithRel(Rel.SELF);
+ final LinkRepresentation deleteLink = selfLink.withMethod(RestfulHttpMethod.DELETE);
+
+ // when
+ final RestfulResponse<JsonRepresentation> restfulResponse = client.follow(deleteLink);
+
+ // then
+ assertThat(restfulResponse.getStatus(), is(RestfulResponse.HttpStatusCode.METHOD_NOT_ALLOWED));
+ assertThat(restfulResponse.getHeader(RestfulResponse.Header.WARNING), is("Deleting action prompt resource is not allowed."));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/430a836a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Post_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Post_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Post_thenResponseCode_205_bad_TODO.java
deleted file mode 100644
index a296ef4..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Post_thenResponseCode_205_bad_TODO.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action;
-
-public class Post_thenResponseCode_205_bad_TODO {
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/430a836a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Post_thenResponseCode_405_bad.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Post_thenResponseCode_405_bad.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Post_thenResponseCode_405_bad.java
new file mode 100644
index 0000000..352542b
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Post_thenResponseCode_405_bad.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action;
+
+import javax.ws.rs.core.Response;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public class Post_thenResponseCode_405_bad {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+ private DomainObjectResource domainObjectResource;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ domainObjectResource = client.getDomainObjectResource();
+ }
+
+ @Test
+ public void representation() throws Exception {
+
+ // given
+ final Response actionPromptResp = domainObjectResource.actionPrompt("RTNE", "67", "contains");
+ final RestfulResponse<ObjectActionRepresentation> actionPromptJsonResp = RestfulResponse.ofT(actionPromptResp);
+ final ObjectActionRepresentation actionPromptRepr = actionPromptJsonResp.getEntity();
+ final LinkRepresentation selfLink = actionPromptRepr.getLinkWithRel(Rel.SELF);
+ final LinkRepresentation deleteLink = selfLink.withMethod(RestfulHttpMethod.POST);
+
+ // when
+ final RestfulResponse<JsonRepresentation> restfulResponse = client.follow(deleteLink);
+
+ // then
+ assertThat(restfulResponse.getStatus(), is(RestfulResponse.HttpStatusCode.METHOD_NOT_ALLOWED));
+ assertThat(restfulResponse.getHeader(RestfulResponse.Header.WARNING), is("Posting to an action prompt resource is not allowed."));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/430a836a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Put_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Put_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Put_thenResponseCode_205_bad_TODO.java
deleted file mode 100644
index b3fe180..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Put_thenResponseCode_205_bad_TODO.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action;
-
-public class Put_thenResponseCode_205_bad_TODO {
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/430a836a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Put_thenResponseCode_405_bad.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Put_thenResponseCode_405_bad.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Put_thenResponseCode_405_bad.java
new file mode 100644
index 0000000..2bb6225
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/Put_thenResponseCode_405_bad.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action;
+
+import javax.ws.rs.core.Response;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public class Put_thenResponseCode_405_bad {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+ private DomainObjectResource domainObjectResource;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ domainObjectResource = client.getDomainObjectResource();
+ }
+
+ @Test
+ public void representation() throws Exception {
+
+ // given
+ final Response actionPromptResp = domainObjectResource.actionPrompt("RTNE", "67", "contains");
+ final RestfulResponse<ObjectActionRepresentation> actionPromptJsonResp = RestfulResponse.ofT(actionPromptResp);
+ final ObjectActionRepresentation actionPromptRepr = actionPromptJsonResp.getEntity();
+ final LinkRepresentation selfLink = actionPromptRepr.getLinkWithRel(Rel.SELF);
+ final LinkRepresentation deleteLink = selfLink.withMethod(RestfulHttpMethod.PUT);
+
+ // when
+ final RestfulResponse<JsonRepresentation> restfulResponse = client.follow(deleteLink);
+
+ // then
+ assertThat(restfulResponse.getStatus(), is(RestfulResponse.HttpStatusCode.METHOD_NOT_ALLOWED));
+ assertThat(restfulResponse.getHeader(RestfulResponse.Header.WARNING), is("Putting to an action prompt resource is not allowed."));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/430a836a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Delete_givenObjectAction_thenResponseCode_405_bad.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Delete_givenObjectAction_thenResponseCode_405_bad.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Delete_givenObjectAction_thenResponseCode_405_bad.java
new file mode 100644
index 0000000..1dbcecc
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Delete_givenObjectAction_thenResponseCode_405_bad.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+public class Delete_givenObjectAction_thenResponseCode_405_bad {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/430a836a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Delete_givenServiceAction_thenResponseCode_405_bad.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Delete_givenServiceAction_thenResponseCode_405_bad.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Delete_givenServiceAction_thenResponseCode_405_bad.java
new file mode 100644
index 0000000..2f6c762
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Delete_givenServiceAction_thenResponseCode_405_bad.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
+
+import javax.ws.rs.core.Response;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.apache.isis.viewer.restfulobjects.applib.*;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ActionResultRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ListRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+import org.apache.isis.viewer.restfulobjects.tck.Util;
+
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.hasProfile;
+import static org.apache.isis.viewer.restfulobjects.tck.RestfulMatchers.isLink;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public class Delete_givenServiceAction_thenResponseCode_405_bad {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ private RestfulClient client;
+
+ private DomainServiceResource serviceResource;
+
+ @Before
+ public void setUp() throws Exception {
+ client = webServerRule.getClient();
+
+ serviceResource = client.getDomainServiceResource();
+ }
+
+ @Test
+ public void usingClientFollow() throws Exception {
+
+ // given
+ final JsonRepresentation givenAction = Util.givenAction(client, "ActionsEntities", "list");
+ final ObjectActionRepresentation actionRepr = givenAction.as(ObjectActionRepresentation.class);
+
+ final LinkRepresentation invokeLink = actionRepr.getInvoke();
+ final LinkRepresentation deleteLink = invokeLink.withMethod(RestfulHttpMethod.DELETE);
+
+ // when
+ final RestfulResponse<ActionResultRepresentation> restfulResponse = client.followT(invokeLink);
+
+ // then
+ // then
+ assertThat(restfulResponse.getStatus(), is(RestfulResponse.HttpStatusCode.METHOD_NOT_ALLOWED));
+ assertThat(restfulResponse.getHeader(RestfulResponse.Header.WARNING), is("Deleting an action invocation resource is not allowed."));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/430a836a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Delete_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Delete_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Delete_thenResponseCode_205_bad_TODO.java
deleted file mode 100644
index fe5d235..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobjectorservice/id/action/invoke/Delete_thenResponseCode_205_bad_TODO.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.restfulobjects.tck.domainobjectorservice.id.action.invoke;
-
-public class Delete_thenResponseCode_205_bad_TODO {
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/430a836a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Delete_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Delete_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Delete_thenResponseCode_205_bad_TODO.java
deleted file mode 100644
index bfaf401..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Delete_thenResponseCode_205_bad_TODO.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.restfulobjects.tck.domainservice.root;
-
-public class Delete_thenResponseCode_205_bad_TODO {
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/430a836a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Delete_thenResponseCode_405_bad.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Delete_thenResponseCode_405_bad.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Delete_thenResponseCode_405_bad.java
new file mode 100644
index 0000000..ac365b8
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Delete_thenResponseCode_405_bad.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainservice.root;
+
+import javax.ws.rs.core.Response;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public class Delete_thenResponseCode_405_bad {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+ private DomainServiceResource domainServiceResource;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ domainServiceResource = client.getDomainServiceResource();
+ }
+
+ @Test
+ public void followLink() throws Exception {
+
+ // given
+ final Response serviceResp = domainServiceResource.service("ActionsEntities");
+ final RestfulResponse<DomainObjectRepresentation> serviceJsonResp = RestfulResponse.ofT(serviceResp);
+ final DomainObjectRepresentation serviceRepr = serviceJsonResp.getEntity();
+ final LinkRepresentation selfLink = serviceRepr.getLinkWithRel(Rel.SELF);
+ final LinkRepresentation deleteLink = selfLink.withMethod(RestfulHttpMethod.DELETE);
+
+ // when
+ final RestfulResponse<JsonRepresentation> restfulResponse = client.follow(deleteLink);
+
+ // then
+ assertThat(restfulResponse.getStatus(), is(RestfulResponse.HttpStatusCode.METHOD_NOT_ALLOWED));
+ assertThat(restfulResponse.getHeader(RestfulResponse.Header.WARNING), is("Deleting a service resource is not allowed."));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/430a836a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Post_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Post_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Post_thenResponseCode_205_bad_TODO.java
deleted file mode 100644
index 65d98ee..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Post_thenResponseCode_205_bad_TODO.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.restfulobjects.tck.domainservice.root;
-
-public class Post_thenResponseCode_205_bad_TODO {
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/430a836a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Post_thenResponseCode_405_bad.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Post_thenResponseCode_405_bad.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Post_thenResponseCode_405_bad.java
new file mode 100644
index 0000000..7956b5f
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Post_thenResponseCode_405_bad.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainservice.root;
+
+import javax.ws.rs.core.Response;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public class Post_thenResponseCode_405_bad {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+ private DomainServiceResource domainServiceResource;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ domainServiceResource = client.getDomainServiceResource();
+ }
+
+ @Test
+ public void followLink() throws Exception {
+
+ // given
+ final Response serviceResp = domainServiceResource.service("ActionsEntities");
+ final RestfulResponse<DomainObjectRepresentation> serviceJsonResp = RestfulResponse.ofT(serviceResp);
+ final DomainObjectRepresentation serviceRepr = serviceJsonResp.getEntity();
+ final LinkRepresentation selfLink = serviceRepr.getLinkWithRel(Rel.SELF);
+ final LinkRepresentation postLink = selfLink.withMethod(RestfulHttpMethod.POST);
+
+ // when
+ final RestfulResponse<JsonRepresentation> restfulResponse = client.follow(postLink);
+
+ // then
+ assertThat(restfulResponse.getStatus(), is(RestfulResponse.HttpStatusCode.METHOD_NOT_ALLOWED));
+ assertThat(restfulResponse.getHeader(RestfulResponse.Header.WARNING), is("Posting to a service resource is not allowed."));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/430a836a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Put_thenResponseCode_205_bad_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Put_thenResponseCode_205_bad_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Put_thenResponseCode_205_bad_TODO.java
deleted file mode 100644
index 08c8c7e..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Put_thenResponseCode_205_bad_TODO.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.restfulobjects.tck.domainservice.root;
-
-public class Put_thenResponseCode_205_bad_TODO {
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/430a836a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Put_thenResponseCode_405_bad.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Put_thenResponseCode_405_bad.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Put_thenResponseCode_405_bad.java
new file mode 100644
index 0000000..13afe1a
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainservice/root/Put_thenResponseCode_405_bad.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainservice.root;
+
+import javax.ws.rs.core.Response;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
+import org.apache.isis.viewer.restfulobjects.applib.RestfulHttpMethod;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public class Put_thenResponseCode_405_bad {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+ private DomainServiceResource domainServiceResource;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ domainServiceResource = client.getDomainServiceResource();
+ }
+
+ @Test
+ public void followLink() throws Exception {
+
+ // given
+ final Response serviceResp = domainServiceResource.service("ActionsEntities");
+ final RestfulResponse<DomainObjectRepresentation> serviceJsonResp = RestfulResponse.ofT(serviceResp);
+ final DomainObjectRepresentation serviceRepr = serviceJsonResp.getEntity();
+ final LinkRepresentation selfLink = serviceRepr.getLinkWithRel(Rel.SELF);
+ final LinkRepresentation postLink = selfLink.withMethod(RestfulHttpMethod.PUT);
+
+ // when
+ final RestfulResponse<JsonRepresentation> restfulResponse = client.follow(postLink);
+
+ // then
+ assertThat(restfulResponse.getStatus(), is(RestfulResponse.HttpStatusCode.METHOD_NOT_ALLOWED));
+ assertThat(restfulResponse.getHeader(RestfulResponse.Header.WARNING), is("Putting to a service resource is not allowed."));
+ }
+
+}