Package freenet.client.async.SplitFileInserterSegmentStorage

Examples of freenet.client.async.SplitFileInserterSegmentStorage.BlockInsert


            assertEquals(storage.segments[i].totalBlockCount, resumed.segments[i].totalBlockCount);
        }
        int totalBlocks = storage.getTotalBlockCount();
        assertEquals(totalBlocks, resumed.getTotalBlockCount());
        for(int i=0;i<totalBlocks;i++) {
            BlockInsert chosen = resumed.chooseBlock();
            if(chosen == null) {
                assertFalse(true);
            } else {
                keys.addInsert(chosen);
            }
View Full Code Here


            assertEquals(segment.dataBlockCount, 2);
            assertEquals(segment.checkBlockCount, 3);
            assertEquals(segment.crossCheckBlockCount, 0);
            assertTrue(resumed.getStatus() == Status.ENCODED);

            BlockInsert chosen = segment.chooseBlock();
            assertTrue(chosen != null);
            keys.addInsert(chosen);
            assertFalse(chosenBlocks[chosen.blockNumber]);
            chosenBlocks[chosen.blockNumber] = true;
            segment.onFailure(chosen.blockNumber, new InsertException(InsertExceptionMode.ROUTE_NOT_FOUND));
        }
        keys.clear();
        // Choose and succeed all blocks.
        chosenBlocks = new boolean[totalBlockCount];
        for(int i=0;i<totalBlockCount;i++) {
            executor.waitForIdle();
            resumed = new SplitFileInserterStorage(storage.getRAF(), data, cb, r,
                    memoryLimitedJobRunner, jobRunner, ticker, keys, fg, persistentFileTracker, null);
            assertEquals(resumed.segments.length, 1);
            SplitFileInserterSegmentStorage segment = resumed.segments[0];
            assertEquals(segment.dataBlockCount, 2);
            assertEquals(segment.checkBlockCount, 3);
            assertEquals(segment.crossCheckBlockCount, 0);
            assertTrue(resumed.getStatus() == Status.ENCODED);

            BlockInsert chosen = segment.chooseBlock();
            keys.addInsert(chosen);
            assertTrue(chosen != null);
            assertFalse(chosenBlocks[chosen.blockNumber]);
            chosenBlocks[chosen.blockNumber] = true;
            segment.onInsertedBlock(chosen.blockNumber, segment.encodeBlock(chosen.blockNumber).getClientKey());
View Full Code Here

        assertEquals(segment.crossCheckBlockCount, 0);
        assertEquals(storage.getStatus(), Status.ENCODED);
        boolean[] chosenBlocks = new boolean[segment.totalBlockCount];
        // Choose and fail all blocks.
        for(int i=0;i<segment.totalBlockCount;i++) {
            BlockInsert chosen = segment.chooseBlock();
            assertTrue(chosen != null);
            keys.addRunningInsert(chosen);
            assertFalse(chosenBlocks[chosen.blockNumber]);
            chosenBlocks[chosen.blockNumber] = true;
            segment.onFailure(chosen.blockNumber, new InsertException(InsertExceptionMode.ROUTE_NOT_FOUND));
        }
        BlockInsert chosen = segment.chooseBlock();
        assertTrue(chosen == null);
        for(int i=0;i<segment.totalBlockCount;i++)
            keys.removeRunningInsert(new BlockInsert(segment, i));
        // Choose and succeed all blocks.
        chosenBlocks = new boolean[segment.totalBlockCount];
        for(int i=0;i<segment.totalBlockCount;i++) {
            chosen = segment.chooseBlock();
            keys.addRunningInsert(chosen);
View Full Code Here

TOP

Related Classes of freenet.client.async.SplitFileInserterSegmentStorage.BlockInsert

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.