DecisionPolicyService { public String getResult(boolean updateFlag) throws PolicyException { String response = null; String operation = null; if (updateFlag) { operation = "update"; } else { operation = "create"; } RuleProvider ruleProvider = policyParameters.getRuleProvider(); if (ruleProvider == null) { ruleProvider = RuleProvider.CUSTOM; } Map<String, String> matchingAttributes = null; Map<String, String> settingsAttributes = null; if (policyParameters.getAttributes() != null && policyParameters.getAttributes().containsKey(AttributeType.MATCHING) && policyParameters.getAttributes().containsKey(AttributeType.SETTINGS)) { matchingAttributes = policyParameters.getAttributes().get(AttributeType.MATCHING); settingsAttributes = policyParameters.getAttributes().get(AttributeType.SETTINGS); } else if (policyParameters.getAttributes() != null && !policyParameters.getAttributes().containsKey(AttributeType.MATCHING) && policyParameters.getAttributes().containsKey(AttributeType.SETTINGS)) { settingsAttributes = policyParameters.getAttributes().get(AttributeType.SETTINGS); } else if (policyParameters.getAttributes() != null && policyParameters.getAttributes().containsKey(AttributeType.MATCHING) && !policyParameters.getAttributes().containsKey(AttributeType.SETTINGS)) { matchingAttributes = policyParameters.getAttributes().get(AttributeType.MATCHING); } StdPAPPolicy newPAPPolicy = new StdPAPPolicy(StdPAPPolicyParams.builder() .policyName(policyName) .description(policyParameters.getPolicyDescription()) .onapName(onapName) .providerComboBox(ruleProvider.toString()) .dynamicFieldConfigAttributes(matchingAttributes) .dynamicSettingsMap(settingsAttributes) .treatments(policyParameters.getTreatments()) .dynamicRuleAlgorithmLabels(policyParameters.getDynamicRuleAlgorithmLabels()) .dynamicRuleAlgorithmCombo(policyParameters.getDynamicRuleAlgorithmFunctions()) .dynamicRuleAlgorithmField1(policyParameters.getDynamicRuleAlgorithmField1()) .dynamicRuleAlgorithmField2(policyParameters.getDynamicRuleAlgorithmField2()) .editPolicy(updateFlag) .domain(policyScope) .highestVersion(0) .rawXacmlPolicy(policyParameters.getRawXacmlPolicy()) .build()); response = (String) papServices.callPAP(newPAPPolicy, new String[]{"operation=" + operation, "apiflag=api", "policyType=Decision"}, policyParameters.getRequestID(), "Decision"); LOGGER.info(message); return response; } DecisionPolicyService(String policyScope, String policyName,
                                 PolicyParameters policyParameters); Boolean getValidation(); String getMessage(); String getResult(boolean updateFlag);  }
@Test public final void testGetResult() throws PolicyException { service.getValidation(); String result = service.getResult(false); assertEquals("success", result); }