poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ye...@apache.org
Subject svn commit: r806959 [3/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...
Date Sun, 23 Aug 2009 12:34:42 GMT
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestBackground.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestBackground.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestBackground.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestBackground.java Sun Aug 23 12:34:24 2009
@@ -24,6 +24,7 @@
 
 import org.apache.poi.hslf.usermodel.SlideShow;
 import org.apache.poi.hslf.HSLFSlideShow;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Test <code>Fill</code> object.
@@ -31,6 +32,7 @@
  * @author Yegor Kozlov
  */
 public final class TestBackground extends TestCase {
+    private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
 
     /**
      * Default background for slide, shape and slide master.
@@ -52,7 +54,7 @@
      * Read fill information from an reference ppt file
      */
     public void testReadBackground() throws Exception {
-        SlideShow ppt = new SlideShow(new HSLFSlideShow(System.getProperty("HSLF.testdata.path") + "/backgrounds.ppt"));
+        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("backgrounds.ppt"));
         Fill fill;
         Shape shape;
 
@@ -93,7 +95,7 @@
         slide = ppt.createSlide();
         slide.setFollowMasterBackground(false);
         fill = slide.getBackground().getFill();
-        idx = ppt.addPicture(new File(System.getProperty("HSLF.testdata.path") + "/tomcat.png"), Picture.PNG);
+        idx = ppt.addPicture(_slTests.readFile("tomcat.png"), Picture.PNG);
         fill.setFillType(Fill.FILL_PICTURE);
         fill.setPictureData(idx);
 
@@ -107,7 +109,7 @@
         slide = ppt.createSlide();
         slide.setFollowMasterBackground(false);
         fill = slide.getBackground().getFill();
-        idx = ppt.addPicture(new File(System.getProperty("HSLF.testdata.path") + "/tomcat.png"), Picture.PNG);
+        idx = ppt.addPicture(_slTests.readFile("tomcat.png"), Picture.PNG);
         fill.setFillType(Fill.FILL_PATTERN);
         fill.setPictureData(idx);
         fill.setBackgroundColor(Color.green);
@@ -123,7 +125,7 @@
         slide = ppt.createSlide();
         slide.setFollowMasterBackground(false);
         fill = slide.getBackground().getFill();
-        idx = ppt.addPicture(new File(System.getProperty("HSLF.testdata.path") + "/tomcat.png"), Picture.PNG);
+        idx = ppt.addPicture(_slTests.readFile("tomcat.png"), Picture.PNG);
         fill.setFillType(Fill.FILL_TEXTURE);
         fill.setPictureData(idx);
 
@@ -131,7 +133,7 @@
         shape.setAnchor(new java.awt.Rectangle(100, 100, 200, 200));
         fill = shape.getFill();
         fill.setFillType(Fill.FILL_PICTURE);
-        idx = ppt.addPicture(new File(System.getProperty("HSLF.testdata.path") + "/clock.jpg"), Picture.JPEG);
+        idx = ppt.addPicture(_slTests.readFile("clock.jpg"), Picture.JPEG);
         fill.setPictureData(idx);
         slide.addShape(shape);
 

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestHeadersFooters.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestHeadersFooters.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestHeadersFooters.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestHeadersFooters.java Sun Aug 23 12:34:24 2009
@@ -19,6 +19,7 @@
 
 import java.io.*;
 import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.POIDataSamples;
 
 import junit.framework.TestCase;
 
@@ -28,14 +29,11 @@
 public final class TestHeadersFooters extends TestCase
 {
 
-    public static final String cwd = System.getProperty("HSLF.testdata.path");
+    private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
 
     public void testRead() throws Exception
     {
-        File file = new File(cwd, "headers_footers.ppt");
-        FileInputStream is = new FileInputStream(file);
-        SlideShow ppt = new SlideShow(is);
-        is.close();
+        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("headers_footers.ppt"));
 
         HeadersFooters slideHdd = ppt.getSlideHeadersFooters();
         assertTrue(slideHdd.isFooterVisible());
@@ -79,10 +77,7 @@
      */
     public void testReadNoHeadersFooters() throws Exception
     {
-        File file = new File(cwd, "basic_test_ppt_file.ppt");
-        FileInputStream is = new FileInputStream(file);
-        SlideShow ppt = new SlideShow(is);
-        is.close();
+        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
 
         HeadersFooters slideHdd = ppt.getSlideHeadersFooters();
         assertFalse(slideHdd.isFooterVisible());
@@ -119,10 +114,7 @@
      */
     public void testRead2007() throws Exception
     {
-        File file = new File(cwd, "headers_footers_2007.ppt");
-        FileInputStream is = new FileInputStream(file);
-        SlideShow ppt = new SlideShow(is);
-        is.close();
+        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("headers_footers_2007.ppt"));
 
         HeadersFooters slideHdd = ppt.getSlideHeadersFooters();
         assertTrue(slideHdd.isFooterVisible());

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestHyperlink.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestHyperlink.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestHyperlink.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestHyperlink.java Sun Aug 23 12:34:24 2009
@@ -19,10 +19,8 @@
 
 import junit.framework.TestCase;
 
-import java.io.FileInputStream;
-import java.io.File;
-
 import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Test Hyperlink.
@@ -30,12 +28,10 @@
  * @author Yegor Kozlov
  */
 public final class TestHyperlink extends TestCase {
-    protected String cwd = System.getProperty("HSLF.testdata.path");
+    private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
 
     public void testTextRunHyperlinks() throws Exception {
-        FileInputStream is = new FileInputStream(new File(cwd, "WithLinks.ppt"));
-        SlideShow ppt = new SlideShow(is);
-        is.close();
+        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("WithLinks.ppt"));
 
         TextRun[] run;
         Slide slide;

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestMovieShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestMovieShape.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestMovieShape.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestMovieShape.java Sun Aug 23 12:34:24 2009
@@ -20,11 +20,11 @@
 import java.awt.geom.Rectangle2D;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.File;
 
 import junit.framework.TestCase;
 
 import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Test <code>MovieShape</code> object.
@@ -33,16 +33,16 @@
  */
 public final class TestMovieShape extends TestCase {
 
-    protected String cwd = System.getProperty("HSLF.testdata.path");
+    private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
 
     public void testCreate() throws Exception {
         SlideShow ppt = new SlideShow();
 
         Slide slide = ppt.createSlide();
 
-        String path = cwd + "/test-movie.mpg";
+        String path = "/test-movie.mpg";
         int movieIdx = ppt.addMovie(path, MovieShape.MOVIE_MPEG);
-        int thumbnailIdx = ppt.addPicture(new File(cwd, "tomcat.png"), Picture.PNG);
+        int thumbnailIdx = ppt.addPicture(_slTests.readFile("tomcat.png"), Picture.PNG);
 
         MovieShape shape = new MovieShape(movieIdx, thumbnailIdx);
         shape.setAnchor(new Rectangle2D.Float(300,225,120,90));

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestOleEmbedding.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestOleEmbedding.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestOleEmbedding.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestOleEmbedding.java Sun Aug 23 12:34:24 2009
@@ -17,9 +17,6 @@
 
 package org.apache.poi.hslf.model;
 
-import java.io.File;
-import java.io.FileInputStream;
-
 import junit.framework.TestCase;
 
 import org.apache.poi.hslf.HSLFSlideShow;
@@ -29,17 +26,17 @@
 import org.apache.poi.hssf.usermodel.HSSFSheet;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.hwpf.HWPFDocument;
+import org.apache.poi.POIDataSamples;
 
 public final class TestOleEmbedding extends TestCase {
+    private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
     /**
      * Tests support for OLE objects.
      *
      * @throws Exception if an error occurs.
      */
     public void testOleEmbedding2003() throws Exception {
-        String dirname = System.getProperty("HSLF.testdata.path");
-        File file = new File(dirname, "ole2-embedding-2003.ppt");
-        HSLFSlideShow slideShow = new HSLFSlideShow(new FileInputStream(file));
+        HSLFSlideShow slideShow = new HSLFSlideShow(_slTests.openResourceAsStream("ole2-embedding-2003.ppt"));
         // Placeholder EMFs for clients that don't support the OLE components.
         PictureData[] pictures = slideShow.getPictures();
         assertEquals("Should be two pictures", 2, pictures.length);
@@ -54,11 +51,7 @@
     }
 
     public void testOLEShape() throws Exception {
-        String dirname = System.getProperty("HSLF.testdata.path");
-        File file = new File(dirname, "ole2-embedding-2003.ppt");
-        FileInputStream is = new FileInputStream(file);
-        SlideShow ppt = new SlideShow(is);
-        is.close();
+        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("ole2-embedding-2003.ppt"));
 
         Slide slide = ppt.getSlides()[0];
         Shape[] sh = slide.getShapes();

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPPGraphics2D.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPPGraphics2D.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPPGraphics2D.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPPGraphics2D.java Sun Aug 23 12:34:24 2009
@@ -20,6 +20,7 @@
 import junit.framework.TestCase;
 import org.apache.poi.hslf.usermodel.SlideShow;
 import org.apache.poi.hslf.HSLFSlideShow;
+import org.apache.poi.POIDataSamples;
 
 import java.awt.*;
 import java.awt.Rectangle;
@@ -32,12 +33,11 @@
  * @author Yegor Kozlov
  */
 public final class TestPPGraphics2D extends TestCase {
+    private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
     private SlideShow ppt;
 
     protected void setUp() throws Exception {
-		String dirname = System.getProperty("HSLF.testdata.path");
-		String filename = dirname + "/empty.ppt";
-		ppt = new SlideShow(new HSLFSlideShow(filename));
+		ppt = new SlideShow(_slTests.openResourceAsStream("empty.ppt"));
     }
 
     public void testGraphics() throws Exception {

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPicture.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPicture.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPicture.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPicture.java Sun Aug 23 12:34:24 2009
@@ -20,13 +20,13 @@
 import java.awt.Graphics2D;
 import java.awt.Rectangle;
 import java.awt.image.BufferedImage;
-import java.io.File;
 
 import junit.framework.TestCase;
 
 import org.apache.poi.ddf.EscherBSERecord;
 import org.apache.poi.hslf.usermodel.PictureData;
 import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Test Picture shape.
@@ -34,6 +34,7 @@
  * @author Yegor Kozlov
  */
 public final class TestPicture extends TestCase {
+    private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
 
     /**
      * Test that the reference count of a blip is incremented every time the picture is inserted.
@@ -41,14 +42,13 @@
      *
      */
     public void testMultiplePictures() throws Exception {
-        String cwd = System.getProperty("HSLF.testdata.path");
         SlideShow ppt = new SlideShow();
 
         Slide s = ppt.createSlide();
         Slide s2 = ppt.createSlide();
         Slide s3 = ppt.createSlide();
 
-        int idx = ppt.addPicture(new File(cwd, "clock.jpg"), Picture.JPEG);
+        int idx = ppt.addPicture(_slTests.readFile("clock.jpg"), Picture.JPEG);
         Picture pict = new Picture(idx);
         Picture pict2 = new Picture(idx);
         Picture pict3 = new Picture(idx);

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSetBoldItalic.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSetBoldItalic.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSetBoldItalic.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSetBoldItalic.java Sun Aug 23 12:34:24 2009
@@ -36,10 +36,6 @@
      * and set some of the style attributes
      */
     public void testTextBoxWrite() throws Exception {
-        //String dirname = System.getProperty("HSLF.testdata.path");
-        //String filename = dirname + "/with_textbox.ppt";
-        //new SlideShow(new HSLFSlideShow(filename));
-
         SlideShow ppt = new SlideShow();
         Slide sl = ppt.createSlide();
         RichTextRun rt;

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestShapes.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestShapes.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestShapes.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestShapes.java Sun Aug 23 12:34:24 2009
@@ -22,12 +22,12 @@
 import org.apache.poi.hslf.usermodel.RichTextRun;
 import org.apache.poi.hslf.HSLFSlideShow;
 import org.apache.poi.ddf.*;
+import org.apache.poi.POIDataSamples;
 
 import java.awt.*;
 import java.awt.Rectangle;
 import java.io.ByteArrayOutputStream;
 import java.io.ByteArrayInputStream;
-import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 
@@ -37,16 +37,15 @@
  * @author Yegor Kozlov
  */
 public final class TestShapes extends TestCase {
+    private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
+
     private SlideShow ppt;
     private SlideShow pptB;
 
     protected void setUp() throws Exception {
-		String dirname = System.getProperty("HSLF.testdata.path");
-		String filename = dirname + "/empty.ppt";
-		ppt = new SlideShow(new HSLFSlideShow(filename));
+		ppt = new SlideShow(_slTests.openResourceAsStream("empty.ppt"));
 
-		String filenameB = dirname + "/empty_textbox.ppt";
-		pptB = new SlideShow(new HSLFSlideShow(filenameB));
+		pptB = new SlideShow(_slTests.openResourceAsStream("empty_textbox.ppt"));
     }
 
     public void testGraphics() throws Exception {
@@ -94,9 +93,7 @@
      * @throws Exception
      */
     public void testTextBoxRead() throws Exception {
-        String dirname = System.getProperty("HSLF.testdata.path");
-        String filename = dirname + "/with_textbox.ppt";
-        ppt = new SlideShow(new HSLFSlideShow(filename));
+        ppt = new SlideShow(_slTests.openResourceAsStream("with_textbox.ppt"));
         Slide sl = ppt.getSlides()[0];
         Shape[] sh = sl.getShapes();
         for (int i = 0; i < sh.length; i++) {
@@ -198,17 +195,16 @@
      * it must be the same as returned by Slide.getTextRuns().
      */
     public void testTextBoxSet() throws Exception {
-        textBoxSet("/with_textbox.ppt");
-        textBoxSet("/basic_test_ppt_file.ppt");
-        textBoxSet("/next_test_ppt_file.ppt");
-        textBoxSet("/Single_Coloured_Page.ppt");
-        textBoxSet("/Single_Coloured_Page_With_Fonts_and_Alignments.ppt");
-        textBoxSet("/incorrect_slide_order.ppt");
+        textBoxSet("with_textbox.ppt");
+        textBoxSet("basic_test_ppt_file.ppt");
+        textBoxSet("next_test_ppt_file.ppt");
+        textBoxSet("Single_Coloured_Page.ppt");
+        textBoxSet("Single_Coloured_Page_With_Fonts_and_Alignments.ppt");
+        textBoxSet("incorrect_slide_order.ppt");
     }
 
     private void textBoxSet(String filename) throws Exception {
-        String dirname = System.getProperty("HSLF.testdata.path");
-        SlideShow ppt = new SlideShow(new HSLFSlideShow(dirname + filename));
+        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream(filename));
         Slide[] sl = ppt.getSlides();
         for (int k = 0; k < sl.length; k++) {
             ArrayList lst1 = new ArrayList();
@@ -234,7 +230,6 @@
      * Test adding shapes to <code>ShapeGroup</code>
      */
     public void testShapeGroup() throws Exception {
-        String cwd = System.getProperty("HSLF.testdata.path");
         SlideShow ppt = new SlideShow();
 
         Slide slide = ppt.createSlide();
@@ -245,8 +240,7 @@
         group.setAnchor(new Rectangle(0, 0, (int)pgsize.getWidth(), (int)pgsize.getHeight()));
         slide.addShape(group);
 
-        File img = new File(cwd, "clock.jpg");
-        int idx = ppt.addPicture(img, Picture.JPEG);
+        int idx = ppt.addPicture(_slTests.readFile("clock.jpg"), Picture.JPEG);
         Picture pict = new Picture(idx, group);
         pict.setAnchor(new Rectangle(0, 0, 200, 200));
         group.addShape(pict);
@@ -287,8 +281,8 @@
      * Test functionality of Sheet.removeShape(Shape shape)
      */
     public void testRemoveShapes() throws IOException {
-        String file = System.getProperty("HSLF.testdata.path")+ "/with_textbox.ppt";
-        SlideShow ppt = new SlideShow(new HSLFSlideShow(file));
+        String file = "with_textbox.ppt";
+        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream(file));
         Slide sl = ppt.getSlides()[0];
         Shape[] sh = sl.getShapes();
         assertEquals("expected four shaped in " + file, 4, sh.length);

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSheet.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSheet.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSheet.java Sun Aug 23 12:34:24 2009
@@ -20,14 +20,11 @@
 import junit.framework.AssertionFailedError;
 import junit.framework.TestCase;
 
-import java.io.FileInputStream;
-import java.io.File;
-
-import org.apache.poi.hslf.HSLFSlideShow;
 import org.apache.poi.hslf.exceptions.EncryptedPowerPointFileException;
 import org.apache.poi.hslf.record.ColorSchemeAtom;
 import org.apache.poi.hslf.record.PPDrawing;
 import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Test common functionality of the <code>Sheet</code> object.
@@ -36,23 +33,16 @@
  * @author Yegor Kozlov
  */
 public final class TestSheet extends TestCase {
+    private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
 
     /**
      * For each ppt in the test directory check that all sheets are properly initialized
      */
     public void testSheet() throws Exception {
-        File home = new File(System.getProperty("HSLF.testdata.path"));
-        File[] files = home.listFiles();
-        for (int i = 0; i < files.length; i++) {
-            if(!files[i].getName().endsWith(".ppt")) continue;
-            if(files[i].getName().endsWith("PPT95.ppt")) continue;
-
+        String[] tests = {"SampleShow.ppt", "backgrounds.ppt", "text_shapes.ppt", "pictures.ppt"};
+        for (String file : tests) {
             try {
-                FileInputStream is = new FileInputStream(files[i]);
-                HSLFSlideShow hslf = new HSLFSlideShow(is);
-                is.close();
-
-                SlideShow ppt = new SlideShow(hslf);
+                SlideShow ppt = new SlideShow(_slTests.openResourceAsStream(file));
                 doSlideShow(ppt);
             } catch (EncryptedPowerPointFileException e){
                 ; //skip encrypted ppt

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideChangeNotes.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideChangeNotes.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideChangeNotes.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideChangeNotes.java Sun Aug 23 12:34:24 2009
@@ -23,6 +23,7 @@
 import org.apache.poi.hslf.HSLFSlideShow;
 import org.apache.poi.hslf.record.SlideAtom;
 import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Tests that changing a slide's idea of what notes sheet is its works right
@@ -34,9 +35,8 @@
 	private SlideShow ss;
 
 	public TestSlideChangeNotes() throws Exception {
-		String dirname = System.getProperty("HSLF.testdata.path");
-		String filename = dirname + "/basic_test_ppt_file.ppt";
-		HSLFSlideShow hss = new HSLFSlideShow(filename);
+        POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
+		HSLFSlideShow hss = new HSLFSlideShow(_slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
 		ss = new SlideShow(hss);
 	}
 

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideMaster.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideMaster.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideMaster.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlideMaster.java Sun Aug 23 12:34:24 2009
@@ -28,6 +28,7 @@
 import org.apache.poi.hslf.record.TextHeaderAtom;
 import org.apache.poi.hslf.usermodel.RichTextRun;
 import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Tests for SlideMaster
@@ -35,18 +36,14 @@
  * @author Yegor Kozlov
  */
 public final class TestSlideMaster extends TestCase{
-    String home;
-
-    public void setUp() {
-        home = System.getProperty("HSLF.testdata.path");
-    }
+    private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
 
     /**
      * The reference ppt has two masters.
      * Check we can read their attributes.
      */
     public void testSlideMaster() throws Exception {
-        SlideShow ppt = new SlideShow(new HSLFSlideShow(home + "/slide_master.ppt"));
+        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
 
         Environment env = ppt.getDocumentRecord().getEnvironment();
 
@@ -86,7 +83,7 @@
      * Test we can read default text attributes for a title master sheet
      */
     public void testTitleMasterTextAttributes() throws Exception {
-        SlideShow ppt = new SlideShow(new HSLFSlideShow(home + "/slide_master.ppt"));
+        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
         TitleMaster[] master = ppt.getTitleMasters();
         assertEquals(1, master.length);
 
@@ -107,7 +104,7 @@
      * Slide 3 has title layout and follows the TitleMaster. Verify that.
      */
     public void testTitleMaster() throws Exception {
-        SlideShow ppt = new SlideShow(new HSLFSlideShow(home + "/slide_master.ppt"));
+        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
         Slide slide = ppt.getSlides()[2];
         MasterSheet masterSheet = slide.getMasterSheet();
         assertTrue(masterSheet instanceof TitleMaster);
@@ -136,7 +133,7 @@
      * If a style attribute is not set ensure it is read from the master
      */
     public void testMasterAttributes() throws Exception {
-        SlideShow ppt = new SlideShow(new HSLFSlideShow(home + "/slide_master.ppt"));
+        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
         Slide[] slide = ppt.getSlides();
         assertEquals(3, slide.length);
         TextRun[] trun;
@@ -185,7 +182,7 @@
      * Check we can dynamically assign a slide master to a slide.
      */
     public void testChangeSlideMaster() throws Exception {
-        SlideShow ppt = new SlideShow(new HSLFSlideShow(home + "/slide_master.ppt"));
+        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
         SlideMaster[] master = ppt.getSlidesMasters();
         Slide[] slide = ppt.getSlides();
         int sheetNo;
@@ -219,7 +216,7 @@
      * (typical for the "bullted body" placeholder)
      */
     public void testIndentation() throws Exception {
-        SlideShow ppt = new SlideShow(new HSLFSlideShow(home + "/slide_master.ppt"));
+        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
         Slide slide = ppt.getSlides()[0];
         TextRun[] trun;
 

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlides.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlides.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlides.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlides.java Sun Aug 23 12:34:24 2009
@@ -20,6 +20,7 @@
 import junit.framework.TestCase;
 import org.apache.poi.hslf.HSLFSlideShow;
 import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.POIDataSamples;
 
 import java.io.ByteArrayOutputStream;
 import java.io.ByteArrayInputStream;
@@ -137,8 +138,8 @@
      * Add slides to ppt which already has two slides
      */
     public void testAddSlides2to3() throws Exception {
-		String dirname = System.getProperty("HSLF.testdata.path");
-        SlideShow ppt = new SlideShow(new HSLFSlideShow(dirname + "/basic_test_ppt_file.ppt"));
+        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
+        SlideShow ppt = new SlideShow(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
 
         assertTrue(ppt.getSlides().length == 2);
 

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRun.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRun.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRun.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRun.java Sun Aug 23 12:34:24 2009
@@ -22,13 +22,13 @@
 
 import junit.framework.TestCase;
 
-import org.apache.poi.hslf.HSLFSlideShow;
 import org.apache.poi.hslf.model.textproperties.TextPropCollection;
 import org.apache.poi.hslf.record.TextBytesAtom;
 import org.apache.poi.hslf.record.TextCharsAtom;
 import org.apache.poi.hslf.record.TextHeaderAtom;
 import org.apache.poi.hslf.usermodel.RichTextRun;
 import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Tests for TextRuns
@@ -36,32 +36,19 @@
  * @author Nick Burch (nick at torchbox dot com)
  */
 public final class TestTextRun extends TestCase {
+    private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
+
 	// SlideShow primed on the test data
 	private SlideShow ss;
 	private SlideShow ssRich;
 
-	// TODO - use this or similar through rest of hslf tests
-	private static SlideShow openSampleSlideShow(String name) {
-		String dirname = System.getProperty("HSLF.testdata.path");
-
-		// Basic (non rich) test file
-		String filename = dirname + "/" + name;
-		HSLFSlideShow x;
-		try {
-			x = new HSLFSlideShow(filename);
-		} catch (IOException e) {
-			throw new RuntimeException(e);
-		}
-		return new SlideShow(x);
-	}
-
-	protected void setUp() {
+	protected void setUp() throws IOException {
 
 		// Basic (non rich) test file
-		ss = openSampleSlideShow("basic_test_ppt_file.ppt");
+		ss = new SlideShow(_slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
 
 		// Rich test file
-		ssRich = openSampleSlideShow("Single_Coloured_Page.ppt");
+		ssRich = new SlideShow(_slTests.openResourceAsStream("Single_Coloured_Page.ppt"));
 	}
 
 	/**
@@ -429,10 +416,10 @@
 	 * of the wrong list of potential paragraph properties defined in StyleTextPropAtom.
 	 *
 	 */
-	public void testBug41015() {
+	public void testBug41015() throws IOException {
 		RichTextRun[] rt;
 
-		SlideShow ppt = openSampleSlideShow("bug-41015.ppt");
+		SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("bug-41015.ppt"));
 		Slide sl = ppt.getSlides()[0];
 		TextRun[] txt = sl.getTextRuns();
 		assertEquals(2, txt.length);

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRunReWrite.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRunReWrite.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRunReWrite.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRunReWrite.java Sun Aug 23 12:34:24 2009
@@ -25,6 +25,7 @@
 import org.apache.poi.hslf.usermodel.RichTextRun;
 import org.apache.poi.hslf.usermodel.SlideShow;
 import org.apache.poi.poifs.filesystem.*;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Tests that if we load something up, get a TextRun, set the text
@@ -45,10 +46,9 @@
 	 * Load up a test PPT file with rich data
 	 */
     public void setUp() throws Exception {
-		String dirname = System.getProperty("HSLF.testdata.path");
-		String filename = dirname + "/Single_Coloured_Page_With_Fonts_and_Alignments.ppt";
-		FileInputStream fis = new FileInputStream(filename);
-		pfs = new POIFSFileSystem(fis);
+        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
+		String filename = "Single_Coloured_Page_With_Fonts_and_Alignments.ppt";
+		pfs = new POIFSFileSystem(slTests.openResourceAsStream(filename));
 		hss = new HSLFSlideShow(pfs);
 		ss = new SlideShow(hss);
     }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextShape.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextShape.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextShape.java Sun Aug 23 12:34:24 2009
@@ -25,6 +25,7 @@
 
 import org.apache.poi.hslf.usermodel.SlideShow;
 import org.apache.poi.hslf.record.TextHeaderAtom;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Verify behavior of <code>TextShape</code> and its sub-classes
@@ -32,7 +33,7 @@
  * @author Yegor Kozlov
  */
 public final class TestTextShape extends TestCase {
-    protected String cwd = System.getProperty("HSLF.testdata.path");
+    private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
 
     public void testCreateAutoShape(){
         TextShape shape = new AutoShape(ShapeTypes.Trapezoid);
@@ -70,9 +71,7 @@
      *  - text in auto-shapes
      */
     public void testRead() throws IOException {
-        FileInputStream is = new FileInputStream(new File(cwd, "text_shapes.ppt"));
-        SlideShow ppt = new SlideShow(is);
-        is.close();
+        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("text_shapes.ppt"));
 
         ArrayList lst1 = new ArrayList();
         Slide slide = ppt.getSlides()[0];
@@ -157,9 +156,7 @@
     }
 
     public void testMargins() throws IOException {
-        FileInputStream is = new FileInputStream(new File(cwd, "text-margins.ppt"));
-        SlideShow ppt = new SlideShow(is);
-        is.close();
+        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("text-margins.ppt"));
 
         Slide slide = ppt.getSlides()[0];
 

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCurrentUserAtom.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCurrentUserAtom.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCurrentUserAtom.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestCurrentUserAtom.java Sun Aug 23 12:34:24 2009
@@ -20,12 +20,12 @@
 
 import junit.framework.TestCase;
 import java.io.ByteArrayOutputStream;
-import java.io.FileInputStream;
 import java.io.InputStream;
 
 import org.apache.poi.hslf.exceptions.EncryptedPowerPointFileException;
 import org.apache.poi.poifs.filesystem.DocumentEntry;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Tests that CurrentUserAtom works properly.
@@ -33,6 +33,7 @@
  * @author Nick Burch (nick at torchbox dot com)
  */
 public final class TestCurrentUserAtom extends TestCase {
+    private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
 	/** Not encrypted */
 	private String normalFile;
 	/** Encrypted */
@@ -41,14 +42,13 @@
 	protected void setUp() throws Exception {
 		super.setUp();
 
-		String dirname = System.getProperty("HSLF.testdata.path");
-		normalFile = dirname + "/basic_test_ppt_file.ppt";
-		encFile = dirname + "/Password_Protected-hello.ppt";
+		normalFile = "basic_test_ppt_file.ppt";
+		encFile = "Password_Protected-hello.ppt";
 	}
 
 	public void testReadNormal() throws Exception {
 		POIFSFileSystem fs = new POIFSFileSystem(
-				new FileInputStream(normalFile)
+				_slTests.openResourceAsStream(normalFile)
 		);
 
 		CurrentUserAtom cu = new CurrentUserAtom(fs);
@@ -68,7 +68,7 @@
 
 	public void testReadEnc() throws Exception {
 		POIFSFileSystem fs = new POIFSFileSystem(
-				new FileInputStream(encFile)
+				_slTests.openResourceAsStream(encFile)
 		);
 
 		try {
@@ -82,7 +82,7 @@
 	public void testWriteNormal() throws Exception {
 		// Get raw contents from a known file
 		POIFSFileSystem fs = new POIFSFileSystem(
-				new FileInputStream(normalFile)
+				_slTests.openResourceAsStream(normalFile)
 		);
 		DocumentEntry docProps = (DocumentEntry)fs.getRoot().getEntry("Current User");
 		byte[] contents = new byte[docProps.getSize()];

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocument.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocument.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocument.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestDocument.java Sun Aug 23 12:34:24 2009
@@ -18,10 +18,10 @@
 package org.apache.poi.hslf.record;
 
 import junit.framework.TestCase;
-import java.io.*;
 
 import org.apache.poi.hslf.HSLFSlideShow;
 import org.apache.poi.poifs.filesystem.*;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Tests that Document works properly (Also tests Environment while we're at it)
@@ -35,10 +35,8 @@
 	private POIFSFileSystem pfs;
 
 	public TestDocument() 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/record/TestExHyperlink.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExHyperlink.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExHyperlink.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExHyperlink.java Sun Aug 23 12:34:24 2009
@@ -19,7 +19,6 @@
 
 
 import java.io.ByteArrayOutputStream;
-import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -28,6 +27,7 @@
 
 import org.apache.poi.hslf.HSLFSlideShow;
 import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Tests that ExHyperlink works properly.
@@ -98,8 +98,8 @@
 	}
 
 	public void testRealFile() throws Exception {
-		String dirname = System.getProperty("HSLF.testdata.path");
-		HSLFSlideShow hss = new HSLFSlideShow(dirname + File.separator + "WithLinks.ppt");
+        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
+		HSLFSlideShow hss = new HSLFSlideShow(slTests.openResourceAsStream("WithLinks.ppt"));
 		SlideShow ss = new SlideShow(hss);
 
 		// Get the document

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExObjList.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExObjList.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExObjList.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestExObjList.java Sun Aug 23 12:34:24 2009
@@ -18,12 +18,11 @@
 package org.apache.poi.hslf.record;
 
 
-import java.io.File;
-
 import junit.framework.TestCase;
 
 import org.apache.poi.hslf.HSLFSlideShow;
 import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Tests that ExObjList works properly.
@@ -32,8 +31,8 @@
  */
 public class TestExObjList extends TestCase {
 	public void testRealFile() throws Exception {
-		String dirname = System.getProperty("HSLF.testdata.path");
-		HSLFSlideShow hss = new HSLFSlideShow(dirname + File.separator + "WithLinks.ppt");
+        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
+		HSLFSlideShow hss = new HSLFSlideShow(slTests.openResourceAsStream("WithLinks.ppt"));
 		SlideShow ss = new SlideShow(hss);
 
 		// Get the document

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestRecordContainer.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestRecordContainer.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestRecordContainer.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestRecordContainer.java Sun Aug 23 12:34:24 2009
@@ -21,6 +21,7 @@
 import junit.framework.TestCase;
 
 import org.apache.poi.hslf.HSLFSlideShow;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Tests that the helper methods on RecordContainer work properly
@@ -147,9 +148,8 @@
 		super.setUp();
 
 		// Find a real RecordContainer record
-		String dirname = System.getProperty("HSLF.testdata.path");
-		String filename = dirname + "/basic_test_ppt_file.ppt";
-		HSLFSlideShow hss = new HSLFSlideShow(filename);
+        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
+		HSLFSlideShow hss = new HSLFSlideShow(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
 
 		Record[] r = hss.getRecords();
 		for(int i=0; i<r.length; i++) {

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSound.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSound.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSound.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/record/TestSound.java Sun Aug 23 12:34:24 2009
@@ -17,14 +17,13 @@
 
 package org.apache.poi.hslf.record;
 
-import java.io.File;
-import java.io.FileInputStream;
 import java.util.Arrays;
 
 import junit.framework.AssertionFailedError;
 import junit.framework.TestCase;
 
 import org.apache.poi.hslf.usermodel.SlideShow;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Tests Sound-related records: SoundCollection(2020), Sound(2022) and
@@ -34,10 +33,9 @@
  */
 public final class TestSound extends TestCase {
 	public void testRealFile() throws Exception {
-		String cwd = System.getProperty("HSLF.testdata.path");
-		FileInputStream is = new FileInputStream(new File(cwd, "sound.ppt"));
-		SlideShow ppt = new SlideShow(is);
-		is.close();
+        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
+
+		SlideShow ppt = new SlideShow(slTests.openResourceAsStream("sound.ppt"));
 
 		// Get the document
 		Document doc = ppt.getDocumentRecord();
@@ -71,13 +69,7 @@
 		assertEquals(".WAV", sound.getSoundType());
 		assertNotNull(sound.getSoundData());
 
-		File f = new File(cwd, "ringin.wav");
-		int length = (int) f.length();
-		byte[] ref_data = new byte[length];
-		is = new FileInputStream(f);
-		is.read(ref_data);
-		is.close();
-
+		byte[] ref_data = slTests.readFile("ringin.wav");
 		assertTrue(Arrays.equals(ref_data, sound.getSoundData()));
 	}
 }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestAddingSlides.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestAddingSlides.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestAddingSlides.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestAddingSlides.java Sun Aug 23 12:34:24 2009
@@ -30,6 +30,7 @@
 import org.apache.poi.hslf.record.UserEditAtom;
 import org.apache.poi.hslf.record.Document;
 import org.apache.poi.hslf.model.*;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Tests that SlideShow adds additional sheets properly
@@ -56,14 +57,12 @@
 		hss_empty = HSLFSlideShow.create();
 		ss_empty = new SlideShow(hss_empty);
 
-		String dirname = System.getProperty("HSLF.testdata.path");
+        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
 
-		String filename = dirname + "/Single_Coloured_Page.ppt";
-		hss_one = new HSLFSlideShow(filename);
+		hss_one = new HSLFSlideShow(slTests.openResourceAsStream("Single_Coloured_Page.ppt"));
 		ss_one = new SlideShow(hss_one);
 
-		filename = dirname + "/basic_test_ppt_file.ppt";
-		hss_two = new HSLFSlideShow(filename);
+		hss_two = new HSLFSlideShow(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
 		ss_two = new SlideShow(hss_two);
 	}
 
@@ -274,8 +273,8 @@
 
 
     public void test47261() throws Exception {
-        File src = new File(System.getProperty("HSLF.testdata.path"), "47261.ppt");
-        SlideShow ppt = new SlideShow(new FileInputStream(src));
+        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
+        SlideShow ppt = new SlideShow(slTests.openResourceAsStream("47261.ppt"));
         Slide[] slides = ppt.getSlides();
         Document doc = ppt.getDocumentRecord();
         assertNotNull(doc.getSlideSlideListWithText());

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java Sun Aug 23 12:34:24 2009
@@ -17,8 +17,6 @@
 
 package org.apache.poi.hslf.usermodel;
 
-import java.io.File;
-import java.io.FileInputStream;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -44,6 +42,7 @@
 import org.apache.poi.hslf.model.TextRun;
 import org.apache.poi.hslf.model.TextShape;
 import org.apache.poi.hslf.model.TitleMaster;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Testcases for bugs entered in bugzilla
@@ -52,15 +51,13 @@
  * @author Yegor Kozlov
  */
 public final class TestBugs extends TestCase {
-    protected String cwd = System.getProperty("HSLF.testdata.path");
+    private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
 
     /**
      * Bug 41384: Array index wrong in record creation
      */
     public void test41384() throws Exception {
-        FileInputStream is = new FileInputStream(new File(cwd, "41384.ppt"));
-        HSLFSlideShow hslf = new HSLFSlideShow(is);
-        is.close();
+        HSLFSlideShow hslf = new HSLFSlideShow(_slTests.openResourceAsStream("41384.ppt"));
 
         SlideShow ppt = new SlideShow(hslf);
         assertTrue("No Exceptions while reading file", true);
@@ -78,9 +75,7 @@
      * when the RichTextRun comes from a Notes model object
      */
     public void test42474_1() throws Exception {
-        FileInputStream is = new FileInputStream(new File(cwd, "42474-1.ppt"));
-        HSLFSlideShow hslf = new HSLFSlideShow(is);
-        is.close();
+        HSLFSlideShow hslf = new HSLFSlideShow(_slTests.openResourceAsStream("42474-1.ppt"));
 
         SlideShow ppt = new SlideShow(hslf);
         assertTrue("No Exceptions while reading file", true);
@@ -108,9 +103,7 @@
      * Second fix from Bug 42474: Incorrect matching of notes to slides
      */
     public void test42474_2() throws Exception {
-        FileInputStream is = new FileInputStream(new File(cwd, "42474-2.ppt"));
-        HSLFSlideShow hslf = new HSLFSlideShow(is);
-        is.close();
+        HSLFSlideShow hslf = new HSLFSlideShow(_slTests.openResourceAsStream("42474-2.ppt"));
 
         SlideShow ppt = new SlideShow(hslf);
 
@@ -140,9 +133,7 @@
      * Bug 42485: All TextBoxes inside ShapeGroups have null TextRuns
      */
     public void test42485 () throws Exception {
-        FileInputStream is = new FileInputStream(new File(cwd, "42485.ppt"));
-        HSLFSlideShow hslf = new HSLFSlideShow(is);
-        is.close();
+        HSLFSlideShow hslf = new HSLFSlideShow(_slTests.openResourceAsStream("42485.ppt"));
 
         SlideShow ppt = new SlideShow(hslf);
         Shape[] shape = ppt.getSlides()[0].getShapes();
@@ -164,9 +155,7 @@
      * Bug 42484: NullPointerException from ShapeGroup.getAnchor()
      */
     public void test42484 () throws Exception {
-        FileInputStream is = new FileInputStream(new File(cwd, "42485.ppt")); //test file is the same as for bug 42485
-        HSLFSlideShow hslf = new HSLFSlideShow(is);
-        is.close();
+        HSLFSlideShow hslf = new HSLFSlideShow(_slTests.openResourceAsStream("42485.ppt"));
 
         SlideShow ppt = new SlideShow(hslf);
         Shape[] shape = ppt.getSlides()[0].getShapes();
@@ -187,9 +176,7 @@
      * Bug 41381: Exception from Slide.getMasterSheet() on a seemingly valid PPT file
      */
     public void test41381() throws Exception {
-        FileInputStream is = new FileInputStream(new File(cwd, "alterman_security.ppt"));
-        HSLFSlideShow hslf = new HSLFSlideShow(is);
-        is.close();
+        HSLFSlideShow hslf = new HSLFSlideShow(_slTests.openResourceAsStream("alterman_security.ppt"));
 
         SlideShow ppt = new SlideShow(hslf);
         assertTrue("No Exceptions while reading file", true);
@@ -208,9 +195,7 @@
      * Bug 42486:  Failure parsing a seemingly valid PPT
      */
     public void test42486 () throws Exception {
-        FileInputStream is = new FileInputStream(new File(cwd, "42486.ppt"));
-        HSLFSlideShow hslf = new HSLFSlideShow(is);
-        is.close();
+        HSLFSlideShow hslf = new HSLFSlideShow(_slTests.openResourceAsStream("42486.ppt"));
 
         SlideShow ppt = new SlideShow(hslf);
         Slide[] slide = ppt.getSlides();
@@ -225,9 +210,7 @@
      * Bug 42524:  NPE in Shape.getShapeType()
      */
     public void test42524 () throws Exception {
-        FileInputStream is = new FileInputStream(new File(cwd, "42486.ppt")); //test file is the same as for Bug 42486
-        HSLFSlideShow hslf = new HSLFSlideShow(is);
-        is.close();
+        HSLFSlideShow hslf = new HSLFSlideShow(_slTests.openResourceAsStream("42486.ppt"));
 
         SlideShow ppt = new SlideShow(hslf);
         //walk down the tree and see if there were no errors while reading
@@ -254,9 +237,7 @@
      * Bug 42520:  NPE in Picture.getPictureData()
      */
     public void test42520 () throws Exception {
-        FileInputStream is = new FileInputStream(new File(cwd, "42520.ppt")); //test file is the same as for Bug 42486
-        HSLFSlideShow hslf = new HSLFSlideShow(is);
-        is.close();
+        HSLFSlideShow hslf = new HSLFSlideShow(_slTests.openResourceAsStream("42520.ppt"));
 
         SlideShow ppt = new SlideShow(hslf);
 
@@ -292,9 +273,7 @@
      * ( also fixed followup: getTextRuns() returns no text )
      */
     public void test38256 () throws Exception {
-        FileInputStream is = new FileInputStream(new File(cwd, "38256.ppt"));
-        SlideShow ppt = new SlideShow(is);
-        is.close();
+        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("38256.ppt"));
 
         assertTrue("No Exceptions while reading file", true);
 
@@ -321,9 +300,7 @@
      * ( also fixed followup: getTextRuns() returns no text )
      */
     public void test43781 () throws Exception {
-        FileInputStream is = new FileInputStream(new File(cwd, "43781.ppt"));
-        SlideShow ppt = new SlideShow(is);
-        is.close();
+        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("43781.ppt"));
 
         assertTrue("No Exceptions while reading file", true);
 
@@ -354,9 +331,7 @@
      * Bug 44296: HSLF Not Extracting Slide Background Image
      */
     public void test44296  () throws Exception {
-        FileInputStream is = new FileInputStream(new File(cwd, "44296.ppt"));
-        SlideShow ppt = new SlideShow(is);
-        is.close();
+        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("44296.ppt"));
 
         Slide slide = ppt.getSlides()[0];
 
@@ -373,25 +348,21 @@
      * Bug 44770: java.lang.RuntimeException: Couldn't instantiate the class for type with id 1036 on class class org.apache.poi.hslf.record.PPDrawing
      */
     public void test44770() throws Exception {
-        FileInputStream is = new FileInputStream(new File(cwd, "44770.ppt"));
         try {
-            new SlideShow(is);
+             new SlideShow(_slTests.openResourceAsStream("44770.ppt"));
         } catch (RuntimeException e) {
             if (e.getMessage().equals("Couldn't instantiate the class for type with id 1036 on class class org.apache.poi.hslf.record.PPDrawing")) {
                 throw new AssertionFailedError("Identified bug 44770");
             }
             throw e;
         }
-        is.close();
     }
 
     /**
      * Bug 41071: Will not extract text from Powerpoint TextBoxes
      */
     public void test41071() throws Exception {
-        FileInputStream is = new FileInputStream(new File(cwd, "41071.ppt"));
-        SlideShow ppt = new SlideShow(is);
-        is.close();
+        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("41071.ppt"));
 
         Slide slide = ppt.getSlides()[0];
         Shape[] sh = slide.getShapes();
@@ -411,13 +382,11 @@
      */
     public void test41711() throws Exception {
     	// New file is fine
-        FileInputStream is = new FileInputStream(new File(cwd, "SampleShow.ppt"));
-        SlideShow ppt = new SlideShow(is);
+        new SlideShow(_slTests.openResourceAsStream("SampleShow.ppt"));
 
         // PowerPoint 95 gives an old format exception
-        is = new FileInputStream(new File(cwd, "PPT95.ppt"));
         try {
-        	new SlideShow(is);
+        	new SlideShow(_slTests.openResourceAsStream("PPT95.ppt"));
         	fail("OldPowerPointFormatException should've been thrown");
         } catch(OldPowerPointFormatException e) {
         	// Good

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

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestMostRecentRecords.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestMostRecentRecords.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestMostRecentRecords.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestMostRecentRecords.java Sun Aug 23 12:34:24 2009
@@ -21,6 +21,7 @@
 import junit.framework.TestCase;
 import org.apache.poi.hslf.*;
 import org.apache.poi.hslf.record.*;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Tests that SlideShow finds the right records as its most recent ones
@@ -34,9 +35,8 @@
 	private SlideShow ss;
 
 	public TestMostRecentRecords() throws Exception {
-		String dirname = System.getProperty("HSLF.testdata.path");
-		String filename = dirname + "/basic_test_ppt_file.ppt";
-		hss = new HSLFSlideShow(filename);
+        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
+		hss = new HSLFSlideShow(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
 		ss = new SlideShow(hss);
 	}
 

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestNotesText.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestNotesText.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestNotesText.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestNotesText.java Sun Aug 23 12:34:24 2009
@@ -21,6 +21,7 @@
 import junit.framework.TestCase;
 import org.apache.poi.hslf.*;
 import org.apache.poi.hslf.model.*;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Tests that SlideShow returns MetaSheets which have the right text in them
@@ -32,9 +33,8 @@
 	private SlideShow ss;
 
 	public TestNotesText() throws Exception {
-		String dirname = System.getProperty("HSLF.testdata.path");
-		String filename = dirname + "/basic_test_ppt_file.ppt";
-		HSLFSlideShow hss = new HSLFSlideShow(filename);
+        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
+		HSLFSlideShow hss = new HSLFSlideShow(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
 		ss = new SlideShow(hss);
 	}
 

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestPictures.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestPictures.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestPictures.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestPictures.java Sun Aug 23 12:34:24 2009
@@ -20,6 +20,7 @@
 import org.apache.poi.hslf.*;
 import org.apache.poi.hslf.blip.*;
 import org.apache.poi.hslf.model.*;
+import org.apache.poi.POIDataSamples;
 import junit.framework.TestCase;
 
 import java.io.*;
@@ -31,12 +32,9 @@
  * @author Yegor Kozlov
  */
 public final class TestPictures extends TestCase{
+    private static POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
 
-    protected File cwd;
-
-    public void setUp() {
-        cwd = new File(System.getProperty("HSLF.testdata.path"));
-    }
+    //protected File cwd;
 
     /**
      * Test read/write Macintosh PICT
@@ -45,8 +43,8 @@
         SlideShow ppt = new SlideShow();
 
         Slide slide = ppt.createSlide();
-        File img = new File(cwd, "cow.pict");
-        int idx = ppt.addPicture(img, Picture.PICT);
+        byte[] src_bytes = slTests.readFile("cow.pict");
+        int idx = ppt.addPicture(src_bytes, Picture.PICT);
         Picture pict = new Picture(idx);
         assertEquals(idx, pict.getPictureIndex());
         slide.addShape(pict);
@@ -73,7 +71,6 @@
         assertEquals(Picture.PICT, pictures[0].getType());
         assertTrue(pictures[0] instanceof PICT);
         //compare the content of the initial file with what is stored in the PictureData
-        byte[] src_bytes = read(img);
         byte[] ppt_bytes = pictures[0].getData();
         assertEquals(src_bytes.length, ppt_bytes.length);
         //in PICT the first 512 bytes are MAC specific and may not be preserved, ignore them
@@ -91,8 +88,8 @@
         SlideShow ppt = new SlideShow();
 
         Slide slide = ppt.createSlide();
-        File img = new File(cwd, "santa.wmf");
-        int idx = ppt.addPicture(img, Picture.WMF);
+        byte[] src_bytes = slTests.readFile("santa.wmf");
+        int idx = ppt.addPicture(src_bytes, Picture.WMF);
         Picture pict = new Picture(idx);
         assertEquals(idx, pict.getPictureIndex());
         slide.addShape(pict);
@@ -119,7 +116,6 @@
         assertEquals(Picture.WMF, pictures[0].getType());
         assertTrue(pictures[0] instanceof WMF);
         //compare the content of the initial file with what is stored in the PictureData
-        byte[] src_bytes = read(img);
         byte[] ppt_bytes = pictures[0].getData();
         assertEquals(src_bytes.length, ppt_bytes.length);
         //in WMF the first 22 bytes - is a metafile header
@@ -137,8 +133,9 @@
         SlideShow ppt = new SlideShow();
 
         Slide slide = ppt.createSlide();
-        File img = new File(cwd, "wrench.emf");
-        int idx = ppt.addPicture(img, Picture.EMF);
+        byte[] src_bytes = slTests.readFile("wrench.emf");
+        int idx = ppt.addPicture(src_bytes, Picture.EMF);
+
         Picture pict = new Picture(idx);
         assertEquals(idx, pict.getPictureIndex());
         slide.addShape(pict);
@@ -165,7 +162,6 @@
         assertEquals(Picture.EMF, pictures[0].getType());
         assertTrue(pictures[0] instanceof EMF);
         //compare the content of the initial file with what is stored in the PictureData
-        byte[] src_bytes = read(img);
         byte[] ppt_bytes = pictures[0].getData();
         assertTrue(Arrays.equals(src_bytes, ppt_bytes));
     }
@@ -177,8 +173,8 @@
         SlideShow ppt = new SlideShow();
 
         Slide slide = ppt.createSlide();
-        File img = new File(cwd, "tomcat.png");
-        int idx = ppt.addPicture(img, Picture.PNG);
+        byte[] src_bytes = slTests.readFile("tomcat.png");
+        int idx = ppt.addPicture(src_bytes, Picture.PNG);
         Picture pict = new Picture(idx);
         assertEquals(idx, pict.getPictureIndex());
         slide.addShape(pict);
@@ -205,7 +201,6 @@
         assertEquals(Picture.PNG, pictures[0].getType());
         assertTrue(pictures[0] instanceof PNG);
         //compare the content of the initial file with what is stored in the PictureData
-        byte[] src_bytes = read(img);
         byte[] ppt_bytes = pictures[0].getData();
         assertTrue(Arrays.equals(src_bytes, ppt_bytes));
     }
@@ -217,8 +212,9 @@
         SlideShow ppt = new SlideShow();
 
         Slide slide = ppt.createSlide();
-        File img = new File(cwd, "clock.jpg");
-        int idx = ppt.addPicture(img, Picture.JPEG);
+        byte[] src_bytes = slTests.readFile("clock.jpg");
+        int idx = ppt.addPicture(src_bytes, Picture.JPEG);
+
         Picture pict = new Picture(idx);
         assertEquals(idx, pict.getPictureIndex());
         slide.addShape(pict);
@@ -245,7 +241,6 @@
         assertEquals(Picture.JPEG, pictures[0].getType());
         assertTrue(pictures[0] instanceof JPEG);
         //compare the content of the initial file with what is stored in the PictureData
-        byte[] src_bytes = read(img);
         byte[] ppt_bytes = pictures[0].getData();
         assertTrue(Arrays.equals(src_bytes, ppt_bytes));
     }
@@ -257,13 +252,8 @@
         SlideShow ppt = new SlideShow();
 
         Slide slide = ppt.createSlide();
-        File img = new File(cwd, "sci_cec.dib");
-
-        // Check we can read the test DIB image
-        assertTrue(img.exists());
-
-        // Add the image
-        int idx = ppt.addPicture(img, Picture.DIB);
+        byte[] src_bytes = slTests.readFile("sci_cec.dib");
+        int idx = ppt.addPicture(src_bytes, Picture.DIB);
         Picture pict = new Picture(idx);
         assertEquals(idx, pict.getPictureIndex());
         slide.addShape(pict);
@@ -290,23 +280,11 @@
         assertEquals(Picture.DIB, pictures[0].getType());
         assertTrue(pictures[0] instanceof DIB);
         //compare the content of the initial file with what is stored in the PictureData
-        byte[] src_bytes = read(img);
         byte[] ppt_bytes = pictures[0].getData();
         assertTrue(Arrays.equals(src_bytes, ppt_bytes));
     }
 
     /**
-     * Read file into a byte array
-     */
-    protected byte[] read(File f) throws IOException {
-        byte[] bytes = new byte[(int)f.length()];
-        FileInputStream is = new FileInputStream(f);
-        is.read(bytes);
-        is.close();
-        return bytes;
-    }
-
-    /**
      * Read pictures in different formats from a reference slide show
      */
     public void testReadPictures() throws Exception {
@@ -315,7 +293,7 @@
         Picture pict;
         PictureData pdata;
 
-        SlideShow ppt = new SlideShow(new HSLFSlideShow(new File(cwd, "pictures.ppt").getPath()));
+        SlideShow ppt = new SlideShow(slTests.openResourceAsStream("pictures.ppt"));
         Slide[] slides = ppt.getSlides();
         PictureData[] pictures = ppt.getPictureData();
         assertEquals(5, pictures.length);
@@ -325,7 +303,7 @@
         assertTrue(pdata instanceof JPEG);
         assertEquals(Picture.JPEG, pdata.getType());
         src_bytes = pdata.getData();
-        ppt_bytes = read(new File(cwd, "clock.jpg"));
+        ppt_bytes = slTests.readFile("clock.jpg");
         assertTrue(Arrays.equals(src_bytes, ppt_bytes));
 
         pict = (Picture)slides[1].getShapes()[0]; //the second slide contains PNG
@@ -333,7 +311,7 @@
         assertTrue(pdata instanceof PNG);
         assertEquals(Picture.PNG, pdata.getType());
         src_bytes = pdata.getData();
-        ppt_bytes = read(new File(cwd, "tomcat.png"));
+        ppt_bytes = slTests.readFile("tomcat.png");
         assertTrue(Arrays.equals(src_bytes, ppt_bytes));
 
         pict = (Picture)slides[2].getShapes()[0]; //the third slide contains WMF
@@ -341,7 +319,7 @@
         assertTrue(pdata instanceof WMF);
         assertEquals(Picture.WMF, pdata.getType());
         src_bytes = pdata.getData();
-        ppt_bytes = read(new File(cwd, "santa.wmf"));
+        ppt_bytes = slTests.readFile("santa.wmf");
         assertEquals(src_bytes.length, ppt_bytes.length);
         //ignore the first 22 bytes - it is a WMF metafile header
         b1 = new byte[src_bytes.length-22];
@@ -355,7 +333,7 @@
         assertTrue(pdata instanceof PICT);
         assertEquals(Picture.PICT, pdata.getType());
         src_bytes = pdata.getData();
-        ppt_bytes = read(new File(cwd, "cow.pict"));
+        ppt_bytes = slTests.readFile("cow.pict");
         assertEquals(src_bytes.length, ppt_bytes.length);
         //ignore the first 512 bytes - it is a MAC specific crap
         b1 = new byte[src_bytes.length-512];
@@ -369,7 +347,7 @@
         assertTrue(pdata instanceof EMF);
         assertEquals(Picture.EMF, pdata.getType());
         src_bytes = pdata.getData();
-        ppt_bytes = read(new File(cwd, "wrench.emf"));
+        ppt_bytes = slTests.readFile("wrench.emf");
         assertTrue(Arrays.equals(src_bytes, ppt_bytes));
 
     }
@@ -379,7 +357,7 @@
 	 *  crazy pictures of type 0, we do our best.
 	 */
 	public void testZeroPictureType() throws Exception {
-		HSLFSlideShow hslf = new HSLFSlideShow(new File(cwd, "PictureTypeZero.ppt").getPath());
+		HSLFSlideShow hslf = new HSLFSlideShow(slTests.openResourceAsStream("PictureTypeZero.ppt"));
 
 		// Should still have 2 real pictures
 		assertEquals(2, hslf.getPictures().length);
@@ -409,7 +387,7 @@
 	}
 
 	public void testZeroPictureLength() throws Exception {
-		HSLFSlideShow hslf = new HSLFSlideShow(new File(cwd, "PictureLengthZero.ppt").getPath());
+		HSLFSlideShow hslf = new HSLFSlideShow(slTests.openResourceAsStream("PictureLengthZero.ppt"));
 
 		// Should still have 2 real pictures
 		assertEquals(2, hslf.getPictures().length);
@@ -453,7 +431,7 @@
     }
 
     public void testGetPictureName() throws Exception {
-        SlideShow ppt = new SlideShow(new HSLFSlideShow(new File(cwd, "ppt_with_png.ppt").getPath()));
+        SlideShow ppt = new SlideShow(slTests.openResourceAsStream("ppt_with_png.ppt"));
         Slide slide = ppt.getSlides()[0];
 
         Picture p = (Picture)slide.getShapes()[0]; //the first slide contains JPEG
@@ -464,7 +442,7 @@
         SlideShow ppt = new SlideShow();
 
         Slide slide = ppt.createSlide();
-        File img = new File(cwd, "tomcat.png");
+        byte[] img = slTests.readFile("tomcat.png");
         int idx = ppt.addPicture(img, Picture.PNG);
         Picture pict = new Picture(idx);
         pict.setPictureName("tomcat.png");

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestReOrderingSlides.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestReOrderingSlides.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestReOrderingSlides.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestReOrderingSlides.java Sun Aug 23 12:34:24 2009
@@ -24,6 +24,7 @@
 import junit.framework.TestCase;
 import org.apache.poi.hslf.*;
 import org.apache.poi.hslf.model.*;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Tests that SlideShow can re-order slides properly
@@ -47,18 +48,15 @@
 	 * Create/open the slideshows
 	 */
 	public void setUp() throws Exception {
-		String dirname = System.getProperty("HSLF.testdata.path");
+        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
 
-		String filename = dirname + "/Single_Coloured_Page.ppt";
-		hss_one = new HSLFSlideShow(filename);
+		hss_one = new HSLFSlideShow(slTests.openResourceAsStream("Single_Coloured_Page.ppt"));
 		ss_one = new SlideShow(hss_one);
 
-		filename = dirname + "/basic_test_ppt_file.ppt";
-		hss_two = new HSLFSlideShow(filename);
+		hss_two = new HSLFSlideShow(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
 		ss_two = new SlideShow(hss_two);
 
-		filename = dirname + "/incorrect_slide_order.ppt";
-		hss_three = new HSLFSlideShow(filename);
+		hss_three = new HSLFSlideShow(slTests.openResourceAsStream("incorrect_slide_order.ppt"));
 		ss_three = new SlideShow(hss_three);
 	}
 

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRecordSetup.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRecordSetup.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRecordSetup.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRecordSetup.java Sun Aug 23 12:34:24 2009
@@ -23,6 +23,7 @@
 import org.apache.poi.hslf.record.ParentAwareRecord;
 import org.apache.poi.hslf.record.Record;
 import org.apache.poi.hslf.record.RecordContainer;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Tests that the record setup done by SlideShow
@@ -37,9 +38,8 @@
 	private HSLFSlideShow hss;
 
 	public TestRecordSetup() throws Exception {
-		String dirname = System.getProperty("HSLF.testdata.path");
-		String filename = dirname + "/basic_test_ppt_file.ppt";
-		hss = new HSLFSlideShow(filename);
+        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
+		hss = new HSLFSlideShow(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
 		ss = new SlideShow(hss);
 	}
 

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java Sun Aug 23 12:34:24 2009
@@ -19,7 +19,6 @@
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.File;
 import java.io.FileInputStream;
 
 import junit.framework.TestCase;
@@ -30,6 +29,7 @@
 import org.apache.poi.hslf.model.TextRun;
 import org.apache.poi.hslf.record.Record;
 import org.apache.poi.hslf.record.SlideListWithText;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Test that the friendly getters and setters on RichTextRun
@@ -38,6 +38,8 @@
  * @author Nick Burch (nick at torchbox dot com)
  */
 public final class TestRichTextRun extends TestCase {
+    private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
+
 	// SlideShow primed on the test data
 	private SlideShow ss;
 	private SlideShow ssRichA;
@@ -50,27 +52,23 @@
 	private static String filenameC;
 
 	protected void setUp() throws Exception {
-		String dirname = System.getProperty("HSLF.testdata.path");
 
 		// Basic (non rich) test file
-		String filename = dirname + "/basic_test_ppt_file.ppt";
-		hss = new HSLFSlideShow(filename);
+        hss = new HSLFSlideShow(_slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
 		ss = new SlideShow(hss);
 
 		// Rich test file A
-		filename = dirname + "/Single_Coloured_Page.ppt";
-		hssRichA = new HSLFSlideShow(filename);
+		hssRichA = new HSLFSlideShow(_slTests.openResourceAsStream("Single_Coloured_Page.ppt"));
 		ssRichA = new SlideShow(hssRichA);
 
 		// Rich test file B
-		filename = dirname + "/Single_Coloured_Page_With_Fonts_and_Alignments.ppt";
-		hssRichB = new HSLFSlideShow(filename);
+		hssRichB = new HSLFSlideShow(_slTests.openResourceAsStream("Single_Coloured_Page_With_Fonts_and_Alignments.ppt"));
 		ssRichB = new SlideShow(hssRichB);
 
 		// Rich test file C - has paragraph styles that run out before
 		//   the character ones do
-		filenameC = dirname + "/ParagraphStylesShorterThanCharStyles.ppt";
-		hssRichC = new HSLFSlideShow(filenameC);
+		filenameC = "ParagraphStylesShorterThanCharStyles.ppt";
+        hssRichC = new HSLFSlideShow(_slTests.openResourceAsStream(filenameC));
 		ssRichC = new SlideShow(hssRichC);
 	}
 
@@ -375,7 +373,7 @@
 	 */
 	private void assertMatchesSLTWC(SlideShow s) throws Exception {
 		// Grab a new copy of slideshow C
-		SlideShow refC = new SlideShow(new HSLFSlideShow(filenameC));
+		SlideShow refC = new SlideShow(_slTests.openResourceAsStream(filenameC));
 
 		// Write out the 2nd SLWT in the active document
 		SlideListWithText refSLWT = refC.getDocumentRecord().getSlideListWithTexts()[1];
@@ -449,7 +447,7 @@
 	}
 
 	public void testIndentationLevel() throws Exception {
-		SlideShow ppt = new SlideShow(new HSLFSlideShow(new File(System.getProperty("HSLF.testdata.path"), "ParagraphStylesShorterThanCharStyles.ppt").getPath()));
+		SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("ParagraphStylesShorterThanCharStyles.ppt"));
 		Slide[] sl = ppt.getSlides();
 		for (int i = 0; i < sl.length; i++) {
 			TextRun[] txt = sl[i].getTextRuns();
@@ -465,9 +463,7 @@
 	}
 
 	public void testReadParagraphStyles() throws Exception {
-		FileInputStream is = new FileInputStream(new File(System.getProperty("HSLF.testdata.path"), "bullets.ppt"));
-		SlideShow ppt = new SlideShow(is);
-		is.close();
+		SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("bullets.ppt"));
 		assertTrue("No Exceptions while reading file", true);
 
 		RichTextRun rt;
@@ -560,9 +556,7 @@
 	}
 
 	public void testAddText() throws Exception {
-		FileInputStream is = new FileInputStream(new File(System.getProperty("HSLF.testdata.path"), "bullets.ppt"));
-		SlideShow ppt = new SlideShow(is);
-		is.close();
+		SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("bullets.ppt"));
 		assertTrue("No Exceptions while reading file", true);
 
 		RichTextRun rt;

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSheetText.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSheetText.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSheetText.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSheetText.java Sun Aug 23 12:34:24 2009
@@ -21,6 +21,7 @@
 import junit.framework.TestCase;
 import org.apache.poi.hslf.*;
 import org.apache.poi.hslf.model.*;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Tests that SlideShow returns Sheets which have the right text in them
@@ -32,9 +33,8 @@
 	private SlideShow ss;
 
 	public TestSheetText() throws Exception {
-		String dirname = System.getProperty("HSLF.testdata.path");
-		String filename = dirname + "/basic_test_ppt_file.ppt";
-		HSLFSlideShow hss = new HSLFSlideShow(filename);
+        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
+		HSLFSlideShow hss = new HSLFSlideShow(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
 		ss = new SlideShow(hss);
 	}
 
@@ -63,9 +63,8 @@
 	 * (Make sure we don't screw up / throw an exception etc)
 	 */
 	public void testWithShortTextPropData() throws Exception {
-		String dirname = System.getProperty("HSLF.testdata.path");
-		String filename = dirname + "/iisd_report.ppt";
-		HSLFSlideShow hss = new HSLFSlideShow(filename);
+        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
+		HSLFSlideShow hss = new HSLFSlideShow(slTests.openResourceAsStream("iisd_report.ppt"));
 		SlideShow sss = new SlideShow(hss);
 
 		// Should come out with 10 slides, no notes

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSlideOrdering.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSlideOrdering.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSlideOrdering.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSlideOrdering.java Sun Aug 23 12:34:24 2009
@@ -20,6 +20,7 @@
 import junit.framework.TestCase;
 import org.apache.poi.hslf.*;
 import org.apache.poi.hslf.model.*;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Tests that SlideShow returns Sheets in the right order
@@ -27,20 +28,18 @@
  * @author Nick Burch (nick at torchbox dot com)
  */
 public final class TestSlideOrdering extends TestCase {
+    private static POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
+
 	// Simple slideshow, record order matches slide order
 	private SlideShow ssA;
 	// Complex slideshow, record order doesn't match slide order
 	private SlideShow ssB;
 
 	public TestSlideOrdering() throws Exception {
-		String dirname = System.getProperty("HSLF.testdata.path");
-
-		String filenameA = dirname + "/basic_test_ppt_file.ppt";
-		HSLFSlideShow hssA = new HSLFSlideShow(filenameA);
+		HSLFSlideShow hssA = new HSLFSlideShow(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
 		ssA = new SlideShow(hssA);
 
-		String filenameB = dirname + "/incorrect_slide_order.ppt";
-		HSLFSlideShow hssB = new HSLFSlideShow(filenameB);
+		HSLFSlideShow hssB = new HSLFSlideShow(slTests.openResourceAsStream("incorrect_slide_order.ppt"));
 		ssB = new SlideShow(hssB);
 	}
 
@@ -85,7 +84,9 @@
 	 *            array of reference slide titles
 	 */
 	protected void assertSlideOrdering(String filename, String[] titles) throws Exception {
-		SlideShow ppt = new SlideShow(new HSLFSlideShow(filename));
+        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
+
+        SlideShow ppt = new SlideShow(slTests.openResourceAsStream(filename));
 		Slide[] slide = ppt.getSlides();
 
 		assertEquals(titles.length, slide.length);
@@ -96,25 +97,23 @@
 	}
 
 	public void testTitles() throws Exception {
-		String dirname = System.getProperty("HSLF.testdata.path");
-
-		assertSlideOrdering(dirname + "/basic_test_ppt_file.ppt", new String[] {
+		assertSlideOrdering("basic_test_ppt_file.ppt", new String[] {
 				"This is a test title", "This is the title on page 2" });
 
-		assertSlideOrdering(dirname + "/incorrect_slide_order.ppt", new String[] { "Slide 1",
+		assertSlideOrdering("incorrect_slide_order.ppt", new String[] { "Slide 1",
 				"Slide 2", "Slide 3" });
 
-		assertSlideOrdering(dirname + "/next_test_ppt_file.ppt", new String[] {
+		assertSlideOrdering("next_test_ppt_file.ppt", new String[] {
 				"This is a test title", "This is the title on page 2" });
 
-		assertSlideOrdering(dirname + "/Single_Coloured_Page.ppt",
+		assertSlideOrdering("Single_Coloured_Page.ppt",
 				new String[] { "This is a title, it" + (char) 0x2019 + "s in black" });
 
-		assertSlideOrdering(dirname + "/Single_Coloured_Page_With_Fonts_and_Alignments.ppt",
+		assertSlideOrdering("Single_Coloured_Page_With_Fonts_and_Alignments.ppt",
 				new String[] { "This is a title, it" + (char) 0x2019 + "s in black" });
 
 		assertSlideOrdering(
-				dirname + "/ParagraphStylesShorterThanCharStyles.ppt",
+				"ParagraphStylesShorterThanCharStyles.ppt",
 				new String[] {
 						"ROMANCE: AN ANALYSIS",
 						"AGENDA",

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSoundData.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSoundData.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSoundData.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestSoundData.java Sun Aug 23 12:34:24 2009
@@ -17,11 +17,10 @@
 
 package org.apache.poi.hslf.usermodel;
 
-import java.io.File;
-import java.io.FileInputStream;
 import java.util.Arrays;
 
 import junit.framework.TestCase;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Test reading sound data from a ppt
@@ -29,28 +28,16 @@
  * @author Yegor Kozlov
  */
 public final class TestSoundData extends TestCase{
-
-    protected File cwd;
-
-    public void setUp() {
-        cwd = new File(System.getProperty("HSLF.testdata.path"));
-    }
+    private static POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
 
     /**
      * Read a reference sound file from disk and compare it from the data extracted from the slide show
      */
     public void testSounds() throws Exception {
         //read the reference sound file
-        File f = new File(cwd, "ringin.wav");
-        int length = (int)f.length();
-        byte[] ref_data = new byte[length];
-        FileInputStream is = new FileInputStream(f);
-        is.read(ref_data);
-        is.close();
-
-        is = new FileInputStream(new File(cwd, "sound.ppt"));
-        SlideShow ppt = new SlideShow(is);
-        is.close();
+        byte[] ref_data = slTests.readFile("ringin.wav");
+
+        SlideShow ppt = new SlideShow(slTests.openResourceAsStream("sound.ppt"));
 
         SoundData[] sound = ppt.getSoundData();
         assertEquals("Expected 1 sound", 1, sound.length);

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/model/TestBlankFileRead.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/model/TestBlankFileRead.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/model/TestBlankFileRead.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/model/TestBlankFileRead.java Sun Aug 23 12:34:24 2009
@@ -21,6 +21,7 @@
 
 import org.apache.poi.hsmf.MAPIMessage;
 import org.apache.poi.hsmf.exceptions.ChunkNotFoundException;
+import org.apache.poi.POIDataSamples;
 
 import junit.framework.TestCase;
 
@@ -38,8 +39,8 @@
 	 * Initialize this test, load up the blank.msg mapi message.
 	 */
 	public TestBlankFileRead() throws IOException {
-		String dirname = System.getProperty("HSMF.testdata.path");
-		this.mapiMessage = new MAPIMessage(dirname + "/blank.msg");
+        POIDataSamples samples = POIDataSamples.getHSMFInstance();
+		this.mapiMessage = new MAPIMessage(samples.openResourceAsStream("blank.msg"));
 	}
 
 	/**

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/model/TestFileWithAttachmentsRead.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/model/TestFileWithAttachmentsRead.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/model/TestFileWithAttachmentsRead.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/model/TestFileWithAttachmentsRead.java Sun Aug 23 12:34:24 2009
@@ -27,6 +27,7 @@
 
 import org.apache.poi.hsmf.MAPIMessage;
 import org.apache.poi.hsmf.exceptions.ChunkNotFoundException;
+import org.apache.poi.POIDataSamples;
 
 /**
  * Tests to verify that we can read attachments from msg file
@@ -42,8 +43,8 @@
 	 * @throws Exception
 	 */
 	public TestFileWithAttachmentsRead() throws IOException {
-		String dirname = System.getProperty("HSMF.testdata.path");
-		this.mapiMessage = new MAPIMessage(dirname + "/attachment_test_msg.msg");
+        POIDataSamples samples = POIDataSamples.getHSMFInstance();
+		this.mapiMessage = new MAPIMessage(samples.openResourceAsStream("attachment_test_msg.msg"));
 	}
 
 	/**

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/model/TestOutlook30FileRead.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/model/TestOutlook30FileRead.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/model/TestOutlook30FileRead.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/model/TestOutlook30FileRead.java Sun Aug 23 12:34:24 2009
@@ -21,6 +21,7 @@
 
 import org.apache.poi.hsmf.MAPIMessage;
 import org.apache.poi.hsmf.exceptions.ChunkNotFoundException;
+import org.apache.poi.POIDataSamples;
 
 import junit.framework.TestCase;
 
@@ -35,8 +36,8 @@
 	 * @throws Exception
 	 */
 	public TestOutlook30FileRead() throws IOException {
-		String dirname = System.getProperty("HSMF.testdata.path");
-		this.mapiMessage = new MAPIMessage(dirname + "/outlook_30_msg.msg");
+        POIDataSamples samples = POIDataSamples.getHSMFInstance();
+		this.mapiMessage = new MAPIMessage(samples.openResourceAsStream("outlook_30_msg.msg"));
 	}
 
 	/**

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/model/TestSimpleFileRead.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/model/TestSimpleFileRead.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/model/TestSimpleFileRead.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hsmf/model/TestSimpleFileRead.java Sun Aug 23 12:34:24 2009
@@ -21,6 +21,7 @@
 
 import org.apache.poi.hsmf.MAPIMessage;
 import org.apache.poi.hsmf.exceptions.ChunkNotFoundException;
+import org.apache.poi.POIDataSamples;
 
 import junit.framework.TestCase;
 
@@ -38,8 +39,8 @@
 	 * @throws Exception
 	 */
 	public TestSimpleFileRead() throws IOException {
-		String dirname = System.getProperty("HSMF.testdata.path");
-		this.mapiMessage = new MAPIMessage(dirname + "/simple_test_msg.msg");
+        POIDataSamples samples = POIDataSamples.getHSMFInstance();
+		this.mapiMessage = new MAPIMessage(samples.openResourceAsStream("simple_test_msg.msg"));
 	}
 
 	/**

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/HWPFDocFixture.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/HWPFDocFixture.java?rev=806959&r1=806958&r2=806959&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/HWPFDocFixture.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/HWPFDocFixture.java Sun Aug 23 12:34:24 2009
@@ -20,6 +20,7 @@
 import org.apache.poi.hwpf.model.FileInformationBlock;
 import org.apache.poi.poifs.filesystem.DocumentEntry;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.POIDataSamples;
 
 
 public final class HWPFDocFixture
@@ -38,7 +39,7 @@
     try
     {
       POIFSFileSystem filesystem = new POIFSFileSystem(
-              HWPFTestDataSamples.openSampleFileStream("test.doc"));
+              POIDataSamples.getDocumentInstance().openResourceAsStream("test.doc"));
 
       DocumentEntry documentProps =
         (DocumentEntry) filesystem.getRoot().getEntry("WordDocument");



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


Mime
View raw message