poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r893900 - in /poi/trunk/src: ooxml/testcases/org/apache/poi/xssf/XSSFITestDataProvider.java testcases/org/apache/poi/hssf/HSSFITestDataProvider.java testcases/org/apache/poi/ss/ITestDataProvider.java
Date Fri, 25 Dec 2009 23:51:33 GMT
Author: josh
Date: Fri Dec 25 23:51:32 2009
New Revision: 893900

URL: http://svn.apache.org/viewvc?rev=893900&view=rev
Log:
Made public instance fields for ITestDataProvider singletons.

Modified:
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/XSSFITestDataProvider.java
    poi/trunk/src/testcases/org/apache/poi/hssf/HSSFITestDataProvider.java
    poi/trunk/src/testcases/org/apache/poi/ss/ITestDataProvider.java

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=893900&r1=893899&r2=893900&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 Fri Dec 25
23:51:32 2009
@@ -17,47 +17,43 @@
 
 package org.apache.poi.xssf;
 
+import org.apache.poi.POIDataSamples;
 import org.apache.poi.ss.ITestDataProvider;
 import org.apache.poi.ss.SpreadsheetVersion;
 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
  */
 public final class XSSFITestDataProvider implements ITestDataProvider {
+    public static final XSSFITestDataProvider instance = new XSSFITestDataProvider();
 
+    private XSSFITestDataProvider() {
+        // enforce singleton
+    }
+    public static XSSFITestDataProvider getInstance(){
+        return instance;
+    }
     public XSSFWorkbook openSampleWorkbook(String sampleFileName) {
         return XSSFTestDataSamples.openSampleWorkbook(sampleFileName);
     }
-
     public XSSFWorkbook writeOutAndReadBack(Workbook original) {
         if(!(original instanceof XSSFWorkbook)) {
             throw new IllegalArgumentException("Expected an instance of XSSFWorkbook");
         }
-
         return XSSFTestDataSamples.writeOutAndReadBack((XSSFWorkbook)original);
     }
-
     public XSSFWorkbook createWorkbook(){
         return new XSSFWorkbook();
     }
-
     public byte[] getTestDataFileContent(String fileName) {
         return POIDataSamples.getSpreadSheetInstance().readFile(fileName);
     }
-
     public SpreadsheetVersion getSpreadsheetVersion(){
         return SpreadsheetVersion.EXCEL2007;
     }
-
-    private XSSFITestDataProvider() {
-        // enforce singleton
-    }
-    private static XSSFITestDataProvider inst = new XSSFITestDataProvider();
-    public static XSSFITestDataProvider getInstance(){
-        return inst;
+    public String getStandardFileNameExtension() {
+        return "xlsx";
     }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/HSSFITestDataProvider.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/HSSFITestDataProvider.java?rev=893900&r1=893899&r2=893900&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/HSSFITestDataProvider.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/HSSFITestDataProvider.java Fri Dec 25 23:51:32
2009
@@ -17,44 +17,43 @@
 
 package org.apache.poi.hssf;
 
+import org.apache.poi.POIDataSamples;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.ss.ITestDataProvider;
 import org.apache.poi.ss.SpreadsheetVersion;
 import org.apache.poi.ss.usermodel.Workbook;
-import org.apache.poi.POIDataSamples;
 
 /**
  * @author Yegor Kozlov
  */
 public final class HSSFITestDataProvider implements ITestDataProvider {
+    public static final HSSFITestDataProvider instance = new HSSFITestDataProvider();
 
+    private HSSFITestDataProvider(){
+        // enforce singleton
+    }
+    public static HSSFITestDataProvider getInstance(){
+        return instance;
+    }
     public HSSFWorkbook openSampleWorkbook(String sampleFileName) {
-		return HSSFTestDataSamples.openSampleWorkbook(sampleFileName);
-	}
-
-	public HSSFWorkbook writeOutAndReadBack(Workbook original) {
+        return HSSFTestDataSamples.openSampleWorkbook(sampleFileName);
+    }
+    public HSSFWorkbook writeOutAndReadBack(Workbook original) {
         if(!(original instanceof HSSFWorkbook)) {
             throw new IllegalArgumentException("Expected an instance of HSSFWorkbook");
         }
-
         return HSSFTestDataSamples.writeOutAndReadBack((HSSFWorkbook)original);
-	}
-
+    }
     public HSSFWorkbook createWorkbook(){
         return new HSSFWorkbook();
     }
-
     public byte[] getTestDataFileContent(String fileName) {
         return POIDataSamples.getSpreadSheetInstance().readFile(fileName);
     }
-
     public SpreadsheetVersion getSpreadsheetVersion(){
         return SpreadsheetVersion.EXCEL97;
     }
-
-    private HSSFITestDataProvider(){}
-    private static HSSFITestDataProvider inst = new HSSFITestDataProvider();
-    public static HSSFITestDataProvider getInstance(){
-        return inst;
+    public String getStandardFileNameExtension() {
+        return "xls";
     }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/ss/ITestDataProvider.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/ITestDataProvider.java?rev=893900&r1=893899&r2=893900&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/ITestDataProvider.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/ITestDataProvider.java Fri Dec 25 23:51:32 2009
@@ -24,7 +24,7 @@
  */
 public interface ITestDataProvider {
     /**
-     * Override to provide HSSF / XSSF specific way for re-serialising a workbook
+     * Provides HSSF / XSSF specific way for re-serialising a workbook
      *
      * @param wb the workbook to re-serialize
      * @return the re-serialized workbook
@@ -32,7 +32,7 @@
     Workbook writeOutAndReadBack(Workbook wb);
 
     /**
-     * Override to provide way of loading HSSF / XSSF sample workbooks
+     * Provides way of loading HSSF / XSSF sample workbooks
      *
      * @param sampleFileName the file name to load
      * @return an instance of Workbook loaded from the supplied file name
@@ -40,7 +40,7 @@
     Workbook openSampleWorkbook(String sampleFileName);
 
     /**
-     * Override to provide way of creating HSSF / XSSF workbooks
+     * Provides way of creating HSSF / XSSF workbooks
      * @return an instance of Workbook
      */
     Workbook createWorkbook();
@@ -53,4 +53,9 @@
     byte[] getTestDataFileContent(String fileName);
 
     SpreadsheetVersion getSpreadsheetVersion();
+
+    /**
+     * @return "xls" or "xlsx"
+     */
+    String getStandardFileNameExtension();
 }



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


Mime
View raw message