@@ -0,0 +1,1695 @@
+package edu.uw.apl.tupelo.model;%0A%0Aimport java.io.File;%0Aimport java.io.InputStream;%0A%0Aimport org.apache.commons.io.input.CountingInputStream;%0A%0A/**%0A * Testing aspects of reading data from a PhysicalDisk. Warning, these%0A * tests can read a LOT of data, 100GB+, so can take tens of minutes.%0A * We really want a Maven profile (in additon to tester) that says%0A * 'Yes I really want to run these lengthy (read slow!) tests%0A */%0Apublic class ReadTest extends junit.framework.TestCase %7B%0A%0A%09public void testNull() %7B%0A%09%7D%0A%0A%09/**%0A%09   Testing that we really can read as many bytes as the disk's%0A%09   advertised size. Note that 250GB took 40+ mins to read, on%0A%09   rejewski.%0A%09   %0A%09   Running edu.uw.apl.tupelo.model.ReadTest%0A%09   Expected: 250000000000%0A%09   Actual: 250000000000%0A%0A%09   %5BINFO%5D ---------------------------------------------------------%0A%09   %5BINFO%5D BUILD SUCCESS%0A%09   %5BINFO%5D ---------------------------------------------------------%0A%09   %5BINFO%5D Total time: 41:16.609s%0A%09   %5BINFO%5D Finished at: Thu Nov 13 12:54:53 PST 2014%0A%09   %5BINFO%5D Final Memory: 14M/170M%0A%09   %5BINFO%5D ---------------------------------------------------------%0A%09*/%0A%09public void _testAdvertisedSize() throws Exception %7B%0A%09%09File f = new File( %22/dev/sda%22 );%0A%09%09if( !f.canRead() )%0A%09%09%09return;%0A%09%09PhysicalDisk pd = new PhysicalDisk( f );%0A%09%09long expected = pd.size();%0A%09%09System.out.println( %22Expected: %22 + expected );%0A%09%09byte%5B%5D ba = new byte%5B1024*1024%5D;%0A%09%09InputStream is = pd.getInputStream();%0A%09%09CountingInputStream cis = new CountingInputStream( is ); %0A%09%09int nin = 0;%0A%09%09while( (nin = cis.read( ba )) != -1 )%0A%09%09%09;%0A%09%09cis.close();%0A%09%09long actual = cis.getByteCount();%0A%09%09System.out.println( %22Actual: %22 + actual );%0A%09%09assertEquals( expected, actual );%0A%09%7D%0A%7D%0A%0A// eof%0A

Verify physical disk read byte count matches advertised size