aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2010-12-28 08:52:50 +0000
committerNick Burch <nick@apache.org>2010-12-28 08:52:50 +0000
commitc50b30528157abc95fe479ac40756a2230167d46 (patch)
tree912a0f62dbd53ccedb8450e1e1e945e6e4439e8c /src/testcases
parentbfcc46192c84b6a3310a79787c40530abf1f613d (diff)
downloadpoi-c50b30528157abc95fe479ac40756a2230167d46.tar.gz
poi-c50b30528157abc95fe479ac40756a2230167d46.zip
Implement a NPOIFS document reader, and add tests which use it
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1053279 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases')
-rw-r--r--src/testcases/org/apache/poi/poifs/filesystem/TestNPOIFSFileSystem.java23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/testcases/org/apache/poi/poifs/filesystem/TestNPOIFSFileSystem.java b/src/testcases/org/apache/poi/poifs/filesystem/TestNPOIFSFileSystem.java
index 17e2694d00..2848c8be26 100644
--- a/src/testcases/org/apache/poi/poifs/filesystem/TestNPOIFSFileSystem.java
+++ b/src/testcases/org/apache/poi/poifs/filesystem/TestNPOIFSFileSystem.java
@@ -23,6 +23,10 @@ import java.util.Iterator;
import junit.framework.TestCase;
import org.apache.poi.POIDataSamples;
+import org.apache.poi.hpsf.DocumentSummaryInformation;
+import org.apache.poi.hpsf.PropertySet;
+import org.apache.poi.hpsf.PropertySetFactory;
+import org.apache.poi.hpsf.SummaryInformation;
import org.apache.poi.poifs.common.POIFSConstants;
import org.apache.poi.poifs.property.NPropertyTable;
import org.apache.poi.poifs.property.Property;
@@ -446,12 +450,25 @@ public final class TestNPOIFSFileSystem extends TestCase {
NPOIFSFileSystem fsD = new NPOIFSFileSystem(_inst.openResourceAsStream("BlockSize4096.zvi"));
for(NPOIFSFileSystem fs : new NPOIFSFileSystem[] {fsA,fsB,fsC,fsD}) {
DirectoryEntry root = fs.getRoot();
- Entry dsi = root.getEntry("\u0005DocumentSummaryInformation");
+ Entry si = root.getEntry("\u0005SummaryInformation");
+
+ assertEquals(true, si.isDocumentEntry());
+ DocumentNode doc = (DocumentNode)si;
- assertEquals(true, dsi.isDocumentEntry());
- DocumentEntry doc = (DocumentEntry)dsi;
+ // Check we can read it
+ NDocumentInputStream inp = new NDocumentInputStream(doc);
+ byte[] contents = new byte[doc.getSize()];
+ assertEquals(doc.getSize(), inp.read(contents));
+ // Now try to build the property set
+ inp = new NDocumentInputStream(doc);
+ PropertySet ps = PropertySetFactory.create(inp);
+ SummaryInformation inf = (SummaryInformation)ps;
+ // Check some bits in it
+ assertEquals(null, inf.getApplicationName());
+ assertEquals(null, inf.getAuthor());
+ assertEquals(null, inf.getSubject());
}
}