From 36dc881e3511787d1211bc60c433f4c29ac89648 Mon Sep 17 00:00:00 2001 From: dc443y Date: Wed, 6 Jul 2022 14:25:55 -0500 Subject: Fix Raw XACML Decision API Serialization Issue-ID: POLICY-4274 Signed-off-by: dc443y Change-Id: I0d367d35e7ec52c7587ec75194b654cc41303868 --- .../pdpx/main/rest/serialization/XacmlJsonMessageBodyHandler.java | 4 ++-- .../pdpx/main/rest/serialization/XacmlXmlMessageBodyHandler.java | 4 ++-- .../test/java/org/onap/policy/pdpx/main/rest/TestDecision.java | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlJsonMessageBodyHandler.java b/main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlJsonMessageBodyHandler.java index 9b59a003..907e0f1a 100644 --- a/main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlJsonMessageBodyHandler.java +++ b/main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlJsonMessageBodyHandler.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2020-2022 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -98,6 +98,6 @@ public class XacmlJsonMessageBodyHandler implements MessageBodyReader, return false; } return ("xacml+json".equals(mediaType.getSubtype())) - && (type == Request.class || type == Response.class); + && (Request.class.isAssignableFrom(type) || Response.class.isAssignableFrom(type)); } } \ No newline at end of file diff --git a/main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlXmlMessageBodyHandler.java b/main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlXmlMessageBodyHandler.java index ddd77528..7c1af4b4 100644 --- a/main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlXmlMessageBodyHandler.java +++ b/main/src/main/java/org/onap/policy/pdpx/main/rest/serialization/XacmlXmlMessageBodyHandler.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2020-2022 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -98,6 +98,6 @@ public class XacmlXmlMessageBodyHandler implements MessageBodyReader, M } return ("xacml+xml".equals(mediaType.getSubtype())) - && (type == Request.class || type == Response.class); + && (Request.class.isAssignableFrom(type) || Response.class.isAssignableFrom(type)); } } \ No newline at end of file diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestDecision.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestDecision.java index 2d71543c..f7f3e8a5 100644 --- a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestDecision.java +++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestDecision.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019-2022 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -197,11 +197,11 @@ public class TestDecision { String responseFromXmlRequest = getNativeDecision(xmlRequestAsString, APPLICATION_XACML_XML); LOGGER.info("Response from xml request {}", responseFromXmlRequest); - assertThat(responseFromXmlRequest).contains("NOTAPPLICABLE"); + assertThat(responseFromXmlRequest).contains(" entityRequest = Entity.entity(request, mediaType); - Response response = client.post("/xacml", entityRequest, Collections.emptyMap()); + Response response = client.post("/xacml", entityRequest, Map.of("Accept", mediaType)); assertEquals(200, response.getStatus()); -- cgit 1.2.3-korg