@Test public void testValidate_AcceptOnFirstMatch() throws Exception { ChecksumValidator validator = newValidator( SHA1 ); fetcher.mock( SHA1, "foo" ); validator.validate( checksums( SHA1, "foo" ), null ); fetcher.assertFetchedFiles( SHA1 ); policy.assertCallbacks( "match(SHA-1, 0000)" ); }
public void validate( Map<String, ?> actualChecksums, Map<String, ?> inlinedChecksums ) throws ChecksumFailureException { if ( checksumPolicy == null ) { return; } if ( inlinedChecksums != null && validateInlinedChecksums( actualChecksums, inlinedChecksums ) ) { return; } if ( validateExternalChecksums( actualChecksums ) ) { return; } checksumPolicy.onNoMoreChecksums(); }
ChecksumValidator { public void validate( Map<String, ?> actualChecksums, Map<String, ?> inlinedChecksums ) throws ChecksumFailureException { if ( checksumPolicy == null ) { return; } if ( inlinedChecksums != null && validateInlinedChecksums( actualChecksums, inlinedChecksums ) ) { return; } if ( validateExternalChecksums( actualChecksums ) ) { return; } checksumPolicy.onNoMoreChecksums(); } }
ChecksumValidator { public void validate( Map<String, ?> actualChecksums, Map<String, ?> inlinedChecksums ) throws ChecksumFailureException { if ( checksumPolicy == null ) { return; } if ( inlinedChecksums != null && validateInlinedChecksums( actualChecksums, inlinedChecksums ) ) { return; } if ( validateExternalChecksums( actualChecksums ) ) { return; } checksumPolicy.onNoMoreChecksums(); } ChecksumValidator( Logger logger, File dataFile, FileProcessor fileProcessor,
                              ChecksumFetcher checksumFetcher, ChecksumPolicy checksumPolicy,
                              Collection<Checksum> checksums ); }
ChecksumValidator { public void validate( Map<String, ?> actualChecksums, Map<String, ?> inlinedChecksums ) throws ChecksumFailureException { if ( checksumPolicy == null ) { return; } if ( inlinedChecksums != null && validateInlinedChecksums( actualChecksums, inlinedChecksums ) ) { return; } if ( validateExternalChecksums( actualChecksums ) ) { return; } checksumPolicy.onNoMoreChecksums(); } ChecksumValidator( Logger logger, File dataFile, FileProcessor fileProcessor,
                              ChecksumFetcher checksumFetcher, ChecksumPolicy checksumPolicy,
                              Collection<Checksum> checksums ); ChecksumCalculator newChecksumCalculator( File targetFile ); void validate( Map<String, ?> actualChecksums, Map<String, ?> inlinedChecksums ); void retry(); boolean handle( ChecksumFailureException exception ); void commit(); void close(); }
ChecksumValidator { public void validate( Map<String, ?> actualChecksums, Map<String, ?> inlinedChecksums ) throws ChecksumFailureException { if ( checksumPolicy == null ) { return; } if ( inlinedChecksums != null && validateInlinedChecksums( actualChecksums, inlinedChecksums ) ) { return; } if ( validateExternalChecksums( actualChecksums ) ) { return; } checksumPolicy.onNoMoreChecksums(); } ChecksumValidator( Logger logger, File dataFile, FileProcessor fileProcessor,
                              ChecksumFetcher checksumFetcher, ChecksumPolicy checksumPolicy,
                              Collection<Checksum> checksums ); ChecksumCalculator newChecksumCalculator( File targetFile ); void validate( Map<String, ?> actualChecksums, Map<String, ?> inlinedChecksums ); void retry(); boolean handle( ChecksumFailureException exception ); void commit(); void close();  }