private void setIndication() { XmlConclusion conclusion = result.getConclusion(); if (conclusion != null) { if (Utils.isCollectionNotEmpty(conclusion.getErrors())) { conclusion.setIndication(Indication.FAILED); } else if (Utils.isCollectionNotEmpty(conclusion.getWarnings())) { conclusion.setIndication(Indication.INDETERMINATE); } else { conclusion.setIndication(Indication.PASSED); } } }
private void setIndication() { XmlConclusion conclusion = result.getConclusion(); if (conclusion != null) { if (Utils.isCollectionNotEmpty(conclusion.getErrors())) { conclusion.setIndication(Indication.FAILED); } else if (Utils.isCollectionNotEmpty(conclusion.getWarnings())) { conclusion.setIndication(Indication.INDETERMINATE); } else { conclusion.setIndication(Indication.PASSED); } } }
private void recordCustomSuccessConclusion() { XmlConclusion conclusion = new XmlConclusion(); conclusion.setIndication(getSuccessIndication()); conclusion.setSubIndication(getSuccessSubIndication()); result.setConclusion(conclusion); }
private void recordConclusion() { XmlConclusion conclusion = new XmlConclusion(); conclusion.setIndication(getFailedIndicationForConclusion()); conclusion.setSubIndication(getFailedSubIndicationForConclusion()); List<XmlName> previousErrors = getPreviousErrors(); if (Utils.isCollectionNotEmpty(previousErrors)) { conclusion.getErrors().addAll(previousErrors); } else { conclusion.getErrors().add(buildXmlName(getErrorMessageTag())); } result.setConclusion(conclusion); }
/** * This method allows to initialize and execute the complete chain until the first failure. * * @return the complete result with constraints and final conclusion for the chain */ public T execute() { initChain(); if (firstItem != null) { firstItem.execute(); } if (result.getConclusion() == null) { XmlConclusion conclusion = new XmlConclusion(); conclusion.setIndication(Indication.PASSED); result.setConclusion(conclusion); } addAdditionalInfo(); return result; }
private void updateFinalConclusion(XmlBasicBuildingBlocks result, XmlConstraintsConclusion constraintsAndConclusion) { XmlConclusion finalConclusion = result.getConclusion(); XmlConclusion currentConclusion = constraintsAndConclusion.getConclusion(); List<XmlConstraint> constraints = constraintsAndConclusion.getConstraint(); if (!Indication.PASSED.equals(currentConclusion.getIndication())) { finalConclusion.setIndication(currentConclusion.getIndication()); finalConclusion.setSubIndication(currentConclusion.getSubIndication()); finalConclusion.getErrors().addAll(currentConclusion.getErrors()); } if (Utils.isCollectionNotEmpty(constraints)) { for (XmlConstraint constraint : constraints) { XmlName info = constraint.getInfo(); if (info != null) { finalConclusion.getInfos().add(info); } XmlName warning = constraint.getWarning(); if (warning != null) { finalConclusion.getWarnings().add(warning); } } } }
@Test public void revocationFreshnessCheckerResult() throws Exception { LevelConstraint constraint = new LevelConstraint(); constraint.setLevel(Level.FAIL); XmlConclusion xc = new XmlConclusion(); xc.setIndication(Indication.PASSED); XmlRFC resultRFC = new XmlRFC(); resultRFC.setConclusion(xc); XmlSubXCV result = new XmlSubXCV(); RevocationFreshnessCheckerResult rfc = new RevocationFreshnessCheckerResult(result, resultRFC, constraint); rfc.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.OK, constraints.get(0).getStatus()); }
@Test public void failedRevocationFreshnessCheckerResult() throws Exception { LevelConstraint constraint = new LevelConstraint(); constraint.setLevel(Level.FAIL); XmlConclusion xc = new XmlConclusion(); xc.setIndication(Indication.FAILED); XmlRFC resultRFC = new XmlRFC(); resultRFC.setConclusion(xc); XmlSubXCV result = new XmlSubXCV(); RevocationFreshnessCheckerResult rfc = new RevocationFreshnessCheckerResult(result, resultRFC, constraint); rfc.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.NOT_OK, constraints.get(0).getStatus()); }
result.getConclusion().setIndication(Indication.PASSED);