poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cen...@apache.org
Subject svn commit: r1737242 - in /poi/trunk/src/integrationtest/org/apache/poi/stress: AbstractFileHandler.java HSSFFileHandler.java SpreadsheetHandler.java XSSFFileHandler.java
Date Thu, 31 Mar 2016 13:56:27 GMT
Author: centic
Date: Thu Mar 31 13:56:27 2016
New Revision: 1737242

URL: http://svn.apache.org/viewvc?rev=1737242&view=rev
Log:
Adjust integration tests, fix compilation warnings, make the check on "EXPECTED_EXTRACTOR_FAILURES"
actually work

Modified:
    poi/trunk/src/integrationtest/org/apache/poi/stress/AbstractFileHandler.java
    poi/trunk/src/integrationtest/org/apache/poi/stress/HSSFFileHandler.java
    poi/trunk/src/integrationtest/org/apache/poi/stress/SpreadsheetHandler.java
    poi/trunk/src/integrationtest/org/apache/poi/stress/XSSFFileHandler.java

Modified: poi/trunk/src/integrationtest/org/apache/poi/stress/AbstractFileHandler.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/integrationtest/org/apache/poi/stress/AbstractFileHandler.java?rev=1737242&r1=1737241&r2=1737242&view=diff
==============================================================================
--- poi/trunk/src/integrationtest/org/apache/poi/stress/AbstractFileHandler.java (original)
+++ poi/trunk/src/integrationtest/org/apache/poi/stress/AbstractFileHandler.java Thu Mar 31
13:56:27 2016
@@ -22,7 +22,6 @@ import static org.junit.Assert.assertNot
 
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.HashSet;
@@ -32,7 +31,6 @@ import org.apache.poi.POIOLE2TextExtract
 import org.apache.poi.POITextExtractor;
 import org.apache.poi.extractor.ExtractorFactory;
 import org.apache.poi.hpsf.extractor.HPSFPropertiesExtractor;
-import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
 import org.apache.xmlbeans.XmlException;
 
@@ -52,9 +50,7 @@ public abstract class AbstractFileHandle
         EXPECTED_EXTRACTOR_FAILURES.add("hmef/bug52400-winmail-simple.dat");
         EXPECTED_EXTRACTOR_FAILURES.add("hmef/bug52400-winmail-with-attachments.dat");
         EXPECTED_EXTRACTOR_FAILURES.add("hpsf/Test0313rur.adm");
-        EXPECTED_EXTRACTOR_FAILURES.add("hsmf/attachment_msg_pdf.msg");
         EXPECTED_EXTRACTOR_FAILURES.add("poifs/Notes.ole2");
-        EXPECTED_EXTRACTOR_FAILURES.add("slideshow/testPPT.thmx");
     }
 
     public void handleExtracting(File file) throws Exception {
@@ -94,7 +90,7 @@ public abstract class AbstractFileHandle
             assertNotNull(metadataExtractor.getText());
 
             assertFalse("Expected Extraction to fail for file " + file + " and handler "
+ this + ", but did not fail!", 
-                    EXPECTED_EXTRACTOR_FAILURES.contains(file));
+                    EXPECTED_EXTRACTOR_FAILURES.contains(file.getParentFile().getName() +
"/" + file.getName()));
             
             assertEquals("File should not be modified by extractor", length, file.length());
             assertEquals("File should not be modified by extractor", modified, file.lastModified());
@@ -114,7 +110,7 @@ public abstract class AbstractFileHandle
             	}
             }
         } catch (IllegalArgumentException e) {
-            if(!EXPECTED_EXTRACTOR_FAILURES.contains(file)) {
+            if(!EXPECTED_EXTRACTOR_FAILURES.contains(file.getParentFile().getName() + "/"
+ file.getName())) {
                 throw e;
             }
         } finally {
@@ -122,9 +118,7 @@ public abstract class AbstractFileHandle
         }
     }
 
