@Test public void testCompare() { ComparisonService s = new SizeComparisonService(); assertEquals(Comparison.equal, s.compare(new PathAttributes() { @Override public long getSize() { return 1L; } }, new LocalAttributes("/t") { @Override public long getSize() { return 1L; } } )); assertEquals(Comparison.notequal, s.compare(new PathAttributes() { @Override public long getSize() { return 2L; } }, new LocalAttributes("/t") { @Override public long getSize() { return 1L; } } )); }
@Override public Comparison compare(final Attributes remote, final Attributes local) { if(log.isDebugEnabled()) { log.debug(String.format("Compare size for %s with %s", remote, local)); } if(remote.getSize() == 0 && local.getSize() == 0) { return Comparison.equal; } if(remote.getSize() == 0) { return Comparison.local; } if(local.getSize() == 0) { return Comparison.remote; } if(remote.getSize() == local.getSize()) { return Comparison.equal; } return Comparison.notequal; }
SizeComparisonService implements ComparisonService { @Override public Comparison compare(final Attributes remote, final Attributes local) { if(log.isDebugEnabled()) { log.debug(String.format("Compare size for %s with %s", remote, local)); } if(remote.getSize() == 0 && local.getSize() == 0) { return Comparison.equal; } if(remote.getSize() == 0) { return Comparison.local; } if(local.getSize() == 0) { return Comparison.remote; } if(remote.getSize() == local.getSize()) { return Comparison.equal; } return Comparison.notequal; } }
SizeComparisonService implements ComparisonService { @Override public Comparison compare(final Attributes remote, final Attributes local) { if(log.isDebugEnabled()) { log.debug(String.format("Compare size for %s with %s", remote, local)); } if(remote.getSize() == 0 && local.getSize() == 0) { return Comparison.equal; } if(remote.getSize() == 0) { return Comparison.local; } if(local.getSize() == 0) { return Comparison.remote; } if(remote.getSize() == local.getSize()) { return Comparison.equal; } return Comparison.notequal; }  }
SizeComparisonService implements ComparisonService { @Override public Comparison compare(final Attributes remote, final Attributes local) { if(log.isDebugEnabled()) { log.debug(String.format("Compare size for %s with %s", remote, local)); } if(remote.getSize() == 0 && local.getSize() == 0) { return Comparison.equal; } if(remote.getSize() == 0) { return Comparison.local; } if(local.getSize() == 0) { return Comparison.remote; } if(remote.getSize() == local.getSize()) { return Comparison.equal; } return Comparison.notequal; }  @Override Comparison compare(final Attributes remote, final Attributes local); }
SizeComparisonService implements ComparisonService { @Override public Comparison compare(final Attributes remote, final Attributes local) { if(log.isDebugEnabled()) { log.debug(String.format("Compare size for %s with %s", remote, local)); } if(remote.getSize() == 0 && local.getSize() == 0) { return Comparison.equal; } if(remote.getSize() == 0) { return Comparison.local; } if(local.getSize() == 0) { return Comparison.remote; } if(remote.getSize() == local.getSize()) { return Comparison.equal; } return Comparison.notequal; }  @Override Comparison compare(final Attributes remote, final Attributes local);  }