You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2021/08/24 06:37:18 UTC

[isis] branch master updated: ISIS-2856: remove some RO deprecations

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

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git


The following commit(s) were added to refs/heads/master by this push:
     new 2346bfc  ISIS-2856: remove some RO deprecations
2346bfc is described below

commit 2346bfcc64ffd340cfd811c99e5bd0cccaaa959f
Author: Andi Huber <ah...@apache.org>
AuthorDate: Tue Aug 24 08:37:08 2021 +0200

    ISIS-2856: remove some RO deprecations
---
 .../restfulobjects/applib/RepresentationType.java  | 10 ++-------
 ..._ensureCompatibleAcceptHeader_ContractTest.java | 26 ++++++----------------
 2 files changed, 9 insertions(+), 27 deletions(-)

diff --git a/viewers/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationType.java b/viewers/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationType.java
index c0e9073..1bfd0b4 100644
--- a/viewers/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationType.java
+++ b/viewers/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationType.java
@@ -176,16 +176,10 @@ public enum RepresentationType {
         return name;
     }
 
-    /**
-     * @deprecated - use {@link #getJsonMediaType()} instead.
-     */
-    @Deprecated
-    public final MediaType getMediaType() {
-        return getJsonMediaType();
-    }
     public final MediaType getJsonMediaType() {
         return jsonMediaType;
     }
+
     public MediaType getXmlMediaType() {
         return xmlMediaType;
     }
