poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cen...@apache.org
Subject svn commit: r1697326 - in /poi/trunk/src: ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java
Date Mon, 24 Aug 2015 08:12:01 GMT
Author: centic
Date: Mon Aug 24 08:12:01 2015
New Revision: 1697326

URL: http://svn.apache.org/r1697326
Log:
Reduce required memory in tests by not actually creating all the rows/cells when verifying
the max number of cellstyles. Hopefully this will avoid the OOMs that we see in various CI
environments currently while still verifying the limits correctly.

Modified:
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
    poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java?rev=1697326&r1=1697325&r2=1697326&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java Mon Aug
24 08:12:01 2015
@@ -741,6 +741,7 @@ public final class TestXSSFBugs extends
     /**
      * Excel .xls style indexed colours in a .xlsx file
      */
+    @SuppressWarnings("deprecation")
     @Test
     public void bug50786() throws Exception {
         XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("50786-indexed_colours.xlsx");
@@ -792,6 +793,7 @@ public final class TestXSSFBugs extends
      *  then being set explicitly still should allow the
      *  fetching of the RGB.
      */
+    @SuppressWarnings("deprecation")
     @Test
     public void bug50784() throws Exception {
         XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("50784-font_theme_colours.xlsx");
@@ -1802,7 +1804,7 @@ public final class TestXSSFBugs extends
         
         // Now check the spreadsheet itself
         try {
-            new XSSFWorkbook(pkg);
+            new XSSFWorkbook(pkg).close();
             fail("Should fail as too much expansion occurs");
         } catch(POIXMLException e) {
             // Expected
@@ -1848,7 +1850,7 @@ public final class TestXSSFBugs extends
         
         // XSSF Workbook gives helpful error
         try {
-            new XSSFWorkbook(pkg);
+            new XSSFWorkbook(pkg).close();
             fail(".xlsb files not supported");
         } catch (XLSBUnsupportedException e) {
             // Good, detected and warned
@@ -2359,7 +2361,7 @@ public final class TestXSSFBugs extends
     public void bug57880() throws Exception {
         int numStyles = 33000;
         XSSFWorkbook wb = new XSSFWorkbook();
-        XSSFSheet s = wb.createSheet("TestSheet");
+        //XSSFSheet s = wb.createSheet("TestSheet");
         XSSFDataFormat fmt = wb.getCreationHelper().createDataFormat();
         for (int i=1; i<numStyles; i++) {
             short df = fmt.getFormat("test"+i);
@@ -2369,11 +2371,11 @@ public final class TestXSSFBugs extends
             XSSFCellStyle style = wb.createCellStyle();
             assertEquals(i, style.getUIndex());
             style.setDataFormat(df);
-            XSSFCell c = s.createRow(i).createCell(0, Cell.CELL_TYPE_NUMERIC);
+            /*XSSFCell c = s.createRow(i).createCell(0, Cell.CELL_TYPE_NUMERIC);
             c.setCellStyle(style);
-            c.setCellValue(i);
+            c.setCellValue(i);*/
         }
-        
+
         // using temp file instead of ByteArrayOutputStream because of OOM in gump run
         File tmp = TempFile.createTempFile("poi-test", ".bug57880");
         FileOutputStream fos = new FileOutputStream(tmp);
@@ -2381,12 +2383,12 @@ public final class TestXSSFBugs extends
         fos.close();
         
         wb.close();
-        fmt = null; s = null; wb = null;
+        fmt = null; /*s = null;*/ wb = null;
         // System.gc();
         
         wb = new XSSFWorkbook(tmp);
         fmt = wb.getCreationHelper().createDataFormat();
-        s = wb.getSheetAt(0);
+        // s = wb.getSheetAt(0);
         for (int i=1; i<numStyles; i++) {
             XSSFCellStyle style = wb.getCellStyleAt((short)i);
             assertNotNull(style);

Modified: poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java?rev=1697326&r1=1697325&r2=1697326&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java Mon Aug
24 08:12:01 2015
@@ -30,7 +30,6 @@ import java.io.IOException;
 import java.text.AttributedString;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.Random;
 
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.hssf.util.PaneInformation;
@@ -1177,15 +1176,15 @@ public abstract class BaseTestBugzillaIs
     public void bug58260() throws IOException {
         //Create workbook and worksheet
         Workbook wb = _testDataProvider.createWorkbook();
-        Sheet worksheet = wb.createSheet("sample");
+        //Sheet worksheet = wb.createSheet("sample");
 
         //Loop through and add all values from array list
         // use a fixed seed to always produce the same file which makes comparing stuff easier
-        Random rnd = new Random(4352345);
+        //Random rnd = new Random(4352345);
         int maxStyles = (wb instanceof HSSFWorkbook) ? 4009 : 64000;
         for(int i = 0;i < maxStyles;i++) {
             //Create new row
-            Row row = worksheet.createRow(i);
+            //Row row = worksheet.createRow(i);
 
             //Create cell style
             final CellStyle style; 
@@ -1206,13 +1205,13 @@ public abstract class BaseTestBugzillaIs
             }
 
             //Create cell
-            Cell cell = row.createCell(0);
+            //Cell cell = row.createCell(0);
 
             //Set cell style
-            cell.setCellStyle(style);
+            //cell.setCellStyle(style);
 
             //Set cell value
-            cell.setCellValue("r" + rnd.nextInt());
+            //cell.setCellValue("r" + rnd.nextInt());
         }
 
         // should fail if we try to add more now



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


Mime
View raw message