-    private void handleExtractingAsStream(File file) throws FileNotFoundException,
-            IOException, InvalidFormatException, OpenXML4JException,
-            XmlException {
+    private void handleExtractingAsStream(File file) throws IOException, OpenXML4JException,
XmlException {
         InputStream stream = new FileInputStream(file);
         try {
             POITextExtractor streamExtractor = ExtractorFactory.createExtractor(stream);

Modified: poi/trunk/src/integrationtest/org/apache/poi/stress/HSSFFileHandler.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/integrationtest/org/apache/poi/stress/HSSFFileHandler.java?rev=1737242&r1=1737241&r2=1737242&view=diff
==============================================================================
--- poi/trunk/src/integrationtest/org/apache/poi/stress/HSSFFileHandler.java (original)
+++ poi/trunk/src/integrationtest/org/apache/poi/stress/HSSFFileHandler.java Thu Mar 31 13:56:27
2016
@@ -28,7 +28,7 @@ public class HSSFFileHandler extends Spr
 	@Override
     public void handleFile(InputStream stream) throws Exception {
 		HSSFWorkbook wb = new HSSFWorkbook(stream);
-		handleWorkbook(wb, ".xls");
+		handleWorkbook(wb);
 		
 		// TODO: some documents fail currently...
         //HSSFFormulaEvaluator evaluator = new HSSFFormulaEvaluator(wb);

Modified: poi/trunk/src/integrationtest/org/apache/poi/stress/SpreadsheetHandler.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/integrationtest/org/apache/poi/stress/SpreadsheetHandler.java?rev=1737242&r1=1737241&r2=1737242&view=diff
==============================================================================
--- poi/trunk/src/integrationtest/org/apache/poi/stress/SpreadsheetHandler.java (original)
+++ poi/trunk/src/integrationtest/org/apache/poi/stress/SpreadsheetHandler.java Thu Mar 31
13:56:27 2016
@@ -20,7 +20,6 @@ import static org.junit.Assert.assertNot
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
@@ -32,18 +31,18 @@ import org.apache.poi.ss.usermodel.Workb
 import org.apache.poi.util.RecordFormatException;
 
 public abstract class SpreadsheetHandler extends AbstractFileHandler {
-	public void handleWorkbook(Workbook wb, String extension) throws IOException {
+	public void handleWorkbook(Workbook wb) throws IOException {
 		// try to access some of the content
 		readContent(wb);
 		
 		// write out the file
-		ByteArrayOutputStream out = writeToArray(wb);
+		writeToArray(wb);
 		
 		// access some more content (we had cases where writing corrupts the data in memory)
 		readContent(wb);
 
 		// write once more
-		out = writeToArray(wb);
+		ByteArrayOutputStream out = writeToArray(wb);
 
 		// read in the writen file
 		Workbook read;
@@ -61,8 +60,7 @@ public abstract class SpreadsheetHandler
 		read.close();
 	}
 
-	private ByteArrayOutputStream writeToArray(Workbook wb)
-			throws FileNotFoundException, IOException {
+	private ByteArrayOutputStream writeToArray(Workbook wb) throws IOException {
 		ByteArrayOutputStream stream = new ByteArrayOutputStream();
 		try {
 			wb.write(stream);
@@ -88,7 +86,7 @@ public abstract class SpreadsheetHandler
 			
 			for(Row row : sheet) {
 			    for(Cell cell : row) {
-			        cell.toString();
+			        assertNotNull(cell.toString());
 			    }
 			}
 		}

Modified: poi/trunk/src/integrationtest/org/apache/poi/stress/XSSFFileHandler.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/integrationtest/org/apache/poi/stress/XSSFFileHandler.java?rev=1737242&r1=1737241&r2=1737242&view=diff
==============================================================================
--- poi/trunk/src/integrationtest/org/apache/poi/stress/XSSFFileHandler.java (original)
+++ poi/trunk/src/integrationtest/org/apache/poi/stress/XSSFFileHandler.java Thu Mar 31 13:56:27
2016
@@ -30,7 +30,6 @@ import java.util.Iterator;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.transform.TransformerException;
 
-import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
 import org.apache.poi.openxml4j.opc.OPCPackage;
 import org.apache.poi.util.IOUtils;
@@ -55,7 +54,7 @@ public class XSSFFileHandler extends Spr
         wb = new XSSFWorkbook(new ByteArrayInputStream(bytes));
 
         // use the combined handler for HSSF/XSSF
-        handleWorkbook(wb, ".xlsx");
+        handleWorkbook(wb);
         
         // TODO: some documents fail currently...
         //XSSFFormulaEvaluator evaluator = new XSSFFormulaEvaluator(wb);
@@ -73,8 +72,7 @@ public class XSSFFileHandler extends Spr
     }
 
 
-    private void checkXSSFReader(OPCPackage p)
-            throws IOException, OpenXML4JException, InvalidFormatException {
+    private void checkXSSFReader(OPCPackage p) throws IOException, OpenXML4JException {
         XSSFReader reader = new XSSFReader(p);
         
         // these can be null...



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


Mime
View raw message