ReportBuilderUtils { public static void processSignatureIndications(ValidationConclusion validationConclusion, String policyName) { if (QES_POLICY.equals(policyName)) { for (SignatureValidationData signature : validationConclusion.getSignatures()) { if (SignatureValidationData.Indication.TOTAL_PASSED.toString().equals(signature.getIndication())) { String signatureLevel = signature.getSignatureLevel(); if (SignatureQualification.ADESEAL_QC.name().equals(signatureLevel) || SignatureQualification.QES.name().equals(signatureLevel) || SignatureQualification.QESIG.name().equals(signatureLevel) || SignatureQualification.QESEAL.name().equals(signatureLevel)) { continue; } else if (SignatureQualification.ADESIG_QC.name().equals(signatureLevel)) { signature.getWarnings().add(getSignatureLevelWarning()); continue; } signature.setIndication(SignatureValidationData.Indication.TOTAL_FAILED); signature.getErrors().add(getSignatureLevelNotAcceptedError()); validationConclusion.setValidSignaturesCount(validationConclusion.getValidSignaturesCount() - 1); } } } }  static String emptyWhenNull(String value); static String valueNotPresent(); static String valueNotKnown(); static SimpleDateFormat getDateFormatterWithGMTZone(); static Policy createReportPolicy(ValidationPolicy validationPolicy); static ValidatedDocument createValidatedDocument(boolean reportSignatureEnabled, String filename, byte[] document); static void processSignatureIndications(ValidationConclusion validationConclusion, String policyName); static String getValidationTime(); static final String FORMAT_NOT_FOUND; }
@Test public void indicationNotChangingQesSignatureLevel() { ValidationConclusion validationConclusion = getDefaultValidationConclusion(SignatureQualification.QES); ReportBuilderUtils.processSignatureIndications(validationConclusion, QES_POLICY); assertTotalPassed(validationConclusion); }
@Test public void indicationNotChangingQesigSignatureLevel() { ValidationConclusion validationConclusion = getDefaultValidationConclusion(SignatureQualification.QESIG); ReportBuilderUtils.processSignatureIndications(validationConclusion, QES_POLICY); assertTotalPassed(validationConclusion); }
@Test public void indicationNotChangingQesealSignatureLevel() { ValidationConclusion validationConclusion = getDefaultValidationConclusion(SignatureQualification.QESEAL); ReportBuilderUtils.processSignatureIndications(validationConclusion, QES_POLICY); assertTotalPassed(validationConclusion); }
@Test public void indicationNotChangingAdesealQsSignatureLevel() { ValidationConclusion validationConclusion = getDefaultValidationConclusion(SignatureQualification.ADESEAL_QC); ReportBuilderUtils.processSignatureIndications(validationConclusion, QES_POLICY); assertTotalPassed(validationConclusion); }
@Test public void indicationToTotalFailedAdesQsSignatureLevel() { ValidationConclusion validationConclusion = getDefaultValidationConclusion(SignatureQualification.ADES_QC); ReportBuilderUtils.processSignatureIndications(validationConclusion, QES_POLICY); assertTotalFailed(validationConclusion); }
@Test public void indicationToTotalFailedAdesSignatureLevel() { ValidationConclusion validationConclusion = getDefaultValidationConclusion(SignatureQualification.ADES); ReportBuilderUtils.processSignatureIndications(validationConclusion, QES_POLICY); assertTotalFailed(validationConclusion); }
@Test public void indicationToPassedWithWarningFailedAdesigQsSignatureLevel() { ValidationConclusion validationConclusion = getDefaultValidationConclusion(SignatureQualification.ADESIG_QC); ReportBuilderUtils.processSignatureIndications(validationConclusion, QES_POLICY); Assert.assertEquals("TOTAL-PASSED", validationConclusion.getSignatures().get(0).getIndication()); Assert.assertEquals(1, validationConclusion.getSignatures().get(0).getWarnings().size()); Assert.assertTrue(validationConclusion.getSignatures().get(0).getErrors().isEmpty()); Assert.assertEquals("The signature is not in the Qualified Electronic Signature level", validationConclusion.getSignatures().get(0).getWarnings().get(0).getContent()); }