@Override protected void verifySimpleReport(SimpleReport simpleReport) { super.verifySimpleReport(simpleReport); Indication indication = simpleReport.getIndication(simpleReport.getFirstSignatureId()); assertEquals(Indication.INDETERMINATE, indication); SubIndication subIndication = simpleReport.getSubIndication(simpleReport.getFirstSignatureId()); assertEquals(SubIndication.NO_CERTIFICATE_CHAIN_FOUND, subIndication); }
@Test public void passedRevokedWithTimestamp() throws Exception { FileInputStream fis = new FileInputStream("src/test/resources/passed_revoked_with_timestamp.xml"); DiagnosticData diagnosticData = getJAXBObjectFromString(fis, DiagnosticData.class); assertNotNull(diagnosticData); CustomProcessExecutor executor = new CustomProcessExecutor(); executor.setDiagnosticData(diagnosticData); executor.setValidationPolicy(loadPolicy()); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); Date currentTime = sdf.parse("04/05/2016 15:15:00"); executor.setCurrentTime(currentTime); Reports reports = executor.execute(); assertNotNull(reports); SimpleReport simpleReport = reports.getSimpleReport(); assertEquals( Indication.TOTAL_PASSED, simpleReport.getIndication(simpleReport.getFirstSignatureId())); DetailedReport detailedReport = reports.getDetailedReport(); assertEquals( Indication.INDETERMINATE, detailedReport.getBasicValidationIndication(simpleReport.getFirstSignatureId())); assertEquals( SubIndication.REVOKED_NO_POE, detailedReport.getBasicValidationSubIndication(simpleReport.getFirstSignatureId())); List<String> timestampIds = detailedReport.getTimestampIds(); assertEquals(1, timestampIds.size()); assertEquals( Indication.PASSED, detailedReport.getTimestampValidationIndication(timestampIds.get(0))); assertEquals( Indication.PASSED, detailedReport.getLongTermValidationIndication(simpleReport.getFirstSignatureId())); assertEquals( Indication.PASSED, detailedReport.getArchiveDataValidationIndication(simpleReport.getFirstSignatureId())); }
@Test public void signingCertificateNotFound() throws Exception { FileInputStream fis = new FileInputStream("src/test/resources/signing_certificate_not_found.xml"); DiagnosticData diagnosticData = getJAXBObjectFromString(fis, DiagnosticData.class); assertNotNull(diagnosticData); CustomProcessExecutor executor = new CustomProcessExecutor(); executor.setDiagnosticData(diagnosticData); executor.setValidationPolicy(loadPolicy()); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); Date currentTime = sdf.parse("04/05/2016 15:55:00"); executor.setCurrentTime(currentTime); Reports reports = executor.execute(); assertNotNull(reports); SimpleReport simpleReport = reports.getSimpleReport(); assertEquals( Indication.INDETERMINATE, simpleReport.getIndication(simpleReport.getFirstSignatureId())); assertEquals( SubIndication.NO_SIGNING_CERTIFICATE_FOUND, simpleReport.getSubIndication(simpleReport.getFirstSignatureId())); DetailedReport detailedReport = reports.getDetailedReport(); assertEquals( Indication.INDETERMINATE, detailedReport.getBasicValidationIndication(simpleReport.getFirstSignatureId())); assertEquals( SubIndication.NO_SIGNING_CERTIFICATE_FOUND, detailedReport.getBasicValidationSubIndication(simpleReport.getFirstSignatureId())); assertEquals(0, detailedReport.getTimestampIds().size()); assertEquals( Indication.INDETERMINATE, detailedReport.getLongTermValidationIndication(simpleReport.getFirstSignatureId())); assertEquals( SubIndication.NO_SIGNING_CERTIFICATE_FOUND, detailedReport.getLongTermValidationSubIndication(simpleReport.getFirstSignatureId())); assertEquals( Indication.INDETERMINATE, detailedReport.getArchiveDataValidationIndication(simpleReport.getFirstSignatureId())); assertEquals( SubIndication.NO_SIGNING_CERTIFICATE_FOUND, detailedReport.getArchiveDataValidationSubIndication(simpleReport.getFirstSignatureId())); }
@Test public void sigConstraintFailure() throws Exception { FileInputStream fis = new FileInputStream("src/test/resources/sig_constraint_failure.xml"); DiagnosticData diagnosticData = getJAXBObjectFromString(fis, DiagnosticData.class); assertNotNull(diagnosticData); CustomProcessExecutor executor = new CustomProcessExecutor(); executor.setDiagnosticData(diagnosticData); executor.setValidationPolicy(loadPolicy()); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); Date currentTime = sdf.parse("04/05/2016 15:55:00"); executor.setCurrentTime(currentTime); Reports reports = executor.execute(); assertNotNull(reports); SimpleReport simpleReport = reports.getSimpleReport(); assertEquals( Indication.TOTAL_FAILED, simpleReport.getIndication(simpleReport.getFirstSignatureId())); assertEquals( SubIndication.SIG_CONSTRAINTS_FAILURE, simpleReport.getSubIndication(simpleReport.getFirstSignatureId())); DetailedReport detailedReport = reports.getDetailedReport(); assertEquals( Indication.FAILED, detailedReport.getBasicValidationIndication(simpleReport.getFirstSignatureId())); assertEquals( SubIndication.SIG_CONSTRAINTS_FAILURE, detailedReport.getBasicValidationSubIndication(simpleReport.getFirstSignatureId())); assertEquals(0, detailedReport.getTimestampIds().size()); assertEquals( Indication.FAILED, detailedReport.getLongTermValidationIndication(simpleReport.getFirstSignatureId())); assertEquals( SubIndication.SIG_CONSTRAINTS_FAILURE, detailedReport.getLongTermValidationSubIndication(simpleReport.getFirstSignatureId())); assertEquals( Indication.FAILED, detailedReport.getArchiveDataValidationIndication(simpleReport.getFirstSignatureId())); assertEquals( SubIndication.SIG_CONSTRAINTS_FAILURE, detailedReport.getArchiveDataValidationSubIndication(simpleReport.getFirstSignatureId())); }