You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2010/04/25 19:35:57 UTC
svn commit: r937834 [2/2] - in /poi/trunk/src:
java/org/apache/poi/poifs/common/ java/org/apache/poi/poifs/dev/
java/org/apache/poi/poifs/eventfilesystem/
java/org/apache/poi/poifs/filesystem/ java/org/apache/poi/poifs/property/
java/org/apache/poi/poi...
Modified: poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBATBlock.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBATBlock.java?rev=937834&r1=937833&r2=937834&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBATBlock.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBATBlock.java Sun Apr 25 17:35:56 2010
@@ -21,6 +21,8 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Arrays;
+import org.apache.poi.poifs.common.POIFSConstants;
+
import junit.framework.TestCase;
/**
@@ -39,27 +41,27 @@ public final class TestBATBlock extends
public void testCreateBATBlocks() throws IOException {
// test 0 length array (basic sanity)
- BATBlock[] rvalue = BATBlock.createBATBlocks(createTestArray(0));
+ BATBlock[] rvalue = BATBlock.createBATBlocks(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS, createTestArray(0));
assertEquals(0, rvalue.length);
// test array of length 1
- rvalue = BATBlock.createBATBlocks(createTestArray(1));
+ rvalue = BATBlock.createBATBlocks(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS, createTestArray(1));
assertEquals(1, rvalue.length);
verifyContents(rvalue, 1);
// test array of length 127
- rvalue = BATBlock.createBATBlocks(createTestArray(127));
+ rvalue = BATBlock.createBATBlocks(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS, createTestArray(127));
assertEquals(1, rvalue.length);
verifyContents(rvalue, 127);
// test array of length 128
- rvalue = BATBlock.createBATBlocks(createTestArray(128));
+ rvalue = BATBlock.createBATBlocks(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS, createTestArray(128));
assertEquals(1, rvalue.length);
verifyContents(rvalue, 128);
// test array of length 129
- rvalue = BATBlock.createBATBlocks(createTestArray(129));
+ rvalue = BATBlock.createBATBlocks(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS, createTestArray(129));
assertEquals(2, rvalue.length);
verifyContents(rvalue, 129);
}
@@ -105,32 +107,32 @@ public final class TestBATBlock extends
public void testCreateXBATBlocks() throws IOException {
// test 0 length array (basic sanity)
- BATBlock[] rvalue = BATBlock.createXBATBlocks(createTestArray(0), 1);
+ BATBlock[] rvalue = BATBlock.createXBATBlocks(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS, createTestArray(0), 1);
assertEquals(0, rvalue.length);
// test array of length 1
- rvalue = BATBlock.createXBATBlocks(createTestArray(1), 1);
+ rvalue = BATBlock.createXBATBlocks(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS, createTestArray(1), 1);
assertEquals(1, rvalue.length);
verifyXBATContents(rvalue, 1, 1);
// test array of length 127
- rvalue = BATBlock.createXBATBlocks(createTestArray(127), 1);
+ rvalue = BATBlock.createXBATBlocks(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS, createTestArray(127), 1);
assertEquals(1, rvalue.length);
verifyXBATContents(rvalue, 127, 1);
// test array of length 128
- rvalue = BATBlock.createXBATBlocks(createTestArray(128), 1);
+ rvalue = BATBlock.createXBATBlocks(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS, createTestArray(128), 1);
assertEquals(2, rvalue.length);
verifyXBATContents(rvalue, 128, 1);
// test array of length 254
- rvalue = BATBlock.createXBATBlocks(createTestArray(254), 1);
+ rvalue = BATBlock.createXBATBlocks(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS, createTestArray(254), 1);
assertEquals(2, rvalue.length);
verifyXBATContents(rvalue, 254, 1);
// test array of length 255
- rvalue = BATBlock.createXBATBlocks(createTestArray(255), 1);
+ rvalue = BATBlock.createXBATBlocks(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS, createTestArray(255), 1);
assertEquals(3, rvalue.length);
verifyXBATContents(rvalue, 255, 1);
}
@@ -193,17 +195,17 @@ public final class TestBATBlock extends
{
assertEquals(
"requirement for " + blockCounts[ j ], requirements[ j ],
- BATBlock.calculateXBATStorageRequirements(blockCounts[ j ]));
+ BATBlock.calculateXBATStorageRequirements(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS, blockCounts[ j ]));
}
}
public void testEntriesPerBlock() {
- assertEquals(128, BATBlock.entriesPerBlock());
+ assertEquals(128, POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS.getBATEntriesPerBlock());
}
public void testEntriesPerXBATBlock() {
- assertEquals(127, BATBlock.entriesPerXBATBlock());
+ assertEquals(127, POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS.getXBATEntriesPerBlock());
}
public void testGetXBATChainOffset() {
- assertEquals(508, BATBlock.getXBATChainOffset());
+ assertEquals(508, POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS.getNextXBATChainOffset());
}
}
Modified: poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockAllocationTableReader.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockAllocationTableReader.java?rev=937834&r1=937833&r2=937834&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockAllocationTableReader.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockAllocationTableReader.java Sun Apr 25 17:35:56 2010
@@ -25,6 +25,7 @@ import java.util.Arrays;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
+import org.apache.poi.poifs.common.POIFSBigBlockSize;
import org.apache.poi.poifs.common.POIFSConstants;
import org.apache.poi.util.HexRead;
import org.apache.poi.util.LittleEndian;
@@ -187,8 +188,9 @@ public final class TestBlockAllocationTa
sbts[j] = new RawDataBlock(sbt_input);
}
SmallDocumentBlockList small_blocks = new SmallDocumentBlockList(SmallDocumentBlock
- .extract(sbts));
- BlockAllocationTableReader sbat = new BlockAllocationTableReader(sbats, small_blocks);
+ .extract(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS, sbts));
+ BlockAllocationTableReader sbat = new BlockAllocationTableReader(
+ POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS, sbats, small_blocks);
boolean[] isUsed = {
false, false, false, false, false, false, false, false, false,
false, true, true, true, true, true, true, true, true, true, true,
@@ -271,7 +273,8 @@ public final class TestBlockAllocationTa
}
list.fill(132);
int[] blocks = { 2, 3 };
- BlockAllocationTableReader table = new BlockAllocationTableReader(130, blocks, 2, 0, list);
+ BlockAllocationTableReader table = new BlockAllocationTableReader(
+ POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS, 130, blocks, 2, 0, list);
for (int i = 0; i < (130 * 128); i++) {
if (i % 256 == 0) {
@@ -353,7 +356,8 @@ public final class TestBlockAllocationTa
list.add(new RawDataBlock(new ByteArrayInputStream(data)));
list.fill(1);
int[] blocks = { 0 };
- BlockAllocationTableReader table = new BlockAllocationTableReader(1, blocks, 0, -2, list);
+ BlockAllocationTableReader table = new BlockAllocationTableReader(
+ POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS, 1, blocks, 0, -2, list);
int[] start_blocks = { -2, 1, 2, 3, 5, 7, 9, 11, 12 };
int[] expected_length = { 0, 1, -1, -1, -1, -1, -1, -1, 116 };
@@ -384,6 +388,9 @@ public final class TestBlockAllocationTa
*/
public void testBadSectorAllocationTableSize_bug48085() {
int BLOCK_SIZE = 512;
+ POIFSBigBlockSize bigBlockSize = POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS;
+ assertEquals(BLOCK_SIZE, bigBlockSize.getBigBlockSize());
+
// 512 bytes take from the start of bugzilla attachment 24444
byte[] initData = HexRead.readFromString(
@@ -402,12 +409,13 @@ public final class TestBlockAllocationTa
RawDataBlockList dataBlocks;
try {
hb = new HeaderBlockReader(stream);
- dataBlocks = new RawDataBlockList(stream, BLOCK_SIZE);
+ dataBlocks = new RawDataBlockList(stream, bigBlockSize);
} catch (IOException e) {
throw new RuntimeException(e);
}
try {
- new BlockAllocationTableReader(hb.getBATCount(), hb.getBATArray(), hb.getXBATCount(),
+ new BlockAllocationTableReader(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS,
+ hb.getBATCount(), hb.getBATArray(), hb.getXBATCount(),
hb.getXBATIndex(), dataBlocks);
} catch (IOException e) {
// expected during successful test
Modified: poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockAllocationTableWriter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockAllocationTableWriter.java?rev=937834&r1=937833&r2=937834&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockAllocationTableWriter.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockAllocationTableWriter.java Sun Apr 25 17:35:56 2010
@@ -36,7 +36,7 @@ public final class TestBlockAllocationTa
public void testAllocateSpace() {
BlockAllocationTableWriter table =
- new BlockAllocationTableWriter();
+ new BlockAllocationTableWriter(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);
int[] blockSizes =
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
@@ -51,36 +51,36 @@ public final class TestBlockAllocationTa
}
public void testCreateBlocks() {
- BlockAllocationTableWriter table = new BlockAllocationTableWriter();
+ BlockAllocationTableWriter table = new BlockAllocationTableWriter(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);
table.allocateSpace(127);
table.createBlocks();
verifyBlocksCreated(table, 1);
- table = new BlockAllocationTableWriter();
+ table = new BlockAllocationTableWriter(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);
table.allocateSpace(128);
table.createBlocks();
verifyBlocksCreated(table, 2);
- table = new BlockAllocationTableWriter();
+ table = new BlockAllocationTableWriter(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);
table.allocateSpace(254);
table.createBlocks();
verifyBlocksCreated(table, 2);
- table = new BlockAllocationTableWriter();
+ table = new BlockAllocationTableWriter(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);
table.allocateSpace(255);
table.createBlocks();
verifyBlocksCreated(table, 3);
- table = new BlockAllocationTableWriter();
+ table = new BlockAllocationTableWriter(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);
table.allocateSpace(13843);
table.createBlocks();
verifyBlocksCreated(table, 109);
- table = new BlockAllocationTableWriter();
+ table = new BlockAllocationTableWriter(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);
table.allocateSpace(13844);
table.createBlocks();
verifyBlocksCreated(table, 110);
- table = new BlockAllocationTableWriter();
+ table = new BlockAllocationTableWriter(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);
table.allocateSpace(13969);
table.createBlocks();
verifyBlocksCreated(table, 110);
- table = new BlockAllocationTableWriter();
+ table = new BlockAllocationTableWriter(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);
table.allocateSpace(13970);
table.createBlocks();
verifyBlocksCreated(table, 111);
@@ -90,7 +90,7 @@ public final class TestBlockAllocationTa
* Test content produced by BlockAllocationTableWriter
*/
public void testProduct() throws IOException {
- BlockAllocationTableWriter table = new BlockAllocationTableWriter();
+ BlockAllocationTableWriter table = new BlockAllocationTableWriter(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);
for (int k = 1; k <= 22; k++)
{
Modified: poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockListImpl.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockListImpl.java?rev=937834&r1=937833&r2=937834&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockListImpl.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestBlockListImpl.java Sun Apr 25 17:35:56 2010
@@ -25,6 +25,7 @@ import java.util.List;
import junit.framework.TestCase;
+import org.apache.poi.poifs.common.POIFSConstants;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianConsts;
@@ -142,10 +143,10 @@ public final class TestBlockListImpl ext
BlockListImpl list = create();
list.setBAT(null);
- list.setBAT(new BlockAllocationTableReader());
+ list.setBAT(new BlockAllocationTableReader(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS));
try
{
- list.setBAT(new BlockAllocationTableReader());
+ list.setBAT(new BlockAllocationTableReader(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS));
fail("second attempt should have failed");
}
catch (IOException ignored)
@@ -233,7 +234,7 @@ public final class TestBlockListImpl ext
0
};
BlockAllocationTableReader table =
- new BlockAllocationTableReader(1, blocks, 0, -2, list);
+ new BlockAllocationTableReader(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS, 1, blocks, 0, -2, list);
int[] start_blocks =
{
-2, 1, 2, 3, 5, 7, 9, 11, 12
Modified: poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestDocumentBlock.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestDocumentBlock.java?rev=937834&r1=937833&r2=937834&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestDocumentBlock.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestDocumentBlock.java Sun Apr 25 17:35:56 2010
@@ -21,6 +21,8 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import org.apache.poi.poifs.common.POIFSConstants;
+
import junit.framework.TestCase;
/**
@@ -55,7 +57,7 @@ public final class TestDocumentBlock ext
byte[] data = new byte[ Math.min(_testdata.length - index, 512) ];
System.arraycopy(_testdata, index, data, 0, data.length);
- DocumentBlock block = new DocumentBlock(input);
+ DocumentBlock block = new DocumentBlock(input, POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);
verifyOutput(block, data);
size += block.size();
Modified: poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestHeaderBlockWriter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestHeaderBlockWriter.java?rev=937834&r1=937833&r2=937834&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestHeaderBlockWriter.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestHeaderBlockWriter.java Sun Apr 25 17:35:56 2010
@@ -23,6 +23,7 @@ import java.io.IOException;
import junit.framework.TestCase;
+import org.apache.poi.poifs.common.POIFSConstants;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndianConsts;
@@ -46,7 +47,7 @@ public final class TestHeaderBlockWriter
* Test creating a HeaderBlockWriter
*/
public void testConstructors() throws IOException {
- HeaderBlockWriter block = new HeaderBlockWriter();
+ HeaderBlockWriter block = new HeaderBlockWriter(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);
ByteArrayOutputStream output = new ByteArrayOutputStream(512);
block.writeBlocks(output);
@@ -85,7 +86,7 @@ public final class TestHeaderBlockWriter
* Test setting the SBAT start block
*/
public void testSetSBATStart() throws IOException {
- HeaderBlockWriter block = new HeaderBlockWriter();
+ HeaderBlockWriter block = new HeaderBlockWriter(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);
block.setSBATStart(0x01234567);
ByteArrayOutputStream output = new ByteArrayOutputStream(512);
@@ -117,7 +118,7 @@ public final class TestHeaderBlockWriter
* test setPropertyStart and getPropertyStart
*/
public void testSetPropertyStart() throws IOException {
- HeaderBlockWriter block = new HeaderBlockWriter();
+ HeaderBlockWriter block = new HeaderBlockWriter(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);
block.setPropertyStart(0x01234567);
ByteArrayOutputStream output = new ByteArrayOutputStream(512);
@@ -152,11 +153,11 @@ public final class TestHeaderBlockWriter
public void testSetBATBlocks() throws IOException {
// first, a small set of blocks
- HeaderBlockWriter block = new HeaderBlockWriter();
+ HeaderBlockWriter block = new HeaderBlockWriter(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);
BATBlock[] xbats = block.setBATBlocks(5, 0x01234567);
assertEquals(0, xbats.length);
- assertEquals(0, HeaderBlockWriter.calculateXBATStorageRequirements(5));
+ assertEquals(0, HeaderBlockWriter.calculateXBATStorageRequirements(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS,5));
ByteArrayOutputStream output = new ByteArrayOutputStream(512);
block.writeBlocks(output);
@@ -183,10 +184,10 @@ public final class TestHeaderBlockWriter
confirmEqual(expected, copy);
// second, a full set of blocks (109 blocks)
- block = new HeaderBlockWriter();
+ block = new HeaderBlockWriter(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);
xbats = block.setBATBlocks(109, 0x01234567);
assertEquals(0, xbats.length);
- assertEquals(0, HeaderBlockWriter.calculateXBATStorageRequirements(109));
+ assertEquals(0, HeaderBlockWriter.calculateXBATStorageRequirements(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS,109));
output = new ByteArrayOutputStream(512);
block.writeBlocks(output);
copy = output.toByteArray();
@@ -211,10 +212,10 @@ public final class TestHeaderBlockWriter
confirmEqual(expected2, copy);
// finally, a really large set of blocks (256 blocks)
- block = new HeaderBlockWriter();
+ block = new HeaderBlockWriter(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);
xbats = block.setBATBlocks(256, 0x01234567);
assertEquals(2, xbats.length);
- assertEquals(2, HeaderBlockWriter.calculateXBATStorageRequirements(256));
+ assertEquals(2, HeaderBlockWriter.calculateXBATStorageRequirements(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS,256));
output = new ByteArrayOutputStream(512);
block.writeBlocks(output);
copy = output.toByteArray();
Modified: poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestPropertyBlock.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestPropertyBlock.java?rev=937834&r1=937833&r2=937834&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestPropertyBlock.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestPropertyBlock.java Sun Apr 25 17:35:56 2010
@@ -22,6 +22,8 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import org.apache.poi.poifs.common.POIFSConstants;
+
import junit.framework.TestCase;
/**
@@ -36,13 +38,13 @@ public final class TestPropertyBlock ext
// test with 0 properties
List properties = new ArrayList();
BlockWritable[] blocks =
- PropertyBlock.createPropertyBlockArray(properties);
+ PropertyBlock.createPropertyBlockArray(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS,properties);
assertEquals(0, blocks.length);
// test with 1 property
properties.add(new LocalProperty("Root Entry"));
- blocks = PropertyBlock.createPropertyBlockArray(properties);
+ blocks = PropertyBlock.createPropertyBlockArray(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS,properties);
assertEquals(1, blocks.length);
byte[] testblock = new byte[ 512 ];
@@ -66,7 +68,7 @@ public final class TestPropertyBlock ext
// test with 3 properties
properties.add(new LocalProperty("workbook"));
properties.add(new LocalProperty("summary"));
- blocks = PropertyBlock.createPropertyBlockArray(properties);
+ blocks = PropertyBlock.createPropertyBlockArray(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS,properties);
assertEquals(1, blocks.length);
testblock[ 0x0080 ] = ( byte ) 'w';
testblock[ 0x0082 ] = ( byte ) 'o';
@@ -89,7 +91,7 @@ public final class TestPropertyBlock ext
// test with 4 properties
properties.add(new LocalProperty("wintery"));
- blocks = PropertyBlock.createPropertyBlockArray(properties);
+ blocks = PropertyBlock.createPropertyBlockArray(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS,properties);
assertEquals(1, blocks.length);
testblock[ 0x0180 ] = ( byte ) 'w';
testblock[ 0x0182 ] = ( byte ) 'i';
@@ -103,7 +105,7 @@ public final class TestPropertyBlock ext
// test with 5 properties
properties.add(new LocalProperty("foo"));
- blocks = PropertyBlock.createPropertyBlockArray(properties);
+ blocks = PropertyBlock.createPropertyBlockArray(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS,properties);
assertEquals(2, blocks.length);
testblock = new byte[ 1024 ];
for (int j = 0; j < 8; j++)
Modified: poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestRawDataBlockList.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestRawDataBlockList.java?rev=937834&r1=937833&r2=937834&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestRawDataBlockList.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestRawDataBlockList.java Sun Apr 25 17:35:56 2010
@@ -51,14 +51,14 @@ public final class TestRawDataBlockList
{
data[ j ] = ( byte ) j;
}
- new RawDataBlockList(new ByteArrayInputStream(data), POIFSConstants.BIG_BLOCK_SIZE);
+ new RawDataBlockList(new ByteArrayInputStream(data), POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);
}
/**
* Test creating an empty RawDataBlockList
*/
public void testEmptyConstructor() throws IOException {
- new RawDataBlockList(new ByteArrayInputStream(new byte[ 0 ]), POIFSConstants.BIG_BLOCK_SIZE);
+ new RawDataBlockList(new ByteArrayInputStream(new byte[ 0 ]), POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);
}
/**
@@ -84,7 +84,7 @@ public final class TestRawDataBlockList
// Check we logged the error
logger.reset();
- new RawDataBlockList(new ByteArrayInputStream(data), POIFSConstants.BIG_BLOCK_SIZE);
+ new RawDataBlockList(new ByteArrayInputStream(data), POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);
assertEquals(1, logger.logged.size());
}
}
Modified: poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestSmallBlockTableReader.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestSmallBlockTableReader.java?rev=937834&r1=937833&r2=937834&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestSmallBlockTableReader.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestSmallBlockTableReader.java Sun Apr 25 17:35:56 2010
@@ -296,17 +296,18 @@ public final class TestSmallBlockTableRe
};
RawDataBlockList data_blocks = new RawDataBlockList(new ByteArrayInputStream(RawDataUtil
- .decode(raw_data_array)), POIFSConstants.BIG_BLOCK_SIZE);
+ .decode(raw_data_array)), POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);
int[] bat_array = { 15 };
// need to initialize the block list with a block allocation
// table
- new BlockAllocationTableReader(1, bat_array, 0, -2, data_blocks);
+ new BlockAllocationTableReader(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS, 1, bat_array, 0, -2, data_blocks);
// get property table from the document
- PropertyTable properties = new PropertyTable(0, data_blocks);
+ PropertyTable properties = new PropertyTable(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS, 0, data_blocks);
RootProperty root = properties.getRoot();
- BlockList bl = SmallBlockTableReader.getSmallDocumentBlocks(data_blocks, root, 14);
+ BlockList bl = SmallBlockTableReader.getSmallDocumentBlocks(
+ POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS, data_blocks, root, 14);
assertNotNull(bl);
}
}
Modified: poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestSmallBlockTableWriter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestSmallBlockTableWriter.java?rev=937834&r1=937833&r2=937834&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestSmallBlockTableWriter.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestSmallBlockTableWriter.java Sun Apr 25 17:35:56 2010
@@ -24,6 +24,7 @@ import java.util.List;
import junit.framework.TestCase;
+import org.apache.poi.poifs.common.POIFSConstants;
import org.apache.poi.poifs.filesystem.POIFSDocument;
import org.apache.poi.poifs.property.PropertyTable;
import org.apache.poi.poifs.property.RootProperty;
@@ -74,9 +75,9 @@ public final class TestSmallBlockTableWr
documents
.add(new POIFSDocument("doc9",
new ByteArrayInputStream(new byte[ 9 ])));
- RootProperty root = new PropertyTable().getRoot();
- SmallBlockTableWriter sbtw = new SmallBlockTableWriter(documents,
- root);
+ RootProperty root = new PropertyTable(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS).getRoot();
+ SmallBlockTableWriter sbtw = new SmallBlockTableWriter(
+ POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS, documents,root);
BlockAllocationTableWriter bat = sbtw.getSBAT();
// 15 small blocks: 6 for doc340, 0 for doc5000 (too big), 0
Modified: poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestSmallDocumentBlock.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestSmallDocumentBlock.java?rev=937834&r1=937833&r2=937834&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestSmallDocumentBlock.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestSmallDocumentBlock.java Sun Apr 25 17:35:56 2010
@@ -24,6 +24,8 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import org.apache.poi.poifs.common.POIFSConstants;
+
import junit.framework.TestCase;
/**
@@ -55,7 +57,7 @@ public final class TestSmallDocumentBloc
while (true)
{
- DocumentBlock block = new DocumentBlock(stream);
+ DocumentBlock block = new DocumentBlock(stream,POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS);
documents.add(block);
if (block.partiallyRead())
@@ -65,7 +67,7 @@ public final class TestSmallDocumentBloc
}
SmallDocumentBlock[] results =
SmallDocumentBlock
- .convert(( BlockWritable [] ) documents
+ .convert(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS,( BlockWritable [] ) documents
.toArray(new DocumentBlock[ 0 ]), _testdata_size);
assertEquals("checking correct result size: ",
@@ -108,8 +110,8 @@ public final class TestSmallDocumentBloc
{
array[ k ] = ( byte ) k;
}
- SmallDocumentBlock[] blocks = SmallDocumentBlock.convert(array,
- 319);
+ SmallDocumentBlock[] blocks = SmallDocumentBlock.convert(
+ POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS, array, 319);
assertEquals(5, blocks.length);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
@@ -146,7 +148,7 @@ public final class TestSmallDocumentBloc
{
foo.add(new Object());
}
- int result = SmallDocumentBlock.fill(foo);
+ int result = SmallDocumentBlock.fill(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS,foo);
assertEquals("correct big block count: ", (j + 7) / 8, result);
assertEquals("correct small block count: ", 8 * result,
@@ -206,7 +208,7 @@ public final class TestSmallDocumentBloc
{
new RawDataBlock(new ByteArrayInputStream(data))
};
- List output = SmallDocumentBlock.extract(blocks);
+ List output = SmallDocumentBlock.extract(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS,blocks);
Iterator iter = output.iterator();
offset = 0;
Modified: poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestSmallDocumentBlockList.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestSmallDocumentBlockList.java?rev=937834&r1=937833&r2=937834&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestSmallDocumentBlockList.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/storage/TestSmallDocumentBlockList.java Sun Apr 25 17:35:56 2010
@@ -20,6 +20,8 @@ package org.apache.poi.poifs.storage;
import java.io.ByteArrayInputStream;
import java.io.IOException;
+import org.apache.poi.poifs.common.POIFSConstants;
+
import junit.framework.TestCase;
/**
@@ -44,7 +46,7 @@ public final class TestSmallDocumentBloc
blocks[ j ] = new RawDataBlock(stream);
}
SmallDocumentBlockList sdbl =
- new SmallDocumentBlockList(SmallDocumentBlock.extract(blocks));
+ new SmallDocumentBlockList(SmallDocumentBlock.extract(POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS,blocks));
// proof we added the blocks
for (int j = 0; j < 40; j++)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org