+ public Collection<String> listPolicyImpl(final ConfigNameRequest listPolicyRequestParameters)
+ throws PolicyConfigException {
+ final Collection<String> policyList = new ArrayList<>();
+ if (junit) {
+ policyList.add(TEST_POLICY_NAME);
+ return policyList;
+ }
+ String body = null;
+ // Create Request.
+ try {
+ body = PolicyUtils.objectToJsonString(listPolicyRequestParameters);
+ } catch (final JsonProcessingException e) {
+ LOGGER.error(XACMLErrorConstants.ERROR_SCHEMA_INVALID, e);
+ throw new PolicyConfigException(XACMLErrorConstants.ERROR_SCHEMA_INVALID, e);
+ }
+ // Get Response.
+ try {
+ final ResponseEntity<String[]> result =
+ callNewPDP(LIST_POLICY_RESOURCE_NAME, HttpMethod.POST, body, String[].class);
+ for (final String policy : result.getBody()) {
+ policyList.add(policy);
+ }
+ } catch (final Exception exception) {
+ final String defaulMessage = XACMLErrorConstants.ERROR_PROCESS_FLOW + ERROR_INVALID_PDPS + pdps;
+ final String message = getErrorMessage(exception, defaulMessage, LIST_POLICY_RESOURCE_NAME);
+ LOGGER.error(message, exception);
+ throw new PolicyConfigException(message, exception);
+ }
+
+ return policyList;
+ }
+