poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cen...@apache.org
Subject svn commit: r1662712 - in /poi/trunk/src: scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractor.java testcases/org/apache/poi/hpsf/extractor/TestHPSFPropertiesExtractor.java
Date Fri, 27 Feb 2015 15:01:46 GMT
Author: centic
Date: Fri Feb 27 15:01:46 2015
New Revision: 1662712

URL: http://svn.apache.org/r1662712
Log:
Move test-case to location where the scratchpad-classes are available

Modified:
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractor.java
    poi/trunk/src/testcases/org/apache/poi/hpsf/extractor/TestHPSFPropertiesExtractor.java

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractor.java?rev=1662712&r1=1662711&r2=1662712&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractor.java
(original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractor.java
Fri Feb 27 15:01:46 2015
@@ -20,6 +20,7 @@ package org.apache.poi.hwpf.extractor;
 import junit.framework.TestCase;
 
 import org.apache.poi.POIDataSamples;
+import org.apache.poi.POITextExtractor;
 import org.apache.poi.hwpf.HWPFDocument;
 import org.apache.poi.hwpf.HWPFTestDataSamples;
 import org.apache.poi.hwpf.OldWordFileFormatException;
@@ -377,10 +378,35 @@ public final class TestWordExtractor ext
         for (Entry entry : fs.getRoot()) {
             if ("WordDocument".equals(entry.getName())) {
                 WordExtractor ex = new WordExtractor(fs);
-                text = ex.getText();
+                try {
+                    text = ex.getText();
+                } finally {
+                    ex.close();
+                }
             }
         }
 
         assertNotNull(text);
     }
+
+
+    public void testExtractorFromWord6Extractor() throws Exception {
+        POIFSFileSystem fs = new POIFSFileSystem(POIDataSamples.getHPSFInstance().openResourceAsStream("TestMickey.doc"));
+        Word6Extractor wExt = new Word6Extractor(fs);
+        try {
+            POITextExtractor ext = wExt.getMetadataTextExtractor();
+            try {
+                // Now overall
+                String text = ext.getText();
+                assertTrue(text.indexOf("TEMPLATE = Normal") > -1);
+                assertTrue(text.indexOf("SUBJECT = sample subject") > -1);
+                assertTrue(text.indexOf("MANAGER = sample manager") > -1);
+                assertTrue(text.indexOf("COMPANY = sample company") > -1);
+            } finally {
+                ext.close();
+            }
+        } finally {
+            wExt.close();
+        }
+    }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/hpsf/extractor/TestHPSFPropertiesExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hpsf/extractor/TestHPSFPropertiesExtractor.java?rev=1662712&r1=1662711&r2=1662712&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hpsf/extractor/TestHPSFPropertiesExtractor.java
(original)
+++ poi/trunk/src/testcases/org/apache/poi/hpsf/extractor/TestHPSFPropertiesExtractor.java
Fri Feb 27 15:01:46 2015
@@ -22,12 +22,10 @@ import java.io.IOException;
 import junit.framework.TestCase;
 
 import org.apache.poi.POIDataSamples;
-import org.apache.poi.POITextExtractor;
 import org.apache.poi.hpsf.Thumbnail;
 import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.hssf.extractor.ExcelExtractor;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.apache.poi.hwpf.extractor.Word6Extractor;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 
 public final class TestHPSFPropertiesExtractor extends TestCase {
@@ -168,24 +166,4 @@ public final class TestHPSFPropertiesExt
         assertNotNull(thumbnail.getThumbnailAsWMF());
         wb.close();
     }
-
-    public void testExtractorFromWord6Extractor() throws Exception {
-        POIFSFileSystem fs = new POIFSFileSystem(_samples.openResourceAsStream("TestMickey.doc"));
-        Word6Extractor wExt = new Word6Extractor(fs);
-        try {
-            POITextExtractor ext = wExt.getMetadataTextExtractor();
-            try {
-                // Now overall
-                String text = ext.getText();
-                assertTrue(text.indexOf("TEMPLATE = Normal") > -1);
-                assertTrue(text.indexOf("SUBJECT = sample subject") > -1);
-                assertTrue(text.indexOf("MANAGER = sample manager") > -1);
-                assertTrue(text.indexOf("COMPANY = sample company") > -1);
-            } finally {
-                ext.close();
-            }
-        } finally {
-            wExt.close();
-        }
-    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message