@Test public void testRun() throws Exception { final List<Path> files = new ArrayList<Path>(); final Path a = new Path("a", EnumSet.of(Path.Type.file)); a.attributes().setSize(1L); files.add(a); final Path b = new Path("a", EnumSet.of(Path.Type.file)); b.attributes().setSize(3L); files.add(b); assertEquals(4L, new CalculateSizeWorker(files, new DisabledProgressListener()) { int i = 0; @Override public void cleanup(final Long result) { assertEquals(4L, result, 0L); } @Override protected void update(final long size) { if(0 == i) { assertEquals(1L, size, 0L); } if(1 == i) { assertEquals(4L, size, 0L); } i++; } }.run(new NullSession(new Host(new TestProtocol()))), 0L); }
@Override public Long run(final Session<?> session) throws BackgroundException { for(Path next : files) { next.attributes().setSize(this.calculateSize(session, next)); } return total; }
CalculateSizeWorker extends Worker<Long> { @Override public Long run(final Session<?> session) throws BackgroundException { for(Path next : files) { next.attributes().setSize(this.calculateSize(session, next)); } return total; } }
CalculateSizeWorker extends Worker<Long> { @Override public Long run(final Session<?> session) throws BackgroundException { for(Path next : files) { next.attributes().setSize(this.calculateSize(session, next)); } return total; } CalculateSizeWorker(final List<Path> files, final ProgressListener listener); }
CalculateSizeWorker extends Worker<Long> { @Override public Long run(final Session<?> session) throws BackgroundException { for(Path next : files) { next.attributes().setSize(this.calculateSize(session, next)); } return total; } CalculateSizeWorker(final List<Path> files, final ProgressListener listener); @Override Long run(final Session<?> session); @Override String getActivity(); @Override Long initialize(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString(); }
CalculateSizeWorker extends Worker<Long> { @Override public Long run(final Session<?> session) throws BackgroundException { for(Path next : files) { next.attributes().setSize(this.calculateSize(session, next)); } return total; } CalculateSizeWorker(final List<Path> files, final ProgressListener listener); @Override Long run(final Session<?> session); @Override String getActivity(); @Override Long initialize(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }