@Test public void testCompare() { ComparisonService s = new ChecksumComparisonService(); assertEquals(Comparison.equal, s.compare(new PathAttributes() { @Override public Checksum getChecksum() { return new Checksum(HashAlgorithm.md5, "a"); } }, new LocalAttributes("/t") { @Override public Checksum getChecksum() { return new Checksum(HashAlgorithm.md5, "a"); } } )); assertEquals(Comparison.notequal, s.compare(new PathAttributes() { @Override public Checksum getChecksum() { return new Checksum(HashAlgorithm.md5, "b"); } }, new LocalAttributes("/t") { @Override public Checksum getChecksum() { return new Checksum(HashAlgorithm.md5, "a"); } } )); }
@Override public Comparison compare(final Attributes remote, final Attributes local) { if(Checksum.NONE == remote.getChecksum()) { log.warn(String.format("No remote checksum available for comparison %s", remote)); return Comparison.unknown; } if(Checksum.NONE == local.getChecksum()) { log.warn(String.format("No local checksum available for comparison %s", local)); return Comparison.unknown; } if(remote.getChecksum().equals(local.getChecksum())) { return Comparison.equal; } return Comparison.notequal; }
ChecksumComparisonService implements ComparisonService { @Override public Comparison compare(final Attributes remote, final Attributes local) { if(Checksum.NONE == remote.getChecksum()) { log.warn(String.format("No remote checksum available for comparison %s", remote)); return Comparison.unknown; } if(Checksum.NONE == local.getChecksum()) { log.warn(String.format("No local checksum available for comparison %s", local)); return Comparison.unknown; } if(remote.getChecksum().equals(local.getChecksum())) { return Comparison.equal; } return Comparison.notequal; } }
ChecksumComparisonService implements ComparisonService { @Override public Comparison compare(final Attributes remote, final Attributes local) { if(Checksum.NONE == remote.getChecksum()) { log.warn(String.format("No remote checksum available for comparison %s", remote)); return Comparison.unknown; } if(Checksum.NONE == local.getChecksum()) { log.warn(String.format("No local checksum available for comparison %s", local)); return Comparison.unknown; } if(remote.getChecksum().equals(local.getChecksum())) { return Comparison.equal; } return Comparison.notequal; }  }
ChecksumComparisonService implements ComparisonService { @Override public Comparison compare(final Attributes remote, final Attributes local) { if(Checksum.NONE == remote.getChecksum()) { log.warn(String.format("No remote checksum available for comparison %s", remote)); return Comparison.unknown; } if(Checksum.NONE == local.getChecksum()) { log.warn(String.format("No local checksum available for comparison %s", local)); return Comparison.unknown; } if(remote.getChecksum().equals(local.getChecksum())) { return Comparison.equal; } return Comparison.notequal; }  @Override Comparison compare(final Attributes remote, final Attributes local); }
ChecksumComparisonService implements ComparisonService { @Override public Comparison compare(final Attributes remote, final Attributes local) { if(Checksum.NONE == remote.getChecksum()) { log.warn(String.format("No remote checksum available for comparison %s", remote)); return Comparison.unknown; } if(Checksum.NONE == local.getChecksum()) { log.warn(String.format("No local checksum available for comparison %s", local)); return Comparison.unknown; } if(remote.getChecksum().equals(local.getChecksum())) { return Comparison.equal; } return Comparison.notequal; }  @Override Comparison compare(final Attributes remote, final Attributes local);  }