You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by jo...@apache.org on 2021/01/20 17:34:50 UTC

[isis] 02/03: ActionDispatcher was passed on to RoXmlHttpRequest, even in cases where the response was an TObject(DomainObject) and not an Action. This resulted in a ClassCastException.

This is an automated email from the ASF dual-hosted git repository.

joergrade pushed a commit to branch ISIS-2465_Kroviz-Demo_Menu_Actions_Show_No_Output
in repository https://gitbox.apache.org/repos/asf/isis.git

commit 714f4e846d96921ac8cd60ff4cdab9d5bbf17bd1
Author: Jörg Rade <jo...@kuehne-nagel.com>
AuthorDate: Wed Jan 20 18:33:08 2021 +0100

    ActionDispatcher was passed on to RoXmlHttpRequest, even in cases where the response was an TObject(DomainObject) and not an Action. This resulted in a ClassCastException.
---
 .../kroviz/core/aggregator/ActionDispatcherTest.kt | 54 ++++++++++++++++++++++
 .../client/kroviz/handler/ActionHandlerTest.kt     |  4 ++
 .../client/kroviz/handler/ResponseHandlerTest.kt   |  4 ++
 ...ACTIONS_STRING_INVOKE.kt => ACTIONS_STRINGS.kt} |  0
 ..._STRING_INVOKE.kt => ACTIONS_STRINGS_INVOKE.kt} | 28 +++++------
 5 files changed, 76 insertions(+), 14 deletions(-)

