@Test public void should_report_proper_error_when_repository_is_available_but_manifest_is_invalid() { KeyPair childKeyPair = KEY_PAIR_FACTORY.generate(); final ValidityPeriod mftValidityPeriod = new ValidityPeriod( Instant.now().minus(Duration.standardDays(2)), Instant.now().minus(Duration.standardDays(1)) ); TrustAnchor ta = wtx(tx -> { TrustAnchor ta1 = factory.createTrustAnchor(tx, x -> { CertificateAuthority child = CertificateAuthority.builder() .dn("CN=child-ca") .keyPair(childKeyPair) .certificateLocation("rsync: .resources(IpResourceSet.parse("192.168.128.0/17")) .notifyURI(TA_RRDP_NOTIFY_URI) .manifestURI("rsync: .repositoryURI("rsync: .crlDistributionPoint("rsync: .build(); x.children(Collections.singletonList(child)); }, mftValidityPeriod); this.getTrustAnchors().add(tx, ta1); return ta1; }); RpkiRepository repository = wtx(tx -> { final Ref<TrustAnchor> trustAnchorRef = this.getTrustAnchors().makeRef(tx, ta.key()); RpkiRepository r = this.getRpkiRepositories().register(tx, trustAnchorRef, TA_RRDP_NOTIFY_URI, RpkiRepository.Type.RRDP); r.setFailed(); this.getRpkiRepositories().update(tx, r); return r; }); subject.validate(ta.key().asLong()); rtx0(tx -> { List<CertificateTreeValidationRun> completed = this.getValidationRuns().findAll(tx, CertificateTreeValidationRun.class); assertThat(completed).hasSize(1); final List<ValidationCheck> checks = completed.get(0).getValidationChecks(); assertThat(checks.get(0).getKey()).isEqualTo(ValidationString.VALIDATOR_OLD_LOCAL_MANIFEST_REPOSITORY_FAILED); assertThat(checks.get(0).getParameters()).isEqualTo(Collections.singletonList(repository.getRrdpNotifyUri())); }); }
public void validate(long trustAnchorId) { Optional<TrustAnchor> maybeTrustAnchor = storage.readTx(tx -> trustAnchors.get(tx, Key.of(trustAnchorId))); if (maybeTrustAnchor.isPresent()) { final TrustAnchor trustAnchor = maybeTrustAnchor.get(); Bench.mark0("validateTa " + trustAnchor.getName(), () -> validateTa(trustAnchor)); } else { log.error("Couldn't find trust anchor {}", trustAnchorId); } }
CertificateTreeValidationService { public void validate(long trustAnchorId) { Optional<TrustAnchor> maybeTrustAnchor = storage.readTx(tx -> trustAnchors.get(tx, Key.of(trustAnchorId))); if (maybeTrustAnchor.isPresent()) { final TrustAnchor trustAnchor = maybeTrustAnchor.get(); Bench.mark0("validateTa " + trustAnchor.getName(), () -> validateTa(trustAnchor)); } else { log.error("Couldn't find trust anchor {}", trustAnchorId); } } }
CertificateTreeValidationService { public void validate(long trustAnchorId) { Optional<TrustAnchor> maybeTrustAnchor = storage.readTx(tx -> trustAnchors.get(tx, Key.of(trustAnchorId))); if (maybeTrustAnchor.isPresent()) { final TrustAnchor trustAnchor = maybeTrustAnchor.get(); Bench.mark0("validateTa " + trustAnchor.getName(), () -> validateTa(trustAnchor)); } else { log.error("Couldn't find trust anchor {}", trustAnchorId); } } @Autowired  CertificateTreeValidationService(RpkiObjects rpkiObjects,
                                            RpkiRepositories rpkiRepositories,
                                            Settings settings,
                                            ValidationScheduler validationScheduler,
                                            ValidationRuns validationRuns,
                                            TrustAnchors trustAnchors,
                                            ValidatedRpkiObjects validatedRpkiObjects,
                                            Storage storage,
                                            TrustAnchorState trustAnchorState,
                                            TrustAnchorMetricsService taMetricsService,
                                            ValidationConfig validationConfig); }
CertificateTreeValidationService { public void validate(long trustAnchorId) { Optional<TrustAnchor> maybeTrustAnchor = storage.readTx(tx -> trustAnchors.get(tx, Key.of(trustAnchorId))); if (maybeTrustAnchor.isPresent()) { final TrustAnchor trustAnchor = maybeTrustAnchor.get(); Bench.mark0("validateTa " + trustAnchor.getName(), () -> validateTa(trustAnchor)); } else { log.error("Couldn't find trust anchor {}", trustAnchorId); } } @Autowired  CertificateTreeValidationService(RpkiObjects rpkiObjects,
                                            RpkiRepositories rpkiRepositories,
                                            Settings settings,
                                            ValidationScheduler validationScheduler,
                                            ValidationRuns validationRuns,
                                            TrustAnchors trustAnchors,
                                            ValidatedRpkiObjects validatedRpkiObjects,
                                            Storage storage,
                                            TrustAnchorState trustAnchorState,
                                            TrustAnchorMetricsService taMetricsService,
                                            ValidationConfig validationConfig); void validate(long trustAnchorId); }
CertificateTreeValidationService { public void validate(long trustAnchorId) { Optional<TrustAnchor> maybeTrustAnchor = storage.readTx(tx -> trustAnchors.get(tx, Key.of(trustAnchorId))); if (maybeTrustAnchor.isPresent()) { final TrustAnchor trustAnchor = maybeTrustAnchor.get(); Bench.mark0("validateTa " + trustAnchor.getName(), () -> validateTa(trustAnchor)); } else { log.error("Couldn't find trust anchor {}", trustAnchorId); } } @Autowired  CertificateTreeValidationService(RpkiObjects rpkiObjects,
                                            RpkiRepositories rpkiRepositories,
                                            Settings settings,
                                            ValidationScheduler validationScheduler,
                                            ValidationRuns validationRuns,
                                            TrustAnchors trustAnchors,
                                            ValidatedRpkiObjects validatedRpkiObjects,
                                            Storage storage,
                                            TrustAnchorState trustAnchorState,
                                            TrustAnchorMetricsService taMetricsService,
                                            ValidationConfig validationConfig); void validate(long trustAnchorId); final long LONG_DURATION_WARNING_MS; }