aboutsummaryrefslogtreecommitdiffstats
path: root/src/integrationtest
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2016-01-03 21:23:09 +0000
committerDominik Stadler <centic@apache.org>2016-01-03 21:23:09 +0000
commitf9850c1d73aa9a9d66b9bb275e7e21566d1e01fd (patch)
tree165233ed1e9d9317fdb8582fc0709ce0f39feaea /src/integrationtest
parent5068f2dfcb81a64da757e10d1e0c30eab0940e85 (diff)
downloadpoi-f9850c1d73aa9a9d66b9bb275e7e21566d1e01fd.tar.gz
poi-f9850c1d73aa9a9d66b9bb275e7e21566d1e01fd.zip
Try to reproduce bug 52258 and add more checks to integration tests
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1722755 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/integrationtest')
-rw-r--r--src/integrationtest/org/apache/poi/stress/HPSFFileHandler.java4
-rw-r--r--src/integrationtest/org/apache/poi/stress/POIFSFileHandler.java45
2 files changed, 45 insertions, 4 deletions
diff --git a/src/integrationtest/org/apache/poi/stress/HPSFFileHandler.java b/src/integrationtest/org/apache/poi/stress/HPSFFileHandler.java
index 6a53b2e009..6a84201b45 100644
--- a/src/integrationtest/org/apache/poi/stress/HPSFFileHandler.java
+++ b/src/integrationtest/org/apache/poi/stress/HPSFFileHandler.java
@@ -26,12 +26,14 @@ import org.apache.poi.hpsf.HPSFPropertiesOnlyDocument;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.junit.Test;
-public class HPSFFileHandler extends AbstractFileHandler {
+public class HPSFFileHandler extends POIFSFileHandler {
@Override
public void handleFile(InputStream stream) throws Exception {
HPSFPropertiesOnlyDocument hpsf = new HPSFPropertiesOnlyDocument(new POIFSFileSystem(stream));
assertNotNull(hpsf.getDocumentSummaryInformation());
assertNotNull(hpsf.getSummaryInformation());
+
+ handlePOIDocument(hpsf);
}
// a test-case to test this locally without executing the full TestAllFiles
diff --git a/src/integrationtest/org/apache/poi/stress/POIFSFileHandler.java b/src/integrationtest/org/apache/poi/stress/POIFSFileHandler.java
index 8c442ca8de..56be0d9eed 100644
--- a/src/integrationtest/org/apache/poi/stress/POIFSFileHandler.java
+++ b/src/integrationtest/org/apache/poi/stress/POIFSFileHandler.java
@@ -20,21 +20,45 @@ import static org.junit.Assert.assertNotNull;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
import java.io.InputStream;
import org.apache.poi.POIDocument;
+import org.apache.poi.hpsf.extractor.HPSFPropertiesExtractor;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.junit.Test;
public class POIFSFileHandler extends AbstractFileHandler {
@Override
public void handleFile(InputStream stream) throws Exception {
POIFSFileSystem fs = new POIFSFileSystem(stream);
- handlePOIFSFileSystem(fs);
- fs.close();
+ try {
+ handlePOIFSFileSystem(fs);
+ handleHPSFProperties(fs);
+ } finally {
+ fs.close();
+ }
}
- private void handlePOIFSFileSystem(POIFSFileSystem fs) {
+ private void handleHPSFProperties(POIFSFileSystem fs) throws IOException {
+ HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(fs);
+ try {
+ // can be null
+ ext.getDocSummaryInformation();
+ ext.getSummaryInformation();
+
+ assertNotNull(ext.getDocumentSummaryInformationText());
+ assertNotNull(ext.getSummaryInformationText());
+ assertNotNull(ext.getText());
+ } finally {
+ ext.close();
+ }
+ }
+
+ private void handlePOIFSFileSystem(POIFSFileSystem fs) {
assertNotNull(fs);
assertNotNull(fs.getRoot());
}
@@ -48,4 +72,19 @@ public class POIFSFileHandler extends AbstractFileHandler {
handlePOIFSFileSystem(fs);
fs.close();
}
+
+ // a test-case to test this locally without executing the full TestAllFiles
+ @Test
+ public void test() throws Exception {
+ File file = new File("test-data/poifs/Notes.ole2");
+
+ InputStream stream = new FileInputStream(file);
+ try {
+ handleFile(stream);
+ } finally {
+ stream.close();
+ }
+
+ //handleExtracting(file);
+ }
}