@@ -195,7 +189,7 @@ public enum RepresentationType {
     }
 
     /**
-     * Clones the (immutable) {@link #getMediaType() media type}, adding in one additional
+     * Clones the (immutable) {@link #getJsonMediaType() media type}, adding in one additional
      * parameter value.
      */
     public MediaType getMediaType(final String parameter, final String paramValue) {
diff --git a/viewers/restfulobjects/testing/src/main/java/org/apache/isis/viewer/restfulobjects/testing/ResourceContext_ensureCompatibleAcceptHeader_ContractTest.java b/viewers/restfulobjects/testing/src/main/java/org/apache/isis/viewer/restfulobjects/testing/ResourceContext_ensureCompatibleAcceptHeader_ContractTest.java
index 33a89e8..3cb448f 100644
--- a/viewers/restfulobjects/testing/src/main/java/org/apache/isis/viewer/restfulobjects/testing/ResourceContext_ensureCompatibleAcceptHeader_ContractTest.java
+++ b/viewers/restfulobjects/testing/src/main/java/org/apache/isis/viewer/restfulobjects/testing/ResourceContext_ensureCompatibleAcceptHeader_ContractTest.java
@@ -19,7 +19,6 @@
 package org.apache.isis.viewer.restfulobjects.testing;
 
 import java.util.Arrays;
-import java.util.HashMap;
 import java.util.List;
 
 import javax.servlet.ServletContext;
@@ -39,9 +38,8 @@ import static org.hamcrest.MatcherAssert.assertThat;
 
 import org.apache.isis.applib.services.iactn.Interaction;
 import org.apache.isis.applib.services.iactnlayer.InteractionContext;
-import org.apache.isis.applib.services.iactnlayer.InteractionService;
-import org.apache.isis.commons.internal.collections._Maps;
 import org.apache.isis.applib.services.iactnlayer.InteractionLayerTracker;
+import org.apache.isis.applib.services.iactnlayer.InteractionService;
 import org.apache.isis.core.internaltestsupport.jmocking.JUnitRuleMockery2;
 import org.apache.isis.core.metamodel._testing.MetaModelContext_forTesting;
 import org.apache.isis.core.metamodel.context.MetaModelContext;
@@ -112,7 +110,7 @@ public abstract class ResourceContext_ensureCompatibleAcceptHeader_ContractTest
     @Test
     public void noop() throws Exception {
         final RepresentationType representationType = RepresentationType.HOME_PAGE;
-        givenHttpHeadersGetAcceptableMediaTypesReturns(Arrays.<MediaType> asList(representationType.getMediaType()));
+        givenHttpHeadersGetAcceptableMediaTypesReturns(List.of(representationType.getJsonMediaType()));
 
         instantiateResourceContext(representationType);
     }
@@ -120,7 +118,7 @@ public abstract class ResourceContext_ensureCompatibleAcceptHeader_ContractTest
     @Test
     public void happyCase() throws Exception {
         final RepresentationType representationType = RepresentationType.HOME_PAGE;
-        givenHttpHeadersGetAcceptableMediaTypesReturns(Arrays.<MediaType> asList(representationType.getMediaType()));
+        givenHttpHeadersGetAcceptableMediaTypesReturns(List.of(representationType.getJsonMediaType()));
 
         instantiateResourceContext(representationType);
     }
@@ -128,7 +126,7 @@ public abstract class ResourceContext_ensureCompatibleAcceptHeader_ContractTest
     @Test
     public void acceptGenericAndProduceGeneric() throws Exception {
         final RepresentationType representationType = RepresentationType.GENERIC;
-        givenHttpHeadersGetAcceptableMediaTypesReturns(Arrays.<MediaType> asList(MediaType.APPLICATION_JSON_TYPE));
+        givenHttpHeadersGetAcceptableMediaTypesReturns(List.of(MediaType.APPLICATION_JSON_TYPE));
 
         instantiateResourceContext(representationType);
     }
@@ -136,7 +134,7 @@ public abstract class ResourceContext_ensureCompatibleAcceptHeader_ContractTest
     @Test
     public void acceptGenericAndProduceSpecific() throws Exception {
         final RepresentationType representationType = RepresentationType.HOME_PAGE;
-        givenHttpHeadersGetAcceptableMediaTypesReturns(Arrays.<MediaType> asList(MediaType.APPLICATION_JSON_TYPE));
+        givenHttpHeadersGetAcceptableMediaTypesReturns(List.of(MediaType.APPLICATION_JSON_TYPE));
 
         instantiateResourceContext(representationType);
     }
@@ -156,7 +154,7 @@ public abstract class ResourceContext_ensureCompatibleAcceptHeader_ContractTest
     @Test
     public void nonMatchingProfile() throws Exception {
         final RepresentationType representationType = RepresentationType.HOME_PAGE;
-        givenHttpHeadersGetAcceptableMediaTypesReturns(Arrays.<MediaType> asList(RepresentationType.USER.getMediaType()));
+        givenHttpHeadersGetAcceptableMediaTypesReturns(List.of(RepresentationType.USER.getJsonMediaType()));
 
         try {
             instantiateResourceContext(representationType);
@@ -168,7 +166,7 @@ public abstract class ResourceContext_ensureCompatibleAcceptHeader_ContractTest
     @Test
     public void nonMatchingProfile_ignoreGeneric() throws Exception {
         final RepresentationType representationType = RepresentationType.HOME_PAGE;
-        givenHttpHeadersGetAcceptableMediaTypesReturns(Arrays.<MediaType> asList(RepresentationType.USER.getMediaType(), MediaType.APPLICATION_JSON_TYPE));
+        givenHttpHeadersGetAcceptableMediaTypesReturns(List.of(RepresentationType.USER.getJsonMediaType(), MediaType.APPLICATION_JSON_TYPE));
 
         try {
             instantiateResourceContext(representationType);
@@ -194,16 +192,6 @@ public abstract class ResourceContext_ensureCompatibleAcceptHeader_ContractTest
         });
     }
 
-    private void givenServletRequestParameterMapEmpty() {
-        final HashMap<Object, Object> parameterMap = _Maps.newHashMap();
-        context.checking(new Expectations() {
-            {
-                allowing(mockHttpServletRequest).getParameterMap();
-                will(returnValue(parameterMap));
-            }
-        });
-    }
-
     private ResourceContext instantiateResourceContext(
             final RepresentationType representationType) {