@Test public final void testGetValidation() { assertTrue(service.getValidation()); }
public Boolean getValidation() { if (policyParameters.getConfigBody() == null) { message = XACMLErrorConstants.ERROR_DATA_ISSUE + " No Micro Service or Attributes Config Body Present"; return false; } try { microServiceAttributes = PolicyApiUtils.stringToJsonObject(policyParameters.getConfigBody()); } catch (JsonException | IllegalStateException e) { message = XACMLErrorConstants.ERROR_DATA_ISSUE + " improper JSON object : " + policyParameters.getConfigBody(); LOGGER.error("Error while parsing JSON body for MicroService Policy creation. ", e); return false; } onapName = policyParameters.getOnapName(); if (onapName == null || onapName.trim().isEmpty()) { message = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Onap Name given."; return false; } boolean levelCheck = false; levelCheck = PolicyApiUtils.isNumeric(policyParameters.getRiskLevel()); if (!levelCheck) { message = XACMLErrorConstants.ERROR_DATA_ISSUE + "Incorrect Risk Level given."; return false; } return true; }
MicroServicesPolicyService { public Boolean getValidation() { if (policyParameters.getConfigBody() == null) { message = XACMLErrorConstants.ERROR_DATA_ISSUE + " No Micro Service or Attributes Config Body Present"; return false; } try { microServiceAttributes = PolicyApiUtils.stringToJsonObject(policyParameters.getConfigBody()); } catch (JsonException | IllegalStateException e) { message = XACMLErrorConstants.ERROR_DATA_ISSUE + " improper JSON object : " + policyParameters.getConfigBody(); LOGGER.error("Error while parsing JSON body for MicroService Policy creation. ", e); return false; } onapName = policyParameters.getOnapName(); if (onapName == null || onapName.trim().isEmpty()) { message = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Onap Name given."; return false; } boolean levelCheck = false; levelCheck = PolicyApiUtils.isNumeric(policyParameters.getRiskLevel()); if (!levelCheck) { message = XACMLErrorConstants.ERROR_DATA_ISSUE + "Incorrect Risk Level given."; return false; } return true; } }
MicroServicesPolicyService { public Boolean getValidation() { if (policyParameters.getConfigBody() == null) { message = XACMLErrorConstants.ERROR_DATA_ISSUE + " No Micro Service or Attributes Config Body Present"; return false; } try { microServiceAttributes = PolicyApiUtils.stringToJsonObject(policyParameters.getConfigBody()); } catch (JsonException | IllegalStateException e) { message = XACMLErrorConstants.ERROR_DATA_ISSUE + " improper JSON object : " + policyParameters.getConfigBody(); LOGGER.error("Error while parsing JSON body for MicroService Policy creation. ", e); return false; } onapName = policyParameters.getOnapName(); if (onapName == null || onapName.trim().isEmpty()) { message = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Onap Name given."; return false; } boolean levelCheck = false; levelCheck = PolicyApiUtils.isNumeric(policyParameters.getRiskLevel()); if (!levelCheck) { message = XACMLErrorConstants.ERROR_DATA_ISSUE + "Incorrect Risk Level given."; return false; } return true; } MicroServicesPolicyService(String policyName, String policyScope, PolicyParameters policyParameters,
                                      String date); }
MicroServicesPolicyService { public Boolean getValidation() { if (policyParameters.getConfigBody() == null) { message = XACMLErrorConstants.ERROR_DATA_ISSUE + " No Micro Service or Attributes Config Body Present"; return false; } try { microServiceAttributes = PolicyApiUtils.stringToJsonObject(policyParameters.getConfigBody()); } catch (JsonException | IllegalStateException e) { message = XACMLErrorConstants.ERROR_DATA_ISSUE + " improper JSON object : " + policyParameters.getConfigBody(); LOGGER.error("Error while parsing JSON body for MicroService Policy creation. ", e); return false; } onapName = policyParameters.getOnapName(); if (onapName == null || onapName.trim().isEmpty()) { message = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Onap Name given."; return false; } boolean levelCheck = false; levelCheck = PolicyApiUtils.isNumeric(policyParameters.getRiskLevel()); if (!levelCheck) { message = XACMLErrorConstants.ERROR_DATA_ISSUE + "Incorrect Risk Level given."; return false; } return true; } MicroServicesPolicyService(String policyName, String policyScope, PolicyParameters policyParameters,
                                      String date); Boolean getValidation(); String getMessage(); String getResult(boolean updateFlag); }
MicroServicesPolicyService { public Boolean getValidation() { if (policyParameters.getConfigBody() == null) { message = XACMLErrorConstants.ERROR_DATA_ISSUE + " No Micro Service or Attributes Config Body Present"; return false; } try { microServiceAttributes = PolicyApiUtils.stringToJsonObject(policyParameters.getConfigBody()); } catch (JsonException | IllegalStateException e) { message = XACMLErrorConstants.ERROR_DATA_ISSUE + " improper JSON object : " + policyParameters.getConfigBody(); LOGGER.error("Error while parsing JSON body for MicroService Policy creation. ", e); return false; } onapName = policyParameters.getOnapName(); if (onapName == null || onapName.trim().isEmpty()) { message = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Onap Name given."; return false; } boolean levelCheck = false; levelCheck = PolicyApiUtils.isNumeric(policyParameters.getRiskLevel()); if (!levelCheck) { message = XACMLErrorConstants.ERROR_DATA_ISSUE + "Incorrect Risk Level given."; return false; } return true; } MicroServicesPolicyService(String policyName, String policyScope, PolicyParameters policyParameters,
                                      String date); Boolean getValidation(); String getMessage(); String getResult(boolean updateFlag);  }