You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ye...@apache.org on 2009/08/23 14:34:42 UTC

svn commit: r806959 [2/4] - in /poi/trunk: ./ src/documentation/content/xdocs/ src/ooxml/testcases/org/apache/poi/ src/ooxml/testcases/org/apache/poi/extractor/ src/ooxml/testcases/org/apache/poi/ooxml/data/ src/ooxml/testcases/org/apache/poi/openxml4j...

Modified: poi/trunk/build.xml
URL: http://svn.apache.org/viewvc/poi/trunk/build.xml?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/build.xml (original)
+++ poi/trunk/build.xml Sun Aug 23 12:34:24 2009
@@ -76,6 +76,7 @@
   <property name="main.lib" location="lib"/>
   <property name="ooxml.lib" location="ooxml-lib"/>
   <property name="main.reports.test" location="build/test-results"/>
+  <property name="poi.test.dir" location="test-data"/>
 
   <property name="main.commons-logging.jar" location="${main.lib}/commons-logging-1.1.jar"/>
   <property name="main.commons-logging.url" value="${repository.m2}/maven2/commons-logging/commons-logging/1.1/commons-logging-1.1.jar"/>
@@ -566,12 +567,7 @@
       <classpath refid="test.classpath"/>
       <sysproperty key="user.language" value="en"/> 
       <sysproperty key="user.country" value="US"/> 
-      <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/> 
-      <sysproperty key="HSLF.testdata.path" file="${main.src.test}/org/apache/poi/hslf/data"/> 
-      <sysproperty key="HWPF.testdata.path" file="${main.src.test}/org/apache/poi/hwpf/data"/> 
-      <sysproperty key="HPSF.testdata.path" file="${main.src.test}/org/apache/poi/hpsf/data"/> 
-      <sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/> 
-      <sysproperty key="DDF.testdata.path" file="${main.src.test}/org/apache/poi/ddf/data"/> 
+      <sysproperty key="POI.testdata.path" file="${poi.test.dir}"/> 
       <sysproperty key="java.awt.headless" value="true"/>
       <formatter type="plain"/>
       <formatter type="xml"/>
@@ -602,10 +598,7 @@
       </classpath>
       <sysproperty key="user.language" value="en"/> 
       <sysproperty key="user.country" value="US"/> 
-      <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
-      <sysproperty key="HPSF.testdata.path" file="${main.src.test}/org/apache/poi/hpsf/data"/>
-      <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
-      <sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/> 
+      <sysproperty key="POI.testdata.path" file="${poi.test.dir}"/> 
       <sysproperty key="java.awt.headless" value="true"/>
       <formatter type="plain" usefile="no"/>
       <batchtest todir="${main.reports.test}">
@@ -631,16 +624,8 @@
             </classpath>
             <sysproperty key="user.language" value="en"/> 
             <sysproperty key="user.country" value="US"/> 
-            <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
-            <sysproperty key="HPSF.testdata.path" file="${main.src.test}/org/apache/poi/hpsf/data"/>
-            <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
-            <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
-            <sysproperty key="HSMF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hsmf/data"/>
-            <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
-            <sysproperty key="HPBF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hpbf/data"/>
-            <sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/> 
-            <sysproperty key="OOXML.testdata.path" file="${ooxml.src.test}/org/apache/poi/ooxml/data"/> 
-                <sysproperty key="java.awt.headless" value="true"/>
+            <sysproperty key="POI.testdata.path" file="${poi.test.dir}"/> 
+            <sysproperty key="java.awt.headless" value="true"/>
             <formatter type="plain" usefile="no"/>
             <formatter type="xml"/>
             <test name="${testcase}"/>
@@ -675,15 +660,7 @@
             </classpath>
             <sysproperty key="user.language" value="en"/> 
             <sysproperty key="user.country" value="US"/> 
-            <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
-            <sysproperty key="HPSF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hpsf/data"/>
-            <sysproperty key="HDF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdf/data"/>
-            <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
-            <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
-            <sysproperty key="HSMF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hsmf/data"/>
-            <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
-            <sysproperty key="HPBF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hpbf/data"/>
-            <sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/> 
+            <sysproperty key="POI.testdata.path" file="${poi.test.dir}"/> 
             <sysproperty key="java.awt.headless" value="true"/>
             <formatter type="plain"/>
             <formatter type="xml"/>
@@ -714,14 +691,7 @@
 	        </classpath>
               <sysproperty key="user.language" value="en"/> 
               <sysproperty key="user.country" value="US"/> 
-              <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
-	            <sysproperty key="HPSF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hpsf/data"/>
-	            <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
-              <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
-              <sysproperty key="HSMF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hsmf/data"/>
-              <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
-              <sysproperty key="HPBF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hpbf/data"/>
-              <sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/> 
+              <sysproperty key="POI.testdata.path" file="${poi.test.dir}"/> 
 	            <sysproperty key="java.awt.headless" value="true"/>
 	            <sysproperty key="java.awt.headless" value="true"/>
 	            <formatter type="plain" usefile="no"/>
@@ -748,8 +718,6 @@
             </classpath>
             <sysproperty key="user.language" value="en"/> 
             <sysproperty key="user.country" value="US"/> 
-            <sysproperty key="HSSF.testdata.path" file="${contrib.src.test}/org/apache/poi/hssf/data"/>
-            <sysproperty key="HPSF.testdata.path" file="${contrib.src.test}/org/apache/poi/hpsf/data"/>
             <sysproperty key="java.awt.headless" value="true"/>
             <formatter type="plain"/>
             <formatter type="xml"/>
@@ -780,14 +748,7 @@
             <classpath refid="test.ooxml.classpath" />
             <sysproperty key="user.language" value="en"/> 
             <sysproperty key="user.country" value="US"/> 
-            <sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/>
-            <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
-            <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
-            <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
-            <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
-            <sysproperty key="OOXML.testdata.path" file="${ooxml.src.test}/org/apache/poi/ooxml/data"/> 
-            <sysproperty key="openxml4j.compliance.input" file="${ooxml.src.test}/org/apache/poi/openxml4j/opc/compliance/data"/> 
-            <sysproperty key="openxml4j.testdata.input" file="${ooxml.src.test}/org/apache/poi/openxml4j/opc/data"/> 
+            <sysproperty key="POI.testdata.path" file="${poi.test.dir}"/> 
             <sysproperty key="java.awt.headless" value="true"/>
             <formatter type="plain"/>
             <formatter type="xml"/>
@@ -811,12 +772,7 @@
             <classpath refid="test.ooxml.classpath" />
             <sysproperty key="user.language" value="en"/> 
             <sysproperty key="user.country" value="US"/> 
-            <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
-            <sysproperty key="HPSF.testdata.path" file="${main.src.test}/org/apache/poi/hpsf/data"/>
-            <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
-            <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
-            <sysproperty key="HSMF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hsmf/data"/>
-            <sysproperty key="HDGF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hdgf/data"/>
+            <sysproperty key="POI.testdata.path" file="${poi.test.dir}"/> 
             <sysproperty key="java.awt.headless" value="true"/>
             <formatter type="plain" usefile="no"/>
             <formatter type="xml"/>

Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Sun Aug 23 12:34:24 2009
@@ -33,6 +33,7 @@
 
     <changes>
         <release version="3.5-beta7" date="2009-??-??">
