@Test public final void testGetResult() throws PolicyException { firewallPolicyService.getValidation(); String result = firewallPolicyService.getResult(false); assertEquals("success", result); }
public String getResult(boolean updateFlag) throws PolicyException { String response = null; String operation = null; if (updateFlag) { operation = "update"; } else { operation = "create"; } if (!firewallJson.containsKey("configName")) { message = XACMLErrorConstants.ERROR_DATA_ISSUE + "No configName given in firwall JSON."; LOGGER.error(message); return message; } String configName = firewallJson.get("configName").toString(); String configDescription = ""; String json = firewallJson.toString(); StdPAPPolicy newPAPPolicy = new StdPAPPolicy(StdPAPPolicyParams.builder() .configPolicyType("Firewall Config") .policyName(policyName) .description(configDescription) .configName(configName) .editPolicy(updateFlag) .domain(policyScope) .jsonBody(json) .highestVersion(0) .riskLevel(policyParameters.getRiskLevel()) .riskType(policyParameters.getRiskType()) .guard(String.valueOf(policyParameters.getGuard())) .ttlDate(date) .build()); response = (String) papServices.callPAP(newPAPPolicy, new String[]{"operation=" + operation, "apiflag=api", "policyType=Config"}, policyParameters.getRequestID(), "ConfigFirewall"); LOGGER.info(response); return response; }
FirewallPolicyService { public String getResult(boolean updateFlag) throws PolicyException { String response = null; String operation = null; if (updateFlag) { operation = "update"; } else { operation = "create"; } if (!firewallJson.containsKey("configName")) { message = XACMLErrorConstants.ERROR_DATA_ISSUE + "No configName given in firwall JSON."; LOGGER.error(message); return message; } String configName = firewallJson.get("configName").toString(); String configDescription = ""; String json = firewallJson.toString(); StdPAPPolicy newPAPPolicy = new StdPAPPolicy(StdPAPPolicyParams.builder() .configPolicyType("Firewall Config") .policyName(policyName) .description(configDescription) .configName(configName) .editPolicy(updateFlag) .domain(policyScope) .jsonBody(json) .highestVersion(0) .riskLevel(policyParameters.getRiskLevel()) .riskType(policyParameters.getRiskType()) .guard(String.valueOf(policyParameters.getGuard())) .ttlDate(date) .build()); response = (String) papServices.callPAP(newPAPPolicy, new String[]{"operation=" + operation, "apiflag=api", "policyType=Config"}, policyParameters.getRequestID(), "ConfigFirewall"); LOGGER.info(response); return response; } }
FirewallPolicyService { public String getResult(boolean updateFlag) throws PolicyException { String response = null; String operation = null; if (updateFlag) { operation = "update"; } else { operation = "create"; } if (!firewallJson.containsKey("configName")) { message = XACMLErrorConstants.ERROR_DATA_ISSUE + "No configName given in firwall JSON."; LOGGER.error(message); return message; } String configName = firewallJson.get("configName").toString(); String configDescription = ""; String json = firewallJson.toString(); StdPAPPolicy newPAPPolicy = new StdPAPPolicy(StdPAPPolicyParams.builder() .configPolicyType("Firewall Config") .policyName(policyName) .description(configDescription) .configName(configName) .editPolicy(updateFlag) .domain(policyScope) .jsonBody(json) .highestVersion(0) .riskLevel(policyParameters.getRiskLevel()) .riskType(policyParameters.getRiskType()) .guard(String.valueOf(policyParameters.getGuard())) .ttlDate(date) .build()); response = (String) papServices.callPAP(newPAPPolicy, new String[]{"operation=" + operation, "apiflag=api", "policyType=Config"}, policyParameters.getRequestID(), "ConfigFirewall"); LOGGER.info(response); return response; } FirewallPolicyService(String policyName, String policyScope,
                                 PolicyParameters policyParameters, String date); }
FirewallPolicyService { public String getResult(boolean updateFlag) throws PolicyException { String response = null; String operation = null; if (updateFlag) { operation = "update"; } else { operation = "create"; } if (!firewallJson.containsKey("configName")) { message = XACMLErrorConstants.ERROR_DATA_ISSUE + "No configName given in firwall JSON."; LOGGER.error(message); return message; } String configName = firewallJson.get("configName").toString(); String configDescription = ""; String json = firewallJson.toString(); StdPAPPolicy newPAPPolicy = new StdPAPPolicy(StdPAPPolicyParams.builder() .configPolicyType("Firewall Config") .policyName(policyName) .description(configDescription) .configName(configName) .editPolicy(updateFlag) .domain(policyScope) .jsonBody(json) .highestVersion(0) .riskLevel(policyParameters.getRiskLevel()) .riskType(policyParameters.getRiskType()) .guard(String.valueOf(policyParameters.getGuard())) .ttlDate(date) .build()); response = (String) papServices.callPAP(newPAPPolicy, new String[]{"operation=" + operation, "apiflag=api", "policyType=Config"}, policyParameters.getRequestID(), "ConfigFirewall"); LOGGER.info(response); return response; } FirewallPolicyService(String policyName, String policyScope,
                                 PolicyParameters policyParameters, String date); Boolean getValidation(); String getMessage(); String getResult(boolean updateFlag); }
FirewallPolicyService { public String getResult(boolean updateFlag) throws PolicyException { String response = null; String operation = null; if (updateFlag) { operation = "update"; } else { operation = "create"; } if (!firewallJson.containsKey("configName")) { message = XACMLErrorConstants.ERROR_DATA_ISSUE + "No configName given in firwall JSON."; LOGGER.error(message); return message; } String configName = firewallJson.get("configName").toString(); String configDescription = ""; String json = firewallJson.toString(); StdPAPPolicy newPAPPolicy = new StdPAPPolicy(StdPAPPolicyParams.builder() .configPolicyType("Firewall Config") .policyName(policyName) .description(configDescription) .configName(configName) .editPolicy(updateFlag) .domain(policyScope) .jsonBody(json) .highestVersion(0) .riskLevel(policyParameters.getRiskLevel()) .riskType(policyParameters.getRiskType()) .guard(String.valueOf(policyParameters.getGuard())) .ttlDate(date) .build()); response = (String) papServices.callPAP(newPAPPolicy, new String[]{"operation=" + operation, "apiflag=api", "policyType=Config"}, policyParameters.getRequestID(), "ConfigFirewall"); LOGGER.info(response); return response; } FirewallPolicyService(String policyName, String policyScope,
                                 PolicyParameters policyParameters, String date); Boolean getValidation(); String getMessage(); String getResult(boolean updateFlag);  }