/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2020-2021 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.
return false;
}
return ("xacml+json".equals(mediaType.getSubtype()))
- && (type == Request.class || type == Response.class);
+ && (Request.class.isAssignableFrom(type) || Response.class.isAssignableFrom(type));
}
}
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2020-2021 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.
}
return ("xacml+xml".equals(mediaType.getSubtype()))
- && (type == Request.class || type == Response.class);
+ && (Request.class.isAssignableFrom(type) || Response.class.isAssignableFrom(type));
}
}
/*-
* ============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");
String responseFromXmlRequest = getNativeDecision(xmlRequestAsString, APPLICATION_XACML_XML);
LOGGER.info("Response from xml request {}", responseFromXmlRequest);
- assertThat(responseFromXmlRequest).contains("NOTAPPLICABLE");
+ assertThat(responseFromXmlRequest).contains("<Response xmlns=").contains("NotApplicable");
String responseFromJsonRequest = getNativeDecision(jsonRequestAsString, APPLICATION_XACML_JSON);
LOGGER.info("Response from json request {}", responseFromJsonRequest);
- assertThat(responseFromJsonRequest).contains("NOTAPPLICABLE");
+ assertThat(responseFromJsonRequest).contains("\"Response\":").contains("NotApplicable");
}
private static Main startXacmlPdpService(File params) throws PolicyXacmlPdpException {
private String getNativeDecision(String request, String mediaType) {
Entity<String> 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());