diff --git a/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/core/aggregator/ActionDispatcherTest.kt b/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/core/aggregator/ActionDispatcherTest.kt
new file mode 100644
index 0000000..d8699b9
--- /dev/null
+++ b/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/core/aggregator/ActionDispatcherTest.kt
@@ -0,0 +1,54 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.client.kroviz.core.aggregator
+
+import kotlinx.serialization.UnstableDefault
+import org.apache.isis.client.kroviz.IntegrationTest
+import org.apache.isis.client.kroviz.snapshots.simpleapp1_16_0.ACTION_SO_CREATE
+import org.apache.isis.client.kroviz.to.ResultObject
+import org.apache.isis.client.kroviz.to.ResultType
+import kotlin.test.Test
+import kotlin.test.assertEquals
+
+@UnstableDefault
+class ObjectAggregatorTest : IntegrationTest() {
+
+    @Test
+    fun testRestfulServices() {
+        // given
+        val aggregator = ObjectAggregator("object test")
+        // when
+        val logEntry = mockResponse(ACTION_SO_CREATE, aggregator)
+        val ro = logEntry.getTransferObject() as ResultObject
+        val type = ro.resulttype
+        // then
+        assertEquals(ResultType.DOMAINOBJECT.type, type)
+
+        val links = ro.links
+        assertEquals(0, links.size)
+
+        val ror = ro.result!!
+
+        val resLinks = ror.links
+        assertEquals(4, resLinks.size)
+
+        val title = ror.title
+        assertEquals("Object: Beutlin", title)
+    }
+}
diff --git a/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/handler/ActionHandlerTest.kt b/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/handler/ActionHandlerTest.kt
new file mode 100644
index 0000000..0f235c5
--- /dev/null
+++ b/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/handler/ActionHandlerTest.kt
@@ -0,0 +1,4 @@
+package org.apache.isis.client.kroviz.handler
+
+class ActionHandlerTest {
+}
diff --git a/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/handler/ResponseHandlerTest.kt b/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/handler/ResponseHandlerTest.kt
new file mode 100644
index 0000000..d43f7e6
--- /dev/null
+++ b/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/handler/ResponseHandlerTest.kt
@@ -0,0 +1,4 @@
+package org.apache.isis.client.kroviz.handler
+
+class ResponseHandlerTest {
+}
diff --git a/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/snapshots/demo2_0_0/ACTIONS_STRING_INVOKE.kt b/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/snapshots/demo2_0_0/ACTIONS_STRINGS.kt
similarity index 100%
copy from incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/snapshots/demo2_0_0/ACTIONS_STRING_INVOKE.kt
copy to incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/snapshots/demo2_0_0/ACTIONS_STRINGS.kt
diff --git a/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/snapshots/demo2_0_0/ACTIONS_STRING_INVOKE.kt b/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/snapshots/demo2_0_0/ACTIONS_STRINGS_INVOKE.kt
similarity index 67%
rename from incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/snapshots/demo2_0_0/ACTIONS_STRING_INVOKE.kt
rename to incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/snapshots/demo2_0_0/ACTIONS_STRINGS_INVOKE.kt
index cf43eb5..ec85a2b 100644
--- a/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/snapshots/demo2_0_0/ACTIONS_STRING_INVOKE.kt
+++ b/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/snapshots/demo2_0_0/ACTIONS_STRINGS_INVOKE.kt
@@ -26,32 +26,32 @@ object ACTIONS_STRING_INVOKE : Response() {
   "links": [
     {
       "rel": "self",
-      "href": "https://demo-wicket.isis.incode.work/restful/objects/demo.JavaLangStrings/PADw_eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiBzdGFuZGFsb25lPSJ5ZXMiPz4KPERlbW8vPgo=",
+      "href": "https://localhost:8080/restful/objects/demo.JavaLangStrings/PADw_eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiBzdGFuZGFsb25lPSJ5ZXMiPz4KPERlbW8vPgo=",
       "method": "GET",
       "type": "application/json;profile=\"urn:org.restfulobjects:repr-types/object\"",
       "title": "String data type"
     },
     {
       "rel": "describedby",
-      "href": "https://demo-wicket.isis.incode.work/restful/domain-types/demo.JavaLangStrings",
+      "href": "https://localhost:8080/restful/domain-types/demo.JavaLangStrings",
       "method": "GET",
       "type": "application/json;profile=\"urn:org.restfulobjects:repr-types/domain-type\""
     },
     {
       "rel": "urn:org.apache.isis.restfulobjects:rels/object-layout",
-      "href": "https://demo-wicket.isis.incode.work/restful/objects/demo.JavaLangStrings/PADw_eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiBzdGFuZGFsb25lPSJ5ZXMiPz4KPERlbW8vPgo=/object-layout",
+      "href": "https://localhost:8080/restful/objects/demo.JavaLangStrings/PADw_eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiBzdGFuZGFsb25lPSJ5ZXMiPz4KPERlbW8vPgo=/object-layout",
       "method": "GET",
       "type": "application/json;profile=\"urn:org.restfulobjects:repr-types/object-layout-bs3\""
     },
     {
       "rel": "urn:org.apache.isis.restfulobjects:rels/object-icon",
-      "href": "https://demo-wicket.isis.incode.work/restful/objects/demo.JavaLangStrings/PADw_eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiBzdGFuZGFsb25lPSJ5ZXMiPz4KPERlbW8vPgo=/image",
+      "href": "https://localhost:8080/restful/objects/demo.JavaLangStrings/PADw_eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiBzdGFuZGFsb25lPSJ5ZXMiPz4KPERlbW8vPgo=/image",
       "method": "GET",
       "type": "image/png"
     },
     {
       "rel": "urn:org.restfulobjects:rels/update",
-      "href": "https://demo-wicket.isis.incode.work/restful/objects/demo.JavaLangStrings:PADw_eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiBzdGFuZGFsb25lPSJ5ZXMiPz4KPERlbW8vPgo=",
+      "href": "https://localhost:8080/restful/objects/demo.JavaLangStrings:PADw_eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiBzdGFuZGFsb25lPSJ5ZXMiPz4KPERlbW8vPgo=",
       "method": "PUT",
       "type": "application/json;profile=\"urn:org.restfulobjects:repr-types/object\"",
       "arguments": {}
@@ -72,7 +72,7 @@ object ACTIONS_STRING_INVOKE : Response() {
       "links": [
         {
           "rel": "urn:org.restfulobjects:rels/details;collection=\"entities\"",
-          "href": "https://demo-wicket.isis.incode.work/restful/objects/demo.JavaLangStrings/PADw_eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiBzdGFuZGFsb25lPSJ5ZXMiPz4KPERlbW8vPgo=/collections/entities",
+          "href": "https://localhost:8080/restful/objects/demo.JavaLangStrings/PADw_eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiBzdGFuZGFsb25lPSJ5ZXMiPz4KPERlbW8vPgo=/collections/entities",
           "method": "GET",
           "type": "application/json;profile=\"urn:org.restfulobjects:repr-types/object-collection\""
         }
@@ -85,7 +85,7 @@ object ACTIONS_STRING_INVOKE : Response() {
       "links": [
         {
           "rel": "urn:org.restfulobjects:rels/details;action=\"openViewModel\"",
-          "href": "https://demo-wicket.isis.incode.work/restful/objects/demo.JavaLangStrings/PADw_eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiBzdGFuZGFsb25lPSJ5ZXMiPz4KPERlbW8vPgo=/actions/openViewModel",
+          "href": "https://localhost:8080/restful/objects/demo.JavaLangStrings/PADw_eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiBzdGFuZGFsb25lPSJ5ZXMiPz4KPERlbW8vPgo=/actions/openViewModel",
           "method": "GET",
           "type": "application/json;profile=\"urn:org.restfulobjects:repr-types/object-action\""
         }
@@ -97,7 +97,7 @@ object ACTIONS_STRING_INVOKE : Response() {
       "links": [
         {
           "rel": "urn:org.restfulobjects:rels/details;action=\"clearHints\"",
-          "href": "https://demo-wicket.isis.incode.work/restful/objects/demo.JavaLangStrings/PADw_eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiBzdGFuZGFsb25lPSJ5ZXMiPz4KPERlbW8vPgo=/actions/clearHints",
+          "href": "https://localhost:8080/restful/objects/demo.JavaLangStrings/PADw_eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiBzdGFuZGFsb25lPSJ5ZXMiPz4KPERlbW8vPgo=/actions/clearHints",
           "method": "GET",
           "type": "application/json;profile=\"urn:org.restfulobjects:repr-types/object-action\""
         }
@@ -109,7 +109,7 @@ object ACTIONS_STRING_INVOKE : Response() {
       "links": [
         {
           "rel": "urn:org.restfulobjects:rels/details;action=\"openRestApi\"",
-          "href": "https://demo-wicket.isis.incode.work/restful/objects/demo.JavaLangStrings/PADw_eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiBzdGFuZGFsb25lPSJ5ZXMiPz4KPERlbW8vPgo=/actions/openRestApi",
+          "href": "https://localhost:8080/restful/objects/demo.JavaLangStrings/PADw_eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiBzdGFuZGFsb25lPSJ5ZXMiPz4KPERlbW8vPgo=/actions/openRestApi",
           "method": "GET",
           "type": "application/json;profile=\"urn:org.restfulobjects:repr-types/object-action\""
         }
@@ -121,7 +121,7 @@ object ACTIONS_STRING_INVOKE : Response() {
       "links": [
         {
           "rel": "urn:org.restfulobjects:rels/details;action=\"downloadLayoutXml\"",
-          "href": "https://demo-wicket.isis.incode.work/restful/objects/demo.JavaLangStrings/PADw_eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiBzdGFuZGFsb25lPSJ5ZXMiPz4KPERlbW8vPgo=/actions/downloadLayoutXml",
+          "href": "https://localhost:8080/restful/objects/demo.JavaLangStrings/PADw_eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiBzdGFuZGFsb25lPSJ5ZXMiPz4KPERlbW8vPgo=/actions/downloadLayoutXml",
           "method": "GET",
           "type": "application/json;profile=\"urn:org.restfulobjects:repr-types/object-action\""
         }
@@ -133,7 +133,7 @@ object ACTIONS_STRING_INVOKE : Response() {
       "links": [
         {
           "rel": "urn:org.restfulobjects:rels/details;action=\"rebuildMetamodel\"",
-          "href": "https://demo-wicket.isis.incode.work/restful/objects/demo.JavaLangStrings/PADw_eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiBzdGFuZGFsb25lPSJ5ZXMiPz4KPERlbW8vPgo=/actions/rebuildMetamodel",
+          "href": "https://localhost:8080/restful/objects/demo.JavaLangStrings/PADw_eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiBzdGFuZGFsb25lPSJ5ZXMiPz4KPERlbW8vPgo=/actions/rebuildMetamodel",
           "method": "GET",
           "type": "application/json;profile=\"urn:org.restfulobjects:repr-types/object-action\""
         }
@@ -145,7 +145,7 @@ object ACTIONS_STRING_INVOKE : Response() {
       "links": [
         {
           "rel": "urn:org.restfulobjects:rels/details;action=\"recentCommands\"",
-          "href": "https://demo-wicket.isis.incode.work/restful/objects/demo.JavaLangStrings/PADw_eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiBzdGFuZGFsb25lPSJ5ZXMiPz4KPERlbW8vPgo=/actions/recentCommands",
+          "href": "https://localhost:8080/restful/objects/demo.JavaLangStrings/PADw_eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiBzdGFuZGFsb25lPSJ5ZXMiPz4KPERlbW8vPgo=/actions/recentCommands",
           "method": "GET",
           "type": "application/json;profile=\"urn:org.restfulobjects:repr-types/object-action\""
         }
@@ -157,7 +157,7 @@ object ACTIONS_STRING_INVOKE : Response() {
       "links": [
         {
           "rel": "urn:org.restfulobjects:rels/details;action=\"downloadMetamodelXml\"",
-          "href": "https://demo-wicket.isis.incode.work/restful/objects/demo.JavaLangStrings/PADw_eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiBzdGFuZGFsb25lPSJ5ZXMiPz4KPERlbW8vPgo=/actions/downloadMetamodelXml",
+          "href": "https://localhost:8080/restful/objects/demo.JavaLangStrings/PADw_eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiBzdGFuZGFsb25lPSJ5ZXMiPz4KPERlbW8vPgo=/actions/downloadMetamodelXml",
           "method": "GET",
           "type": "application/json;profile=\"urn:org.restfulobjects:repr-types/object-action\""
         }
@@ -169,7 +169,7 @@ object ACTIONS_STRING_INVOKE : Response() {
       "links": [
         {
           "rel": "urn:org.restfulobjects:rels/details;action=\"inspectMetamodel\"",
-          "href": "https://demo-wicket.isis.incode.work/restful/objects/demo.JavaLangStrings/PADw_eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiBzdGFuZGFsb25lPSJ5ZXMiPz4KPERlbW8vPgo=/actions/inspectMetamodel",
+          "href": "https://localhost:8080/restful/objects/demo.JavaLangStrings/PADw_eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiBzdGFuZGFsb25lPSJ5ZXMiPz4KPERlbW8vPgo=/actions/inspectMetamodel",
           "method": "GET",
           "type": "application/json;profile=\"urn:org.restfulobjects:repr-types/object-action\""
         }