private void testDataBlocksOnly(TestSplitfile test) throws IOException, CHKEncodeException, FetchException, MetadataParseException { StorageCallback cb = test.createStorageCallback(); SplitFileFetcherStorage storage = test.createStorage(cb); SplitFileFetcherSegmentStorage segment = storage.segments[0]; for(int i=0;i<test.checkBlocks.length;i++) { segment.onNonFatalFailure(test.dataBlocks.length+i); } for(int i=0;i<test.dataBlocks.length;i++) { assertFalse(segment.hasStartedDecode()); assertTrue(segment.onGotKey(test.dataKeys[i].getNodeCHK(), test.encodeDataBlock(i))); cb.markDownloadedBlock(i); } cb.checkFailed(); assertTrue(segment.hasStartedDecode()); cb.checkFailed(); waitForDecode(segment); cb.checkFailed(); cb.waitForFinished(); cb.checkFailed(); test.verifyOutput(storage); cb.checkFailed(); storage.finishedFetcher(); cb.checkFailed(); waitForFinished(segment); cb.checkFailed(); cb.waitForFree(storage); cb.checkFailed(); }
assertFalse(segment.hasStartedDecode()); assertTrue(segment.onGotKey(test.checkKeys[i].getNodeCHK(), test.encodeCheckBlock(i))); cb.markDownloadedBlock(i + test.dataBlocks.length); assertTrue(segment.hasStartedDecode()); cb.checkFailed(); waitForDecode(segment);
} while (hits[block]); hits[block] = true; assertFalse(segment.hasStartedDecode()); assertTrue(segment.onGotKey(test.getCHK(block), test.encodeBlock(block))); cb.markDownloadedBlock(block); assertTrue(segment.hasStartedDecode()); cb.checkFailed(); waitForDecode(segment);
hits[block] = true; SplitFileFetcherSegmentStorage segment = storage.segments[test.segmentFor(block)]; if(segment.hasStartedDecode()) { i--; continue; cb.checkFailed(); for(SplitFileFetcherSegmentStorage segment : storage.segments) assertTrue(segment.hasStartedDecode()); // All segments have started decoding. cb.checkFailed(); for(SplitFileFetcherSegmentStorage segment : storage.segments)
} while (hits[block]); hits[block] = true; assertFalse(segment.hasStartedDecode()); assertTrue(segment.onGotKey(test.getCHK(block), test.encodeBlock(block))); cb.markDownloadedBlock(block); assertTrue(segment.hasStartedDecode()); cb.checkFailed(); waitForDecode(segment);
fetched[blockNo] = true; ClientCHKBlock block = inserterSegment.encodeBlock(blockNo); assertFalse(fetcherSegment.hasStartedDecode()); boolean success = fetcherSegment.onGotKey(block.getClientKey().getNodeCHK(), block.getBlock()); assertTrue(success); fcb.checkFailed(); assertTrue(fetcherSegment.hasStartedDecode()); fcb.checkFailed(); waitForDecode(fetcherSegment);
} while (hits[block]); hits[block] = true; assertFalse(segment.hasStartedDecode()); assertTrue(segment.onGotKey(test.getCHK(block), test.encodeBlock(block))); cb.markDownloadedBlock(block); assertTrue(segment.hasStartedDecode()); cb.checkFailed(); waitForDecode(segment);