+           <action dev="POI-DEVELOPERS" type="fix">moved all test data to a top-level directory</action>
            <action dev="POI-DEVELOPERS" type="add">47721 - Added implementation for INDIRECT()</action>
            <action dev="POI-DEVELOPERS" type="add">45583 - Avoid exception when reading ClipboardData packet in OLE property sets</action>
            <action dev="POI-DEVELOPERS" type="add">47652 - Added support for reading encrypted workbooks</action>

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/TestEmbeded.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/TestEmbeded.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/TestEmbeded.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/TestEmbeded.java Sun Aug 23 12:34:24 2009
@@ -36,34 +36,24 @@
  */
 public class TestEmbeded extends TestCase
 {
-	public String dirname;
-
-	public void setUp() {
-		dirname = System.getProperty("OOXML.testdata.path");
-		assertNotNull(dirname);
-	}
-
 	public void testExcel() throws Exception {
-		File f = new File(dirname, "ExcelWithAttachments.xlsm");
-		assertTrue(f.exists());
-		
-		POIXMLDocument doc = new XSSFWorkbook(OPCPackage.open(f.toString()));
+		POIXMLDocument doc = new XSSFWorkbook(
+                POIDataSamples.getSpreadSheetInstance().openResourceAsStream("ExcelWithAttachments.xlsm")
+        );
 		test(doc, 4);
 	}
 
 	public void testWord() throws Exception {
-		File f = new File(dirname, "WordWithAttachments.docx");
-		assertTrue(f.exists());
-		
-		POIXMLDocument doc = new XWPFDocument(OPCPackage.open(f.toString()));
+		POIXMLDocument doc = new XWPFDocument(
+                POIDataSamples.getDocumentInstance().openResourceAsStream("WordWithAttachments.docx")
+        );
 		test(doc, 5);
 	}
 
 	public void testPowerPoint() throws Exception {
-		File f = new File(dirname, "PPTWithAttachments.pptm");
-		assertTrue(f.exists());
-		
-		POIXMLDocument doc = new XSLFSlideShow(OPCPackage.open(f.toString()));
+		POIXMLDocument doc = new XSLFSlideShow(OPCPackage.open(
+                POIDataSamples.getSlideShowInstance().openResourceAsStream("PPTWithAttachments.pptm"))
+        );
 		test(doc, 4);
 	}
 	

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/TestPOIXMLDocument.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/TestPOIXMLDocument.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/TestPOIXMLDocument.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/TestPOIXMLDocument.java Sun Aug 23 12:34:24 2009
@@ -30,11 +30,13 @@
 import org.apache.poi.openxml4j.opc.PackagePart;
 import org.apache.poi.openxml4j.opc.PackageRelationship;
 import org.apache.poi.util.TempFile;
+import org.apache.poi.util.PackageHelper;
 
 /**
  * Test recursive read and write of OPC packages
  */
 public final class TestPOIXMLDocument extends TestCase {
+
     private static class OPCParser extends POIXMLDocument {
 
         public OPCParser(OPCPackage pkg) {
@@ -81,9 +83,8 @@
         }
     }
 
-    public void assertReadWrite(String path) throws Exception {
+    public void assertReadWrite(OPCPackage pkg1) throws Exception {
 
-        OPCPackage pkg1 = OPCPackage.open(path);
         OPCParser doc = new OPCParser(pkg1);
         doc.parse(new TestFactory());
 
@@ -124,17 +125,20 @@
     }
 
     public void testPPTX() throws Exception {
-        File file = new File(System.getProperty("OOXML.testdata.path"), "PPTWithAttachments.pptm");
-        assertReadWrite(file.getAbsolutePath());
+        assertReadWrite(
+                PackageHelper.open(POIDataSamples.getSlideShowInstance().openResourceAsStream("PPTWithAttachments.pptm"))
+        );
     }
 
     public void testXLSX() throws Exception {
-        File file = new File(System.getProperty("OOXML.testdata.path"), "ExcelWithAttachments.xlsm");
-        assertReadWrite(file.getAbsolutePath());
+        assertReadWrite(
+                PackageHelper.open(POIDataSamples.getSpreadSheetInstance().openResourceAsStream("ExcelWithAttachments.xlsm"))
+                );
     }
 
     public void testDOCX() throws Exception {
-        File file = new File(System.getProperty("OOXML.testdata.path"), "WordWithAttachments.docx");
-        assertReadWrite(file.getAbsolutePath());
+        assertReadWrite(
+                PackageHelper.open(POIDataSamples.getDocumentInstance().openResourceAsStream("WordWithAttachments.docx"))
+                );
     }
 }

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/TestXMLPropertiesTextExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/TestXMLPropertiesTextExtractor.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/TestXMLPropertiesTextExtractor.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/TestXMLPropertiesTextExtractor.java Sun Aug 23 12:34:24 2009
@@ -21,21 +21,16 @@
 import org.apache.poi.xssf.extractor.XSSFExcelExtractor;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.apache.poi.openxml4j.opc.OPCPackage;
+import org.apache.poi.util.PackageHelper;
 
 import junit.framework.TestCase;
 
 public final class TestXMLPropertiesTextExtractor extends TestCase {
-	private String dirname;
-
-	protected void setUp() {
-		dirname = System.getProperty("OOXML.testdata.path");
-		assertTrue( (new File(dirname)).exists() );
-	}
+    private static final POIDataSamples _ssSamples = POIDataSamples.getSpreadSheetInstance();
 
 	public void testGetFromMainExtractor() throws Exception {
-		OPCPackage pkg = OPCPackage.open(
-				(new File(dirname, "ExcelWithAttachments.xlsm")).toString()
-		);
+		OPCPackage pkg = PackageHelper.open(_ssSamples.openResourceAsStream("ExcelWithAttachments.xlsm"));
+
 		XSSFWorkbook wb = new XSSFWorkbook(pkg);
 
 		XSSFExcelExtractor ext = new XSSFExcelExtractor(wb);
@@ -54,8 +49,8 @@
 	}
 
 	public void testCore() throws Exception {
-		OPCPackage pkg = OPCPackage.open(
-				(new File(dirname, "ExcelWithAttachments.xlsm")).toString()
+		OPCPackage pkg = PackageHelper.open(
+                _ssSamples.openResourceAsStream("ExcelWithAttachments.xlsm")
 		);
 		XSSFWorkbook wb = new XSSFWorkbook(pkg);
 
@@ -72,7 +67,7 @@
 
 	public void testExtended() throws Exception {
 		OPCPackage pkg = OPCPackage.open(
-				(new File(dirname, "ExcelWithAttachments.xlsm")).toString()
+                _ssSamples.openResourceAsStream("ExcelWithAttachments.xlsm")
 		);
 		XSSFWorkbook wb = new XSSFWorkbook(pkg);
 

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java Sun Aug 23 12:34:24 2009
@@ -22,10 +22,13 @@
 
 import org.apache.poi.POIOLE2TextExtractor;
 import org.apache.poi.POITextExtractor;
+import org.apache.poi.POIDataSamples;
 import org.apache.poi.hdgf.extractor.VisioTextExtractor;
 import org.apache.poi.hslf.extractor.PowerPointExtractor;
 import org.apache.poi.hssf.extractor.ExcelExtractor;
+import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.hwpf.extractor.WordExtractor;
+import org.apache.poi.hwpf.HWPFTestDataSamples;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.xslf.extractor.XSLFPowerPointExtractor;
 import org.apache.poi.xssf.extractor.XSSFExcelExtractor;
@@ -40,21 +43,18 @@
  * Test that the extractor factory plays nicely
  */
 public class TestExtractorFactory extends TestCase {
-	private String excel_dir;
-	private String word_dir;
-	private String powerpoint_dir;
-	private String visio_dir;
-	private String poifs_dir;
-	
+
 	private File txt;
 	
 	private File xls;
 	private File xlsx;
-        private File xltx;
+    private File xltx;
+    private File xlsEmb;
 
 	private File doc;
 	private File docx;
-        private File dotx;
+    private File dotx;
+    private File docEmb;
 
 	private File ppt;
 	private File pptx;
@@ -64,31 +64,25 @@
 	protected void setUp() throws Exception {
 		super.setUp();
 		
-		excel_dir = System.getProperty("HSSF.testdata.path");
-		word_dir = System.getProperty("HWPF.testdata.path");
-		powerpoint_dir = System.getProperty("HSLF.testdata.path");
-		visio_dir = System.getProperty("HDGF.testdata.path");
-		poifs_dir = System.getProperty("POIFS.testdata.path");
-		assertNotNull(excel_dir);
-		assertNotNull(word_dir);
-		assertNotNull(powerpoint_dir);
-		assertNotNull(visio_dir);
-		assertNotNull(poifs_dir);
-		
-		txt = new File(powerpoint_dir, "SampleShow.txt");
-		
-		xls = new File(excel_dir, "SampleSS.xls");
-		xlsx = new File(excel_dir, "SampleSS.xlsx");
-                xltx = new File(excel_dir, "test.xltx");
-
-		doc = new File(word_dir, "SampleDoc.doc");
-		docx = new File(word_dir, "SampleDoc.docx");
-        dotx = new File(word_dir, "test.dotx");
+        POIDataSamples ssTests = POIDataSamples.getSpreadSheetInstance();
+        xls = ssTests.getFile("SampleSS.xls");
+		xlsx = ssTests.getFile("SampleSS.xlsx");
+        xltx = ssTests.getFile("test.xltx");
+        xlsEmb = ssTests.getFile("excel_with_embeded.xls");
+
+        POIDataSamples wpTests = POIDataSamples.getDocumentInstance();
+		doc = wpTests.getFile("SampleDoc.doc");
+		docx = wpTests.getFile("SampleDoc.docx");
+        dotx = wpTests.getFile("test.dotx");
+        docEmb = wpTests.getFile("word_with_embeded.doc");
+
+        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
+		ppt = slTests.getFile("SampleShow.ppt");
+		pptx = slTests.getFile("SampleShow.pptx");
+        txt = slTests.getFile("SampleShow.txt");
 
-		ppt = new File(powerpoint_dir, "SampleShow.ppt");
-		pptx = new File(powerpoint_dir, "SampleShow.pptx");
-		
-		vsd = new File(visio_dir, "Test_Visio-Some_Random_Text.vsd");
+        POIDataSamples dgTests = POIDataSamples.getDiagramInstance();
+		vsd = dgTests.getFile("Test_Visio-Some_Random_Text.vsd");
 	}
 
 	public void testFile() throws Exception {
@@ -339,8 +333,7 @@
 	public void testEmbeded() throws Exception {
 		POIOLE2TextExtractor ext;
 		POITextExtractor[] embeds;
-		File f;
-		
+
 		// No embedings
 		ext = (POIOLE2TextExtractor)
 				ExtractorFactory.createExtractor(xls);
@@ -348,9 +341,8 @@
 		assertEquals(0, embeds.length);
 		
 		// Excel
-		f = new File(poifs_dir, "excel_with_embeded.xls");
 		ext = (POIOLE2TextExtractor)
-				ExtractorFactory.createExtractor(f);
+				ExtractorFactory.createExtractor(xlsEmb);
 		embeds = ExtractorFactory.getEmbededDocsTextExtractors(ext);
 
 		assertEquals(6, embeds.length);
@@ -367,9 +359,8 @@
         assertEquals(2, numWord);
 
         // Word
-		f = new File(poifs_dir, "word_with_embeded.doc");
 		ext = (POIOLE2TextExtractor)
-				ExtractorFactory.createExtractor(f);
+				ExtractorFactory.createExtractor(docEmb);
 		embeds = ExtractorFactory.getEmbededDocsTextExtractors(ext);
 		
         numWord = 0; numXls = 0; numPpt = 0;

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/OpenXML4JTestDataSamples.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/OpenXML4JTestDataSamples.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/OpenXML4JTestDataSamples.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/OpenXML4JTestDataSamples.java Sun Aug 23 12:34:24 2009
@@ -17,6 +17,9 @@
 
 package org.apache.poi.openxml4j;
 
+import org.apache.poi.POIDataSamples;
+import org.apache.poi.util.TempFile;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
@@ -28,121 +31,31 @@
  * @author jmicich
  */
 public final class OpenXML4JTestDataSamples {
-
-	private static final String IN_DIR_PROP_NAME = "openxml4j.testdata.input";
-	private static final String COMP_IN_DIR_PROP_NAME = "openxml4j.compliance.input";
-	
-	private static File _sampleInputDir;
-	private static File _sampleOutputDir;
-	private static File _complianceSampleInputDir;
+    private static final POIDataSamples _samples = POIDataSamples.getOpenXML4JInstance();
 
 	private OpenXML4JTestDataSamples() {
 		// no instances of this class
 	}
-	
+
 	public static InputStream openSampleStream(String sampleFileName) {
-		File f = getSampleFile(sampleFileName);
-		try {
-			return new FileInputStream(f);
-		} catch (FileNotFoundException e) {
-			throw new RuntimeException(e);
-		}
+		return _samples.openResourceAsStream(sampleFileName);
 	}
 	public static String getSampleFileName(String sampleFileName) {
-		// TODO - investigate allowing read/write access for package opened on stream
 		return getSampleFile(sampleFileName).getAbsolutePath();
 	}
 	
 	public static File getSampleFile(String sampleFileName) {
-		File dir = getSampleInputDir();
-		File f = new File(dir, sampleFileName);
-		if (!f.exists()) {
-			throw new RuntimeException("Specified sample file '" 
-					+ f.getAbsolutePath() + "' does not exist");
-		}
-		if (f.isDirectory()) {
-			throw new RuntimeException("Specified sample file '" 
-					+ f.getAbsolutePath() + "' is a directory");
-		}
-		return f;
+		return _samples.getFile(sampleFileName);
 	}
 	
 	public static File getOutputFile(String outputFileName) {
-		File dir = getSampleOutputDir();
-		return new File(dir, outputFileName);
+        String suffix = outputFileName.substring(outputFileName.lastIndexOf('.'));
+        return TempFile.createTempFile(outputFileName, suffix);
 	}
 
 
 	public static InputStream openComplianceSampleStream(String sampleFileName) {
-		File f = getComplianceSampleFile(sampleFileName);
-		try {
-			return new FileInputStream(f);
-		} catch (FileNotFoundException e) {
-			throw new RuntimeException(e);
-		}
-	}
-	private static File getComplianceSampleFile(String sampleFileName) {
-		File dir = getComplianceSampleInputDir();
-		File f = new File(dir, sampleFileName);
-		if (!f.exists()) {
-			throw new RuntimeException("Specified sample file '" 
-					+ f.getAbsolutePath() + "' does not exist");
-		}
-		if (f.isDirectory()) {
-			throw new RuntimeException("Specified sample file '" 
-					+ f.getAbsolutePath() + "' is a directory");
-		}
-		return f;
-	}
-	public static String getComplianceSampleFileName(String sampleFileName) {
-		return getComplianceSampleFile(sampleFileName).getAbsolutePath();
-	}
-	private static File getComplianceSampleInputDir() {
-		if (_complianceSampleInputDir == null) {
-			_complianceSampleInputDir = getAndCheckDirByProperty(COMP_IN_DIR_PROP_NAME);
-		}
-		return _complianceSampleInputDir;
-	}
-
-	
-	private static File getSampleInputDir() {
-		if (_sampleInputDir == null) {
-			_sampleInputDir = getAndCheckDirByProperty(IN_DIR_PROP_NAME);
-		}
-		return _sampleInputDir;
-	}
-
-	private static File getAndCheckDirByProperty(String propName) {
-		String dirName = System.getProperty(propName);
-		File dir = new File(dirName);
-		if (!dir.exists()) {
-			throw new RuntimeException("Specified '" + propName + "' directory: '"
-					+ dirName + "' does not exist");
-		}
-		if (!dir.isDirectory()) {
-			throw new RuntimeException("Specified '" + propName + "' directory: '"
-					+ dirName + "' is a not a proper directory");
-		}
-		return dir;
-	}
-
-	private static File getSampleOutputDir() {
-		if (_sampleOutputDir == null) {
-            File dir = new File(System.getProperty("java.io.tmpdir"), "poifiles");
-			if (dir.exists()) {
-    			if (!dir.isDirectory()) {
-    				throw new RuntimeException("Specified output directory: '"
-    						+ dir.getAbsolutePath() + "' is a not a proper directory");
-    			}
-			} else {
-				if (!dir.mkdirs()) {
-					throw new RuntimeException("Failed to create directory: '"
-							+ dir.getAbsolutePath() + "'");
-				}
-			}
-			_sampleOutputDir = dir;
-		}
-		return _sampleOutputDir;
+        return _samples.openResourceAsStream(sampleFileName);
 	}
 
 }

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/compliance/TestOPCComplianceCoreProperties.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/compliance/TestOPCComplianceCoreProperties.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/compliance/TestOPCComplianceCoreProperties.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/compliance/TestOPCComplianceCoreProperties.java Sun Aug 23 12:34:24 2009
@@ -33,6 +33,7 @@
 import org.apache.poi.openxml4j.opc.PackageRelationshipTypes;
 import org.apache.poi.openxml4j.opc.PackagingURIHelper;
 import org.apache.poi.openxml4j.opc.TargetMode;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Test core properties Open Packaging Convention compliance.
@@ -144,11 +145,11 @@
 	 * Test M4.1 rule.
 	 */
 	public void testOnlyOneCorePropertiesPart_AddPart() {
-		String sampleFileName = OpenXML4JTestDataSamples.getComplianceSampleFileName("OPCCompliance_CoreProperties_OnlyOneCorePropertiesPart.docx");
+		String sampleFileName = "OPCCompliance_CoreProperties_OnlyOneCorePropertiesPart.docx";
 		OPCPackage pkg = null;
 		try {
-			pkg = OPCPackage.open(sampleFileName);
-		} catch (InvalidFormatException e) {
+			pkg = OPCPackage.open(POIDataSamples.getOpenXML4JInstance().getFile(sampleFileName).getPath());
+		} catch (Exception e) {
 			throw new RuntimeException(e);
 		}
 		

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/compliance/TestOPCCompliancePackageModel.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/compliance/TestOPCCompliancePackageModel.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/compliance/TestOPCCompliancePackageModel.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/compliance/TestOPCCompliancePackageModel.java Sun Aug 23 12:34:24 2009
@@ -18,6 +18,7 @@
 package org.apache.poi.openxml4j.opc.compliance;
 
 import java.io.File;
+import java.io.IOException;
 
 import junit.framework.TestCase;
 
@@ -29,6 +30,7 @@
 import org.apache.poi.openxml4j.opc.PackageRelationshipTypes;
 import org.apache.poi.openxml4j.opc.PackagingURIHelper;
 import org.apache.poi.openxml4j.opc.TargetMode;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Test Open Packaging Convention package model compliance.
@@ -70,11 +72,10 @@
 	 * part name derived from another part name by appending segments to it.
 	 * [M1.11]
 	 */
-	public void testPartNameDerivationReadingFailure() {
-		String filepath = System.getProperty("openxml4j.compliance.input")
-				+ File.separator + "OPCCompliance_DerivedPartNameFAIL.docx";
+	public void testPartNameDerivationReadingFailure() throws IOException {
+		String filename = "OPCCompliance_DerivedPartNameFAIL.docx";
 		try {
-			OPCPackage.open(filepath);
+			OPCPackage.open(POIDataSamples.getOpenXML4JInstance().openResourceAsStream(filename));
 		} catch (InvalidFormatException e) {
 			return;
 		}

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFSlideShow.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFSlideShow.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFSlideShow.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFSlideShow.java Sun Aug 23 12:34:24 2009
@@ -16,31 +16,23 @@
 ==================================================================== */
 package org.apache.poi.xslf;
 
-import java.io.File;
-
 import junit.framework.TestCase;
 
-import org.apache.poi.POIXMLDocument;
+import org.apache.poi.POIDataSamples;
 import org.apache.poi.openxml4j.opc.OPCPackage;
 import org.apache.poi.openxml4j.opc.PackagePart;
 import org.openxmlformats.schemas.presentationml.x2006.main.CTSlideIdListEntry;
 import org.openxmlformats.schemas.presentationml.x2006.main.CTSlideMasterIdListEntry;
 
 public class TestXSLFSlideShow extends TestCase {
-	private String sampleFile;
+    private static final POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
+    private OPCPackage pack;
 
-	protected void setUp() throws Exception {
-		super.setUp();
-		
-		sampleFile = new File(
-				System.getProperty("HSLF.testdata.path") +
-				File.separator + "sample.pptx"
-		).toString();
+    protected void setUp() throws Exception {
+		pack = OPCPackage.open(slTests.openResourceAsStream("sample.pptx"));
 	}
 
 	public void testContainsMainContentType() throws Exception {
-		OPCPackage pack = POIXMLDocument.openPackage(sampleFile);
-		
 		boolean found = false;
 		for(PackagePart part : pack.getParts()) {
 			if(part.getContentType().equals(XSLFSlideShow.MAIN_CONTENT_TYPE)) {
@@ -52,15 +44,11 @@
 	}
 
 	public void testOpen() throws Exception {
-		POIXMLDocument.openPackage(sampleFile);
-		
+
 		XSLFSlideShow xml;
 		
 		// With the finalised uri, should be fine
-		xml = new XSLFSlideShow(
-				POIXMLDocument.openPackage(sampleFile)
-		);
-		
+		xml = new XSLFSlideShow(pack);
 		// Check the core
 		assertNotNull(xml.getPresentation());
 		
@@ -74,7 +62,7 @@
 	}
 	
 	public void testSlideBasics() throws Exception {
-		XSLFSlideShow xml = new XSLFSlideShow(sampleFile);
+		XSLFSlideShow xml = new XSLFSlideShow(pack);
 		
 		// Should have 1 master
 		assertEquals(1, xml.getSlideMasterReferences().sizeOfSldMasterIdArray());
@@ -108,7 +96,7 @@
 	}
 	
 	public void testMetadataBasics() throws Exception {
-		XSLFSlideShow xml = new XSLFSlideShow(sampleFile);
+		XSLFSlideShow xml = new XSLFSlideShow(pack);
 		
 		assertNotNull(xml.getProperties().getCoreProperties());
 		assertNotNull(xml.getProperties().getExtendedProperties());

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/extractor/TestXSLFPowerPointExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/extractor/TestXSLFPowerPointExtractor.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/extractor/TestXSLFPowerPointExtractor.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/extractor/TestXSLFPowerPointExtractor.java Sun Aug 23 12:34:24 2009
@@ -16,9 +16,8 @@
 ==================================================================== */
 package org.apache.poi.xslf.extractor;
 
-import java.io.File;
-
-import org.apache.poi.POIXMLDocument;
+import org.apache.poi.POIDataSamples;
+import org.apache.poi.openxml4j.opc.OPCPackage;
 import org.apache.poi.xslf.XSLFSlideShow;
 
 import junit.framework.TestCase;
@@ -31,18 +30,12 @@
 	 * A simple file
 	 */
 	private XSLFSlideShow xmlA;
-	private File fileA;
+	private OPCPackage pkg;
 
 	protected void setUp() throws Exception {
-		super.setUp();
-		
-		fileA = new File(
-				System.getProperty("HSLF.testdata.path") +
-				File.separator + "sample.pptx"
-		);
-		assertTrue(fileA.exists());
-		
-		xmlA = new XSLFSlideShow(fileA.toString());
+        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
+		pkg = OPCPackage.open(slTests.openResourceAsStream("sample.pptx"));
+		xmlA = new XSLFSlideShow(pkg);
 	}
 
 	/**
@@ -50,8 +43,7 @@
 	 */
 	public void testGetSimpleText() throws Exception {
 		new XSLFPowerPointExtractor(xmlA);
-		new XSLFPowerPointExtractor(
-				POIXMLDocument.openPackage(fileA.toString()));
+		new XSLFPowerPointExtractor(pkg);
 		
 		XSLFPowerPointExtractor extractor = 
 			new XSLFPowerPointExtractor(xmlA);
@@ -110,13 +102,8 @@
 	}
 	
 	public void testGetComments() throws Exception {
-		File file = new File(
-				System.getProperty("HSLF.testdata.path") +
-				File.separator + "45545_Comment.pptx"
-		);
-		assertTrue(file.exists());
-		
-		xmlA = new XSLFSlideShow(file.toString());
+        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
+		xmlA = new XSLFSlideShow(OPCPackage.open(slTests.openResourceAsStream("45545_Comment.pptx")));
 		XSLFPowerPointExtractor extractor = 
 			new XSLFPowerPointExtractor(xmlA);
 		

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/XSSFITestDataProvider.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/XSSFITestDataProvider.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/XSSFITestDataProvider.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/XSSFITestDataProvider.java Sun Aug 23 12:34:24 2009
@@ -22,6 +22,7 @@
 import org.apache.poi.ss.usermodel.Workbook;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.apache.poi.hssf.HSSFTestDataSamples;
+import org.apache.poi.POIDataSamples;
 
 /**
  * @author Yegor Kozlov
@@ -45,7 +46,7 @@
     }
 
     public byte[] getTestDataFileContent(String fileName) {
-        return HSSFTestDataSamples.getTestDataFileContent(fileName);
+        return POIDataSamples.getSpreadSheetInstance().readFile(fileName);
     }
 
     public SpreadsheetVersion getSpreadsheetVersion(){

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/XSSFTestDataSamples.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/XSSFTestDataSamples.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/XSSFTestDataSamples.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/XSSFTestDataSamples.java Sun Aug 23 12:34:24 2009
@@ -38,15 +38,8 @@
  * @author Josh Micich
  */
 public class XSSFTestDataSamples {
-    
-    public static InputStream openSampleFileStream(String sampleFileName) {
-        return HSSFTestDataSamples.openSampleFileStream(sampleFileName);
-    }
-    public static byte[] getTestDataFileContent(String fileName) {
-        return HSSFTestDataSamples.getTestDataFileContent(fileName);
-    }
 
-	public static final XSSFWorkbook openSampleWorkbook(String sampleName) {
+	public static XSSFWorkbook openSampleWorkbook(String sampleName) {
 		InputStream is = HSSFTestDataSamples.openSampleFileStream(sampleName);
 		try {
 			return new XSSFWorkbook(is);
@@ -57,24 +50,17 @@
     public static <R extends Workbook> R writeOutAndReadBack(R wb) {
     	Workbook result;
 		try {
+            ByteArrayOutputStream baos = new ByteArrayOutputStream(8192);
+            wb.write(baos);
+            InputStream is = new ByteArrayInputStream(baos.toByteArray());
 	    	if (wb instanceof HSSFWorkbook) {
-                ByteArrayOutputStream baos = new ByteArrayOutputStream(8192);
-                wb.write(baos);
-                InputStream is = new ByteArrayInputStream(baos.toByteArray());
 	    		result = new HSSFWorkbook(is);
 	    	} else if (wb instanceof XSSFWorkbook) {
-                File tmp = TempFile.createTempFile("poi-ooxml-", ".xlsx");
-                FileOutputStream out = new FileOutputStream(tmp);
-                wb.write(out);
-                out.close();
-                OPCPackage pkg = OPCPackage.open(tmp.getAbsolutePath());
-    			result = new XSSFWorkbook(pkg);
+    			result = new XSSFWorkbook(is);
 	    	} else {
-	    		throw new RuntimeException("Unexpected workbook type (" 
+	    		throw new RuntimeException("Unexpected workbook type ("
 	    				+ wb.getClass().getName() + ")");
 	    	}
-		} catch (InvalidFormatException e) {
-			throw new RuntimeException(e);
 		} catch (IOException e) {
 			throw new RuntimeException(e);
 		}

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/eventusermodel/TestXSSFReader.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/eventusermodel/TestXSSFReader.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/eventusermodel/TestXSSFReader.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/eventusermodel/TestXSSFReader.java Sun Aug 23 12:34:24 2009
@@ -26,14 +26,16 @@
 import org.apache.poi.util.IOUtils;
 import org.apache.poi.xssf.XSSFTestDataSamples;
 import org.apache.poi.xssf.usermodel.XSSFRichTextString;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Tests for {@link XSSFReader}
  */
 public final class TestXSSFReader extends TestCase {
+    private static POIDataSamples _ssTests = POIDataSamples.getSpreadSheetInstance();
 
-	public void testGetBits() throws Exception {
-		OPCPackage pkg = OPCPackage.open(XSSFTestDataSamples.openSampleFileStream("SampleSS.xlsx"));
+    public void testGetBits() throws Exception {
+		OPCPackage pkg = OPCPackage.open(_ssTests.openResourceAsStream("SampleSS.xlsx"));
 
 		XSSFReader r = new XSSFReader(pkg);
 
@@ -46,7 +48,7 @@
 	}
 
 	public void testStyles() throws Exception {
-		OPCPackage pkg = OPCPackage.open(XSSFTestDataSamples.openSampleFileStream("SampleSS.xlsx"));
+		OPCPackage pkg = OPCPackage.open(_ssTests.openResourceAsStream("SampleSS.xlsx"));
 
 		XSSFReader r = new XSSFReader(pkg);
 
@@ -55,7 +57,7 @@
 	}
 
 	public void testStrings() throws Exception {
-        OPCPackage pkg = OPCPackage.open(XSSFTestDataSamples.openSampleFileStream("SampleSS.xlsx"));
+        OPCPackage pkg = OPCPackage.open(_ssTests.openResourceAsStream("SampleSS.xlsx"));
 
 		XSSFReader r = new XSSFReader(pkg);
 
@@ -64,7 +66,7 @@
 	}
 
 	public void testSheets() throws Exception {
-        OPCPackage pkg = OPCPackage.open(XSSFTestDataSamples.openSampleFileStream("SampleSS.xlsx"));
+        OPCPackage pkg = OPCPackage.open(_ssTests.openResourceAsStream("SampleSS.xlsx"));
 
 		XSSFReader r = new XSSFReader(pkg);
 		byte[] data = new byte[4096];
@@ -96,7 +98,7 @@
 	 * (as they are defined in the workbook.xml)
 	 */
 	public void testOrderOfSheets() throws Exception {
-        OPCPackage pkg = OPCPackage.open(XSSFTestDataSamples.openSampleFileStream("reordered_sheets.xlsx"));
+        OPCPackage pkg = OPCPackage.open(_ssTests.openResourceAsStream("reordered_sheets.xlsx"));
 
 		XSSFReader r = new XSSFReader(pkg);
 

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/io/TestLoadSaveXSSF.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/io/TestLoadSaveXSSF.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/io/TestLoadSaveXSSF.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/io/TestLoadSaveXSSF.java Sun Aug 23 12:34:24 2009
@@ -28,23 +28,15 @@
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.apache.poi.xssf.usermodel.XSSFPictureData;
+import org.apache.poi.xssf.XSSFITestDataProvider;
+import org.apache.poi.POIDataSamples;
 
 
 public class TestLoadSaveXSSF extends TestCase {
-
-    String filename;
-
-    protected void setUp() {
-
-        System.setProperty("org.apache.poi.util.POILogger", org.apache.poi.util.CommonsLogger.class.getName());
-        filename = System.getProperty("XSSF.testdata.path");
-        if (filename == null) {
-            filename = "src/ooxml/testcases/org/apache/poi/xssf/data";
-        }
-    }
+    private static final POIDataSamples _ssSampels = POIDataSamples.getSpreadSheetInstance();
 
     public void testLoadSample() throws Exception {
-        XSSFWorkbook workbook = new XSSFWorkbook(new File(filename, "sample.xlsx").getAbsolutePath());
+        XSSFWorkbook workbook = new XSSFWorkbook(_ssSampels.openResourceAsStream("sample.xlsx"));
         assertEquals(3, workbook.getNumberOfSheets());
         assertEquals("Sheet1", workbook.getSheetName(0));
         Sheet sheet = workbook.getSheetAt(0);
@@ -58,7 +50,7 @@
 
     // TODO filename string hard coded in XSSFWorkbook constructor in order to make ant test-ooxml target be successful.
     public void testLoadStyles() throws Exception {
-        XSSFWorkbook workbook = new XSSFWorkbook(new File(filename, "styles.xlsx").getAbsolutePath());
+        XSSFWorkbook workbook = new XSSFWorkbook(_ssSampels.openResourceAsStream("styles.xlsx"));
         Sheet sheet = workbook.getSheetAt(0);
         Row row = sheet.getRow(0);
         Cell cell = row.getCell((short) 0);
@@ -68,7 +60,7 @@
 
     // TODO filename string hard coded in XSSFWorkbook constructor in order to make ant test-ooxml target be successful.
     public void testLoadPictures() throws Exception {
-        XSSFWorkbook workbook = new XSSFWorkbook(new File(filename, "picture.xlsx").getAbsolutePath());
+        XSSFWorkbook workbook = new XSSFWorkbook(_ssSampels.openResourceAsStream("picture.xlsx"));
         List<XSSFPictureData> pictures = workbook.getAllPictures();
         assertEquals(1, pictures.size());
     }

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/XWPFTestDataSamples.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/XWPFTestDataSamples.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/XWPFTestDataSamples.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/XWPFTestDataSamples.java Sun Aug 23 12:34:24 2009
@@ -28,7 +28,7 @@
 public class XWPFTestDataSamples {
 
     public static XWPFDocument openSampleDocument(String sampleName) {
-        InputStream is = HWPFTestDataSamples.openSampleFileStream(sampleName);
+        InputStream is = POIDataSamples.getDocumentInstance().openResourceAsStream(sampleName);
         try {
             return new XWPFDocument(is);
         } catch (IOException e) {
@@ -46,9 +46,4 @@
             throw new RuntimeException(e);
         }
     }
-
-    public static POIDataSamples getInstance(){
-        return HWPFTestDataSamples.getInstance();
-    }
-
 }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/TestPOIDocumentScratchpad.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/TestPOIDocumentScratchpad.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/TestPOIDocumentScratchpad.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/TestPOIDocumentScratchpad.java Sun Aug 23 12:34:24 2009
@@ -25,7 +25,7 @@
 import java.io.*;
 
 import org.apache.poi.hslf.HSLFSlideShow;
-import org.apache.poi.hwpf.HWPFDocument;
+import org.apache.poi.hwpf.HWPFTestDataSamples;
 import org.apache.poi.poifs.filesystem.*;
 
 /**
@@ -41,29 +41,15 @@
 	// The POI Documents to work on
 	private POIDocument doc;
 	private POIDocument doc2;
-	// POIFS primed on the test (powerpoint and word) data
-	private POIFSFileSystem pfs;
-	private POIFSFileSystem pfs2;
 
 	/**
 	 * Set things up, using a PowerPoint document and
 	 *  a Word Document for our testing
 	 */
 	public void setUp() throws Exception {
-		String dirnameHSLF = System.getProperty("HSLF.testdata.path");
-		String filenameHSLF = dirnameHSLF + "/basic_test_ppt_file.ppt";
-		String dirnameHSSF = System.getProperty("HSSF.testdata.path");
-		String filenameHSSF = dirnameHSLF + "/DateFormats.ppt";
-		String dirnameHWPF = System.getProperty("HWPF.testdata.path");
-		String filenameHWPF = dirnameHWPF + "/test2.doc";
-
-		FileInputStream fisHSLF = new FileInputStream(filenameHSLF);
-		pfs = new POIFSFileSystem(fisHSLF);
-		doc = new HSLFSlideShow(pfs);
-
-		FileInputStream fisHWPF = new FileInputStream(filenameHWPF);
-		pfs2 = new POIFSFileSystem(fisHWPF);
-		doc2 = new HWPFDocument(pfs2);
+		doc = new HSLFSlideShow(POIDataSamples.getSlideShowInstance().openResourceAsStream("basic_test_ppt_file.ppt"));
+
+		doc2 = HWPFTestDataSamples.openSampleFile("test2.doc");
 	}
 
 	public void testReadProperties() {

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hdf/model/TestHDFDocument.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hdf/model/TestHDFDocument.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hdf/model/TestHDFDocument.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hdf/model/TestHDFDocument.java Sun Aug 23 12:34:24 2009
@@ -23,6 +23,7 @@
 import java.io.InputStream;
 
 import junit.framework.TestCase;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Class to test {@link HDFDocument} functionality
@@ -30,19 +31,12 @@
  * @author Bob Otterberg
  */
 public final class TestHDFDocument extends TestCase {
+    private static final POIDataSamples _samples = POIDataSamples.getDocumentInstance();
+
     public void testStopJUnitComplainintAboutNoTests() {
         // TODO - fix these junits
     }
 
-    private static InputStream openSample(String sampleFileName) {
-        String fullPathName = System.getProperty("HDF.testdata.path") + "/" + sampleFileName;
-        try {
-            return new FileInputStream(System.getProperty("HDF.testdata.path"));
-        } catch (FileNotFoundException e) {
-            throw new RuntimeException("Sample HDF file '" + fullPathName + "' was not found.");
-        }
-    }
-
     /**
      * OBJECTIVE:  Test that HDF can read an empty document (empty.doc).<P>
      * SUCCESS:    HDF reads the document.  Matches values in their particular positions.<P>
@@ -50,7 +44,7 @@
      *             in the document in their known positions.<P>
      */
     public void fixme_testEmpty() throws IOException {
-        InputStream stream = openSample("empty.doc");
+        InputStream stream = _samples.openResourceAsStream("empty.doc");
         new HDFDocument(stream);
     }
 
@@ -61,7 +55,7 @@
      *             in the document in their known positions.<P>
      */
     public void fixme_testSimple() throws IOException {
-        InputStream stream = openSample("simple.doc");
+        InputStream stream = _samples.openResourceAsStream("simple.doc");
         new HDFDocument(stream);
     }
 
@@ -73,7 +67,7 @@
      *
      */
     public void fixme_testSimpleList() throws IOException {
-        InputStream stream = openSample("simple-list.doc");
+        InputStream stream = _samples.openResourceAsStream("simple-list.doc");
         new HDFDocument(stream);
     }
 
@@ -84,7 +78,7 @@
      *             in the document in their known positions.<P>
      */
     public void fixme_testSimpleTable() throws IOException {
-        InputStream stream = openSample("simple-table.doc");
+        InputStream stream = _samples.openResourceAsStream("simple-table.doc");
         new HDFDocument(stream);
     }
 }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFCore.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFCore.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFCore.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/TestHDGFCore.java Sun Aug 23 12:34:24 2009
@@ -22,18 +22,17 @@
 import org.apache.poi.hdgf.streams.PointerContainingStream;
 import org.apache.poi.hdgf.streams.TrailerStream;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.POIDataSamples;
 
 import junit.framework.TestCase;
 
 public final class TestHDGFCore extends TestCase {
+    private static POIDataSamples _dgTests = POIDataSamples.getDiagramInstance();
+
 	private POIFSFileSystem fs;
-	private String dirname;
-	private String filename;
 
 	protected void setUp() throws Exception {
-		dirname = System.getProperty("HDGF.testdata.path");
-		filename = dirname + "/Test_Visio-Some_Random_Text.vsd";
-		fs = new POIFSFileSystem(new FileInputStream(filename));
+		fs = new POIFSFileSystem(_dgTests.openResourceAsStream("Test_Visio-Some_Random_Text.vsd"));
 	}
 
 	public void testCreate() throws Exception {
@@ -68,8 +67,7 @@
 	 *  appears to have a negative chunk length
 	 */
 	public void DISABLEDtestNegativeChunkLength() throws Exception {
-		filename = dirname + "/NegativeChunkLength.vsd";
-		fs = new POIFSFileSystem(new FileInputStream(filename));
+		fs = new POIFSFileSystem(_dgTests.openResourceAsStream("NegativeChunkLength.vsd"));
 
 		HDGFDiagram hdgf = new HDGFDiagram(fs);
 		assertNotNull(hdgf);

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/extractor/TestVisioExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/extractor/TestVisioExtractor.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/extractor/TestVisioExtractor.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/extractor/TestVisioExtractor.java Sun Aug 23 12:34:24 2009
@@ -19,20 +19,20 @@
 
 import java.io.ByteArrayOutputStream;
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.PrintStream;
 
 import junit.framework.TestCase;
 
 import org.apache.poi.hdgf.HDGFDiagram;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.POIDataSamples;
 
 public final class TestVisioExtractor extends TestCase {
-	private String dirname;
+    private static POIDataSamples _dgTests = POIDataSamples.getDiagramInstance();
+
 	private String defFilename;
 	protected void setUp() {
-		dirname = System.getProperty("HDGF.testdata.path");
-		defFilename = dirname + "/Test_Visio-Some_Random_Text.vsd";
+		defFilename = "Test_Visio-Some_Random_Text.vsd";
 	}
 
 	/**
@@ -41,14 +41,14 @@
 	public void testCreation() throws Exception {
 		VisioTextExtractor extractor;
 
-		extractor = new VisioTextExtractor(new FileInputStream(defFilename));
+		extractor = new VisioTextExtractor(_dgTests.openResourceAsStream(defFilename));
 		assertNotNull(extractor);
 		assertNotNull(extractor.getAllText());
 		assertEquals(3, extractor.getAllText().length);
 
 		extractor = new VisioTextExtractor(
 				new POIFSFileSystem(
-						new FileInputStream(defFilename)
+						_dgTests.openResourceAsStream(defFilename)
 				)
 		);
 		assertNotNull(extractor);
@@ -58,7 +58,7 @@
 		extractor = new VisioTextExtractor(
 			new HDGFDiagram(
 				new POIFSFileSystem(
-						new FileInputStream(defFilename)
+						_dgTests.openResourceAsStream(defFilename)
 				)
 			)
 		);
@@ -69,7 +69,7 @@
 
 	public void testExtraction() throws Exception {
 		VisioTextExtractor extractor =
-			new VisioTextExtractor(new FileInputStream(defFilename));
+			new VisioTextExtractor(_dgTests.openResourceAsStream(defFilename));
 
 		// Check the array fetch
 		String[] text = extractor.getAllText();
@@ -86,20 +86,11 @@
 	}
 
 	public void testProblemFiles() throws Exception {
-		File a = new File(dirname, "44594.vsd");
-		VisioTextExtractor.main(new String[] {a.toString()});
-
-		File b = new File(dirname, "44594-2.vsd");
-		VisioTextExtractor.main(new String[] {b.toString()});
-
-		File c = new File(dirname, "ShortChunk1.vsd");
-		VisioTextExtractor.main(new String[] {c.toString()});
-
-		File d = new File(dirname, "ShortChunk2.vsd");
-		VisioTextExtractor.main(new String[] {d.toString()});
-
-		File e = new File(dirname, "ShortChunk3.vsd");
-		VisioTextExtractor.main(new String[] {e.toString()});
+		String[] files = {"44594.vsd", "44594-2.vsd", "ShortChunk1.vsd", "ShortChunk2.vsd", "ShortChunk3.vsd"};
+        for(String file : files){
+            VisioTextExtractor ex = new VisioTextExtractor(_dgTests.openResourceAsStream(file));
+            ex.getText();
+        }
 	}
 
 	public void testMain() throws Exception {
@@ -108,7 +99,8 @@
 		PrintStream capture = new PrintStream(baos);
 		System.setOut(capture);
 
-		VisioTextExtractor.main(new String[] {defFilename});
+        String path = _dgTests.getFile(defFilename).getPath();
+        VisioTextExtractor.main(new String[] {path});
 
 		// Put things back
 		System.setOut(oldOut);

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBugs.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBugs.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamBugs.java Sun Aug 23 12:34:24 2009
@@ -18,6 +18,7 @@
 package org.apache.poi.hdgf.streams;
 
 import java.io.FileInputStream;
+import java.io.InputStream;
 
 import org.apache.poi.hdgf.HDGFDiagram;
 import org.apache.poi.hdgf.chunks.ChunkFactory;
@@ -25,6 +26,7 @@
 import org.apache.poi.hdgf.pointers.PointerFactory;
 import org.apache.poi.poifs.filesystem.DocumentEntry;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Tests for bugs with streams
@@ -36,13 +38,11 @@
 	private POIFSFileSystem filesystem;
 
 	protected void setUp() throws Exception {
-		String dirname = System.getProperty("HDGF.testdata.path");
-		String filename = dirname + "/44594.vsd";
 		ptrFactory = new PointerFactory(11);
 		chunkFactory = new ChunkFactory(11);
 
-		FileInputStream fin = new FileInputStream(filename);
-		filesystem = new POIFSFileSystem(fin);
+        InputStream is = POIDataSamples.getDiagramInstance().openResourceAsStream("44594.vsd");
+        filesystem = new POIFSFileSystem(is);
 
 		DocumentEntry docProps =
 			(DocumentEntry)filesystem.getRoot().getEntry("VisioDocument");

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamComplex.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamComplex.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamComplex.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/TestStreamComplex.java Sun Aug 23 12:34:24 2009
@@ -18,6 +18,7 @@
 package org.apache.poi.hdgf.streams;
 
 import java.io.FileInputStream;
+import java.io.InputStream;
 
 import org.apache.poi.hdgf.chunks.Chunk;
 import org.apache.poi.hdgf.chunks.ChunkFactory;
@@ -25,6 +26,7 @@
 import org.apache.poi.hdgf.pointers.PointerFactory;
 import org.apache.poi.poifs.filesystem.DocumentEntry;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.POIDataSamples;
 
 public final class TestStreamComplex extends StreamTest {
 	private byte[] contents;
@@ -34,13 +36,11 @@
 	private PointerFactory ptrFactory;
 
 	protected void setUp() throws Exception {
-		String dirname = System.getProperty("HDGF.testdata.path");
-		String filename = dirname + "/Test_Visio-Some_Random_Text.vsd";
 		ptrFactory = new PointerFactory(11);
 		chunkFactory = new ChunkFactory(11);
 
-		FileInputStream fin = new FileInputStream(filename);
-		POIFSFileSystem filesystem = new POIFSFileSystem(fin);
+        InputStream is = POIDataSamples.getDiagramInstance().openResourceAsStream("Test_Visio-Some_Random_Text.vsd");
+		POIFSFileSystem filesystem = new POIFSFileSystem(is);
 
 		DocumentEntry docProps =
 			(DocumentEntry)filesystem.getRoot().getEntry("VisioDocument");

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/TestHPBFDocument.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/TestHPBFDocument.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/TestHPBFDocument.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/TestHPBFDocument.java Sun Aug 23 12:34:24 2009
@@ -21,27 +21,22 @@
 import java.io.FileInputStream;
 
 import junit.framework.TestCase;
+import org.apache.poi.POIDataSamples;
 
 public final class TestHPBFDocument extends TestCase {
-	private String dir;
-
-	protected void setUp() {
-		dir = System.getProperty("HPBF.testdata.path");
-	}
+    private static final POIDataSamples _samples = POIDataSamples.getPublisherInstance();
 
 	public void testOpen() throws Exception {
-		File f = new File(dir, "Sample.pub");
 		HPBFDocument doc = new HPBFDocument(
-				new FileInputStream(f)
+                _samples.openResourceAsStream("Sample.pub")
 		);
 
 		assertNotNull(doc);
 	}
 
 	public void testBits() throws Exception {
-		File f = new File(dir, "Sample.pub");
 		HPBFDocument doc = new HPBFDocument(
-				new FileInputStream(f)
+                _samples.openResourceAsStream("Sample.pub")
 		);
 
 		assertNotNull(doc.getMainContents());

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/extractor/TextPublisherTextExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/extractor/TextPublisherTextExtractor.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/extractor/TextPublisherTextExtractor.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/extractor/TextPublisherTextExtractor.java Sun Aug 23 12:34:24 2009
@@ -21,37 +21,31 @@
 import java.io.FileInputStream;
 
 import org.apache.poi.hpbf.HPBFDocument;
+import org.apache.poi.POIDataSamples;
 
 import junit.framework.TestCase;
 
 public final class TextPublisherTextExtractor extends TestCase {
-	private String dir;
-
-	protected void setUp() {
-		dir = System.getProperty("HPBF.testdata.path");
-	}
+    private static final POIDataSamples _samples = POIDataSamples.getPublisherInstance();
 
 	public void testBasics() throws Exception {
-		File f = new File(dir, "Sample.pub");
 		HPBFDocument doc = new HPBFDocument(
-				new FileInputStream(f)
+				_samples.openResourceAsStream("Sample.pub")
 		);
 
 		PublisherTextExtractor ext =
 			new PublisherTextExtractor(doc);
 		ext.getText();
 
-		f = new File(dir, "Simple.pub");
 		ext = new PublisherTextExtractor(
-				new FileInputStream(f)
+                _samples.openResourceAsStream("Simple.pub")
 		);
 		ext.getText();
 	}
 
 	public void testContents() throws Exception {
-		File f = new File(dir, "Sample.pub");
 		HPBFDocument doc = new HPBFDocument(
-				new FileInputStream(f)
+                _samples.openResourceAsStream("Sample.pub")
 		);
 
 		PublisherTextExtractor ext =
@@ -87,9 +81,8 @@
 		);
 
 		// Now a simpler one
-		f = new File(dir, "Simple.pub");
 		ext = new PublisherTextExtractor(
-				new FileInputStream(f)
+                _samples.openResourceAsStream("Simple.pub")
 		);
 		text = ext.getText();
 		assertEquals(
@@ -113,21 +106,18 @@
 		File f;
 		HPBFDocument doc;
 
-		f = new File(dir, "Sample.pub");
 		doc = new HPBFDocument(
-				new FileInputStream(f)
+                _samples.openResourceAsStream("Sample.pub")
 		);
 		String s2007 = (new PublisherTextExtractor(doc)).getText();
 
-		f = new File(dir, "Sample2000.pub");
 		doc = new HPBFDocument(
-				new FileInputStream(f)
+                _samples.openResourceAsStream("Sample2000.pub")
 		);
 		String s2000 = (new PublisherTextExtractor(doc)).getText();
 
-		f = new File(dir, "Sample98.pub");
 		doc = new HPBFDocument(
-				new FileInputStream(f)
+                _samples.openResourceAsStream("Sample98.pub")
 		);
 		String s98 = (new PublisherTextExtractor(doc)).getText();
 
@@ -141,9 +131,8 @@
 	 *  as we can hope it to.
 	 */
 	public void testWithHyperlinks() throws Exception {
-		File f = new File(dir, "LinkAt10.pub");
 		HPBFDocument doc = new HPBFDocument(
-				new FileInputStream(f)
+                _samples.openResourceAsStream("LinkAt10.pub")
 		);
 
 		PublisherTextExtractor ext =
@@ -159,8 +148,9 @@
 
 
 		// Now a much more complex document
-		f = new File(dir, "Sample.pub");
-		ext = new PublisherTextExtractor(new FileInputStream(f));
+		ext = new PublisherTextExtractor(
+                _samples.openResourceAsStream("Sample.pub")
+        );
 		ext.setHyperlinksByDefault(true);
 		String text = ext.getText();
 

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestEscherParts.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestEscherParts.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestEscherParts.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestEscherParts.java Sun Aug 23 12:34:24 2009
@@ -21,20 +21,16 @@
 import java.io.FileInputStream;
 
 import org.apache.poi.hpbf.HPBFDocument;
+import org.apache.poi.POIDataSamples;
 
 import junit.framework.TestCase;
 
 public final class TestEscherParts extends TestCase {
-	private String dir;
-
-	protected void setUp() {
-		dir = System.getProperty("HPBF.testdata.path");
-	}
+    private static final POIDataSamples _samples = POIDataSamples.getPublisherInstance();
 
 	public void testBasics() throws Exception {
-		File f = new File(dir, "Sample.pub");
 		HPBFDocument doc = new HPBFDocument(
-				new FileInputStream(f)
+		    _samples.openResourceAsStream("Sample.pub")
 		);
 
 		EscherStm es = doc.getEscherStm();
@@ -50,9 +46,8 @@
 	}
 
 	public void testComplex() throws Exception {
-		File f = new File(dir, "SampleBrochure.pub");
 		HPBFDocument doc = new HPBFDocument(
-				new FileInputStream(f)
+                _samples.openResourceAsStream("SampleBrochure.pub")
 		);
 
 		EscherStm es = doc.getEscherStm();
@@ -68,9 +63,8 @@
 
 
 		// Now do another complex file
-		f = new File(dir, "SampleNewsletter.pub");
 		doc = new HPBFDocument(
-				new FileInputStream(f)
+                _samples.openResourceAsStream("SampleNewsletter.pub")
 		);
 
 		es = doc.getEscherStm();

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestQuillContents.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestQuillContents.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestQuillContents.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestQuillContents.java Sun Aug 23 12:34:24 2009
@@ -17,29 +17,22 @@
 
 package org.apache.poi.hpbf.model;
 
-import java.io.File;
-import java.io.FileInputStream;
-
 import org.apache.poi.hpbf.HPBFDocument;
 import org.apache.poi.hpbf.model.qcbits.QCTextBit;
 import org.apache.poi.hpbf.model.qcbits.QCPLCBit.Type12;
 import org.apache.poi.hpbf.model.qcbits.QCPLCBit.Type0;
 import org.apache.poi.hpbf.model.qcbits.QCPLCBit.Type4;
 import org.apache.poi.hpbf.model.qcbits.QCPLCBit.Type8;
+import org.apache.poi.POIDataSamples;
 
 import junit.framework.TestCase;
 
 public final class TestQuillContents extends TestCase {
-	private String dir;
-
-	protected void setUp() {
-		dir = System.getProperty("HPBF.testdata.path");
-	}
+    private static final POIDataSamples _samples = POIDataSamples.getPublisherInstance();
 
 	public void testBasics() throws Exception {
-		File f = new File(dir, "Sample.pub");
 		HPBFDocument doc = new HPBFDocument(
-				new FileInputStream(f)
+		    _samples.openResourceAsStream("Sample.pub")
 		);
 
 		QuillContents qc = doc.getQuillContents();
@@ -69,9 +62,8 @@
 	}
 
 	public void testText() throws Exception {
-		File f = new File(dir, "Sample.pub");
 		HPBFDocument doc = new HPBFDocument(
-				new FileInputStream(f)
+                _samples.openResourceAsStream("Sample.pub")
 		);
 
 		QuillContents qc = doc.getQuillContents();
@@ -84,9 +76,8 @@
 	}
 
 	public void testPLC() throws Exception {
-		File f = new File(dir, "Simple.pub");
 		HPBFDocument doc = new HPBFDocument(
-				new FileInputStream(f)
+                _samples.openResourceAsStream("Simple.pub")
 		);
 
 		QuillContents qc = doc.getQuillContents();
@@ -145,9 +136,8 @@
 	}
 
 	public void testComplexPLC() throws Exception {
-		File f = new File(dir, "Sample.pub");
 		HPBFDocument doc = new HPBFDocument(
-				new FileInputStream(f)
+                _samples.openResourceAsStream("Sample.pub")
 		);
 
 		QuillContents qc = doc.getQuillContents();
@@ -247,9 +237,8 @@
 	}
 
 	public void testNoHyperlinks() throws Exception {
-		File f = new File(dir, "SampleNewsletter.pub");
 		HPBFDocument doc = new HPBFDocument(
-				new FileInputStream(f)
+                _samples.openResourceAsStream("SampleNewsletter.pub")
 		);
 
 		QuillContents qc = doc.getQuillContents();
@@ -264,15 +253,13 @@
 	}
 
 	public void testSimpleHyperlink() throws Exception {
-		File f;
 		HPBFDocument doc;
 		QuillContents qc;
 		Type12 hlBit;
 
 		// Link at 10
-		f = new File(dir, "LinkAt10.pub");
 		doc = new HPBFDocument(
-				new FileInputStream(f)
+                _samples.openResourceAsStream("LinkAt10.pub")
 		);
 		qc = doc.getQuillContents();
 
@@ -285,9 +272,8 @@
 		assertEquals("http://poi.apache.org/", hlBit.getHyperlink(0));
 
 		// Longer link at 10
-		f = new File(dir, "LinkAt10Longer.pub");
 		doc = new HPBFDocument(
-				new FileInputStream(f)
+                _samples.openResourceAsStream("LinkAt10Longer.pub")
 		);
 		qc = doc.getQuillContents();
 
@@ -300,9 +286,8 @@
 		assertEquals("http://poi.apache.org/hpbf/", hlBit.getHyperlink(0));
 
 		// Link at 20
-		f = new File(dir, "LinkAt20.pub");
 		doc = new HPBFDocument(
-				new FileInputStream(f)
+                _samples.openResourceAsStream("LinkAt20.pub")
 		);
 		qc = doc.getQuillContents();
 
@@ -316,15 +301,13 @@
 	}
 
 	public void testManyHyperlinks() throws Exception {
-		File f;
 		HPBFDocument doc;
 		QuillContents qc;
 		Type12 hlBit;
 
 		// Link at 10
-		f = new File(dir, "LinkAt10.pub");
 		doc = new HPBFDocument(
-				new FileInputStream(f)
+                _samples.openResourceAsStream("LinkAt10.pub")
 		);
 		qc = doc.getQuillContents();
 
@@ -339,16 +322,14 @@
 	}
 
 	public void testHyperlinkDifferentVersions() throws Exception {
-		File f;
 		HPBFDocument doc;
 		QuillContents qc;
 		Type12 hlBitA;
 		Type12 hlBitB;
 
 		// Latest version
-		f = new File(dir, "Sample.pub");
 		doc = new HPBFDocument(
-				new FileInputStream(f)
+                _samples.openResourceAsStream("Sample.pub")
 		);
 		qc = doc.getQuillContents();
 
@@ -375,9 +356,8 @@
 		assertEquals("mailto:dev@poi.apache.org?subject=HPBF", hlBitB.getHyperlink(2));
 
 		// 2000 version
-		f = new File(dir, "Sample2000.pub");
 		doc = new HPBFDocument(
-				new FileInputStream(f)
+                _samples.openResourceAsStream("Sample2000.pub")
 		);
 		qc = doc.getQuillContents();
 
@@ -404,9 +384,8 @@
 		assertEquals("mailto:dev@poi.apache.org?subject=HPBF", hlBitB.getHyperlink(2));
 
 		// 98 version
-		f = new File(dir, "Sample98.pub");
 		doc = new HPBFDocument(
-				new FileInputStream(f)
+                _samples.openResourceAsStream("Sample98.pub")
 		);
 		qc = doc.getQuillContents();
 

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestEncryptedFile.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestEncryptedFile.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestEncryptedFile.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestEncryptedFile.java Sun Aug 23 12:34:24 2009
@@ -21,6 +21,7 @@
 import junit.framework.TestCase;
 
 import org.apache.poi.hslf.exceptions.EncryptedPowerPointFileException;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Tests that HSLFSlideShow does the right thing with an encrypted file
@@ -28,48 +29,31 @@
  * @author Nick Burch (nick at torchbox dot com)
  */
 public final class TestEncryptedFile extends TestCase {
-	// A non encrypted file
-	private String ss_ne;
-	// An encrypted file, with encrypted properties
-	private String ss_e;
-	// An encrypted file, without encrypted properties
-	private String ss_np_e;
-	// An encrypted file, with a 56 bit key
-	private String ss_56_e;
-
-
-	public TestEncryptedFile() {
-		String dirname = System.getProperty("HSLF.testdata.path");
-
-		ss_ne = dirname + "/basic_test_ppt_file.ppt";
-		ss_e = dirname + "/Password_Protected-hello.ppt";
-		ss_np_e = dirname + "/Password_Protected-np-hello.ppt";
-		ss_56_e = dirname + "/Password_Protected-56-hello.ppt";
-	}
+    private static POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
 
 	public void testLoadNonEncrypted() throws Exception {
-		HSLFSlideShow hss = new HSLFSlideShow(ss_ne);
+		HSLFSlideShow hss = new HSLFSlideShow(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
 
 		assertNotNull(hss);
 	}
 
 	public void testLoadEncrypted() throws Exception {
 		try {
-			new HSLFSlideShow(ss_e);
+            new HSLFSlideShow(slTests.openResourceAsStream("Password_Protected-hello.ppt"));
 			fail();
 		} catch(EncryptedPowerPointFileException e) {
 			// Good
 		}
 
 		try {
-			new HSLFSlideShow(ss_np_e);
+            new HSLFSlideShow(slTests.openResourceAsStream("Password_Protected-np-hello.ppt"));
 			fail();
 		} catch(EncryptedPowerPointFileException e) {
 			// Good
 		}
 
 		try {
-			new HSLFSlideShow(ss_56_e);
+            new HSLFSlideShow(slTests.openResourceAsStream("Password_Protected-56-hello.ppt"));
 			fail();
 		} catch(EncryptedPowerPointFileException e) {
 			// Good

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestReWrite.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestReWrite.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestReWrite.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestReWrite.java Sun Aug 23 12:34:24 2009
@@ -19,10 +19,14 @@
 
 
 import junit.framework.TestCase;
-import java.io.*;
 
 import org.apache.poi.hslf.usermodel.SlideShow;
 import org.apache.poi.poifs.filesystem.*;
+import org.apache.poi.POIDataSamples;
+
+import java.io.ByteArrayOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.FileNotFoundException;
 
 /**
  * Tests that HSLFSlideShow writes the powerpoint bit of data back out
@@ -41,21 +45,16 @@
 	private POIFSFileSystem pfsC;
 
     public void setUp() throws Exception {
-		String dirname = System.getProperty("HSLF.testdata.path");
 
-		String filenameA = dirname + "/basic_test_ppt_file.ppt";
-		FileInputStream fisA = new FileInputStream(filenameA);
-		pfsA = new POIFSFileSystem(fisA);
+        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
+        
+		pfsA = new POIFSFileSystem(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
 		hssA = new HSLFSlideShow(pfsA);
 
-		String filenameB = dirname + "/ParagraphStylesShorterThanCharStyles.ppt";
-		FileInputStream fisB = new FileInputStream(filenameB);
-		pfsB = new POIFSFileSystem(fisB);
+        pfsB = new POIFSFileSystem(slTests.openResourceAsStream("ParagraphStylesShorterThanCharStyles.ppt"));
 		hssB = new HSLFSlideShow(pfsB);
 
-		String filenameC = dirname + "/WithMacros.ppt";
-		FileInputStream fisC = new FileInputStream(filenameC);
-		pfsC = new POIFSFileSystem(fisC);
+        pfsC = new POIFSFileSystem(slTests.openResourceAsStream("WithMacros.ppt"));
 		hssC = new HSLFSlideShow(pfsC);
     }
 

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestReWriteSanity.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestReWriteSanity.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestReWriteSanity.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestReWriteSanity.java Sun Aug 23 12:34:24 2009
@@ -23,6 +23,7 @@
 import java.util.*;
 import org.apache.poi.hslf.record.*;
 import org.apache.poi.poifs.filesystem.*;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Tests that HSLFSlideShow writes the powerpoint bit of data back out
@@ -37,10 +38,8 @@
 	private POIFSFileSystem pfs;
 
     public TestReWriteSanity() throws Exception {
-		String dirname = System.getProperty("HSLF.testdata.path");
-		String filename = dirname + "/basic_test_ppt_file.ppt";
-		FileInputStream fis = new FileInputStream(filename);
-		pfs = new POIFSFileSystem(fis);
+        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
+		pfs = new POIFSFileSystem(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
 		ss = new HSLFSlideShow(pfs);
     }
 

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestRecordCounts.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestRecordCounts.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestRecordCounts.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/TestRecordCounts.java Sun Aug 23 12:34:24 2009
@@ -20,6 +20,7 @@
 
 import junit.framework.TestCase;
 import org.apache.poi.hslf.record.*;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Tests that HSLFSlideShow returns the right numbers of key records when
@@ -32,9 +33,8 @@
 	private HSLFSlideShow ss;
 
 	public TestRecordCounts() throws Exception {
-		String dirname = System.getProperty("HSLF.testdata.path");
-		String filename = dirname + "/basic_test_ppt_file.ppt";
-		ss = new HSLFSlideShow(filename);
+        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
+		ss = new HSLFSlideShow(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
 	}
 
 	public void testSheetsCount() {

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestCruddyExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestCruddyExtractor.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestCruddyExtractor.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestCruddyExtractor.java Sun Aug 23 12:34:24 2009
@@ -21,6 +21,8 @@
 import junit.framework.TestCase;
 import java.util.Vector;
 
+import org.apache.poi.POIDataSamples;
+
 /**
  * Tests that the QuickButCruddyTextExtractor works correctly
  *
@@ -56,9 +58,8 @@
 	};
 
     public TestCruddyExtractor() throws Exception {
-		String dirname = System.getProperty("HSLF.testdata.path");
-		String filename = dirname + "/basic_test_ppt_file.ppt";
-		te = new QuickButCruddyTextExtractor(filename);
+        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
+		te = new QuickButCruddyTextExtractor(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
     }
 
     public void testReadAsVector() {

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java Sun Aug 23 12:34:24 2009
@@ -28,6 +28,7 @@
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.hwpf.HWPFDocument;
+import org.apache.poi.POIDataSamples;
 
 import junit.framework.TestCase;
 
@@ -41,19 +42,15 @@
 	private PowerPointExtractor ppe;
 	/** Extractor primed on the 1 page but text-box'd test data */
 	private PowerPointExtractor ppe2;
-	/** Where to go looking for our test files */
-	private String dirname;
 	/** Where our embeded files live */
-	private String pdirname;
+	//private String pdirname;
+    private static POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
+    //private String pdirname;
 
     protected void setUp() throws Exception {
-		dirname = System.getProperty("HSLF.testdata.path");
-		String filename = dirname + "/basic_test_ppt_file.ppt";
-		ppe = new PowerPointExtractor(filename);
-		String filename2 = dirname + "/with_textbox.ppt";
-		ppe2 = new PowerPointExtractor(filename2);
-		
-		pdirname = System.getProperty("POIFS.testdata.path");
+
+		ppe = new PowerPointExtractor(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
+		ppe2 = new PowerPointExtractor(slTests.openResourceAsStream("with_textbox.ppt"));
     }
 
     public void testReadSheetText() {
@@ -114,8 +111,7 @@
 	 * @throws Exception
 	 */
 	public void testMissingCoreRecords() throws Exception {
-		String filename = dirname + "/missing_core_records.ppt";
-		ppe = new PowerPointExtractor(filename);
+		ppe = new PowerPointExtractor(slTests.openResourceAsStream("missing_core_records.ppt"));
 		
 		String text = ppe.getText(true, false);
 		String nText = ppe.getNotes();
@@ -141,72 +137,67 @@
     }
     
     public void testExtractFromEmbeded() throws Exception {
-    	String filename3 = pdirname + "/excel_with_embeded.xls";
-    	POIFSFileSystem fs = new POIFSFileSystem(
-    			new FileInputStream(filename3)
-    	);
-    	HSLFSlideShow ss;
-    	
-    	DirectoryNode dirA = (DirectoryNode)
-    		fs.getRoot().getEntry("MBD0000A3B6");
-		DirectoryNode dirB = (DirectoryNode)
-			fs.getRoot().getEntry("MBD0000A3B3");
-		
-		assertNotNull(dirA.getEntry("PowerPoint Document"));
-		assertNotNull(dirB.getEntry("PowerPoint Document"));
-    	
-		// Check the first file
-    	ss = new HSLFSlideShow(dirA, fs);
-		ppe = new PowerPointExtractor(ss);
-		assertEquals("Sample PowerPoint file\nThis is the 1st file\nNot much too it\n",
-				ppe.getText(true, false)
-		);
-
-		// And the second
-    	ss = new HSLFSlideShow(dirB, fs);
-		ppe = new PowerPointExtractor(ss);
-		assertEquals("Sample PowerPoint file\nThis is the 2nd file\nNot much too it either\n",
-				ppe.getText(true, false)
-		);
-    }
-
-    /**
-     * A powerpoint file with embeded powerpoint files
-     */
-    public void testExtractFromOwnEmbeded() throws Exception {
-    	String path = pdirname + "/ppt_with_embeded.ppt";
-		ppe = new PowerPointExtractor(path);
-        List<OLEShape> shapes = ppe.getOLEShapes();
-        assertEquals("Expected 6 ole shapes in " + path, 6, shapes.size());
-        int num_ppt = 0, num_doc = 0, num_xls = 0;
-        for(OLEShape ole : shapes) {
-            String name = ole.getInstanceName();
-            InputStream data = ole.getObjectData().getData();
-            if ("Worksheet".equals(name)) {
-                HSSFWorkbook wb = new HSSFWorkbook(data);
-                num_xls++;
-            } else if ("Document".equals(name)) {
-                HWPFDocument doc = new HWPFDocument(data);
-                num_doc++;
-            } else if ("Presentation".equals(name)) {
-                num_ppt++;
-                SlideShow ppt = new SlideShow(data);
-            }
-        }
-        assertEquals("Expected 2 embedded Word Documents", 2, num_doc);
-        assertEquals("Expected 2 embedded Excel Spreadsheets", 2, num_xls);
-        assertEquals("Expected 2 embedded PowerPoint Presentations", 2, num_ppt);
-    }
+         POIFSFileSystem fs = new POIFSFileSystem(
+             POIDataSamples.getSpreadSheetInstance().openResourceAsStream("excel_with_embeded.xls")
+         );
+         HSLFSlideShow ss;
+
+         DirectoryNode dirA = (DirectoryNode)
+             fs.getRoot().getEntry("MBD0000A3B6");
+         DirectoryNode dirB = (DirectoryNode)
+             fs.getRoot().getEntry("MBD0000A3B3");
+
+         assertNotNull(dirA.getEntry("PowerPoint Document"));
+         assertNotNull(dirB.getEntry("PowerPoint Document"));
+
+         // Check the first file
+         ss = new HSLFSlideShow(dirA, fs);
+         ppe = new PowerPointExtractor(ss);
+         assertEquals("Sample PowerPoint file\nThis is the 1st file\nNot much too it\n",
+                 ppe.getText(true, false)
+         );
+
+         // And the second
+         ss = new HSLFSlideShow(dirB, fs);
+         ppe = new PowerPointExtractor(ss);
+         assertEquals("Sample PowerPoint file\nThis is the 2nd file\nNot much too it either\n",
+                 ppe.getText(true, false)
+         );
+     }
+
+     /**
+      * A powerpoint file with embeded powerpoint files
+      */
+     public void testExtractFromOwnEmbeded() throws Exception {
+         String path = "ppt_with_embeded.ppt";
+         ppe = new PowerPointExtractor(POIDataSamples.getSlideShowInstance().openResourceAsStream(path));
+         List<OLEShape> shapes = ppe.getOLEShapes();
+         assertEquals("Expected 6 ole shapes in " + path, 6, shapes.size());
+         int num_ppt = 0, num_doc = 0, num_xls = 0;
+         for(OLEShape ole : shapes) {
+             String name = ole.getInstanceName();
+             InputStream data = ole.getObjectData().getData();
+             if ("Worksheet".equals(name)) {
+                 HSSFWorkbook wb = new HSSFWorkbook(data);
+                 num_xls++;
+             } else if ("Document".equals(name)) {
+                 HWPFDocument doc = new HWPFDocument(data);
+                 num_doc++;
+             } else if ("Presentation".equals(name)) {
+                 num_ppt++;
+                 SlideShow ppt = new SlideShow(data);
+             }
+         }
+         assertEquals("Expected 2 embedded Word Documents", 2, num_doc);
+         assertEquals("Expected 2 embedded Excel Spreadsheets", 2, num_xls);
+         assertEquals("Expected 2 embedded PowerPoint Presentations", 2, num_ppt);
+     }
     
     /**
      * From bug #45543
      */
     public void testWithComments() throws Exception {
-		String filename;
-		
-		// New file
-		filename = dirname + "/WithComments.ppt";
-		ppe = new PowerPointExtractor(filename);
+		ppe = new PowerPointExtractor(slTests.openResourceAsStream("WithComments.ppt"));
 
 		String text = ppe.getText();
 		assertFalse("Comments not in by default", contains(text, "This is a test comment"));
@@ -218,8 +209,7 @@
 
 		
 		// And another file
-		filename = dirname + "/45543.ppt";
-		ppe = new PowerPointExtractor(filename);
+		ppe = new PowerPointExtractor(slTests.openResourceAsStream("45543.ppt"));
 
         text = ppe.getText();
 		assertFalse("Comments not in by default", contains(text, "testdoc"));
@@ -234,11 +224,10 @@
      * From bug #45537
      */
     public void testHeaderFooter() throws Exception {
-		String filename, text;
-		
+		String  text;
+
 		// With a header on the notes
-		filename = dirname + "/45537_Header.ppt";
-		HSLFSlideShow hslf = new HSLFSlideShow(new FileInputStream(filename));
+		HSLFSlideShow hslf = new HSLFSlideShow(slTests.openResourceAsStream("45537_Header.ppt"));
 		SlideShow ss = new SlideShow(hslf);
 		assertNotNull(ss.getNotesHeadersFooters());
 		assertEquals("testdoc test phrase", ss.getNotesHeadersFooters().getHeaderText());
@@ -256,13 +245,12 @@
 
         
 		// And with a footer, also on notes
-		filename = dirname + "/45537_Footer.ppt";
-		hslf = new HSLFSlideShow(new FileInputStream(filename));
+		hslf = new HSLFSlideShow(slTests.openResourceAsStream("45537_Footer.ppt"));
 		ss = new SlideShow(hslf);
 		assertNotNull(ss.getNotesHeadersFooters());
 		assertEquals("testdoc test phrase", ss.getNotesHeadersFooters().getFooterText());
 		
-		ppe = new PowerPointExtractor(filename);
+		ppe = new PowerPointExtractor(slTests.openResourceAsStream("45537_Footer.ppt"));
 
 		text = ppe.getText();
 		assertFalse("Unable to find expected word in text\n" + text, contains(text, "testdoc"));



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