You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2013/12/26 00:24:05 UTC

svn commit: r1553428 - in /poi/trunk: src/ooxml/testcases/org/apache/poi/poifs/crypt/ src/scratchpad/testcases/org/apache/poi/hslf/extractor/ src/scratchpad/testcases/org/apache/poi/hslf/usermodel/ src/testcases/org/apache/poi/ss/formula/functions/ tes...

Author: kiwiwings
Date: Wed Dec 25 23:24:04 2013
New Revision: 1553428

URL: http://svn.apache.org/r1553428
Log:
javadoc and compiler warning house-keeping

Added:
    poi/trunk/test-data/poifs/poitest.pfx   (with props)
Modified:
    poi/trunk/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestCertificateEncryption.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestRichTextRun.java
    poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestMirr.java

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestCertificateEncryption.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestCertificateEncryption.java?rev=1553428&r1=1553427&r2=1553428&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestCertificateEncryption.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestCertificateEncryption.java Wed Dec 25 23:24:04 2013
@@ -27,26 +27,27 @@ import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.math.BigInteger;
 import java.security.GeneralSecurityException;
 import java.security.KeyPair;
-import java.security.KeyPairGenerator;
 import java.security.KeyStore;
 import java.security.PrivateKey;
 import java.security.PublicKey;
-import java.security.SecureRandom;
-import java.security.cert.Certificate;
 import java.security.cert.X509Certificate;
-import java.util.Date;
 
 import org.apache.poi.POIDataSamples;
 import org.apache.poi.poifs.crypt.agile.AgileDecryptor;
 import org.apache.poi.poifs.crypt.agile.AgileEncryptionVerifier;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.util.IOUtils;
-import org.junit.BeforeClass;
 import org.junit.Test;
 
+/*
+import org.junit.BeforeClass;
+import java.util.Date;
+import java.math.BigInteger;
+import java.security.KeyPairGenerator;
+import java.security.SecureRandom;
+import java.security.cert.Certificate;
 import sun.security.x509.AlgorithmId;
 import sun.security.x509.CertificateAlgorithmId;
 import sun.security.x509.CertificateIssuerName;
@@ -58,9 +59,10 @@ import sun.security.x509.CertificateX509
 import sun.security.x509.X500Name;
 import sun.security.x509.X509CertImpl;
 import sun.security.x509.X509CertInfo;
+*/
 
 /**
- * {@linkplain http://stackoverflow.com/questions/1615871/creating-an-x509-certificate-in-java-without-bouncycastle}
+ * @see <a href="http://stackoverflow.com/questions/1615871/creating-an-x509-certificate-in-java-without-bouncycastle">creating a self-signed certificate</a> 
  */
 public class TestCertificateEncryption {
     /**
@@ -91,7 +93,7 @@ public class TestCertificateEncryption {
      * The keystore generation / loading is split, because normally the keystore would
      * already exist.
      */ 
-    @BeforeClass
+    /* @BeforeClass
     public static void initKeystore() throws GeneralSecurityException, IOException {
         CertData certData = new CertData();
         
@@ -134,14 +136,16 @@ public class TestCertificateEncryption {
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
         keystore.store(bos, password.toCharArray());
         pfxFileBytes = bos.toByteArray();
-    }
+    } */
 
     public CertData loadKeystore()
     throws GeneralSecurityException, IOException {
         KeyStore keystore = KeyStore.getInstance("PKCS12");
         
-        InputStream fis = new ByteArrayInputStream(pfxFileBytes);
+        // InputStream fis = new ByteArrayInputStream(pfxFileBytes);
+        InputStream fis = POIDataSamples.getPOIFSInstance().openResourceAsStream("poitest.pfx");
         keystore.load(fis, password.toCharArray());
+        fis.close();
         
         X509Certificate x509 = (X509Certificate)keystore.getCertificate(certAlias);
         PrivateKey privateKey = (PrivateKey)keystore.getKey(certAlias, password.toCharArray());

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java?rev=1553428&r1=1553427&r2=1553428&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/extractor/TestExtractor.java Wed Dec 25 23:24:04 2013
@@ -21,8 +21,6 @@ import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 import java.util.List;
 
-import junit.framework.TestCase;
-
 import org.apache.poi.POIDataSamples;
 import org.apache.poi.POITestCase;
 import org.apache.poi.hslf.HSLFSlideShow;
@@ -57,10 +55,6 @@ public final class TestExtractor extends
       ppe2 = new PowerPointExtractor(slTests.openResourceAsStream("with_textbox.ppt"));
    }
 
-   private static void assertContains(String reason, String haystack, String needle) {
-      assertTrue(reason, haystack.contains(needle));
-   }
-
     public void testReadSheetText() {
     	// Basic 2 page example
 		String sheetText = ppe.getText();
@@ -174,6 +168,7 @@ public final class TestExtractor extends
      /**
       * A powerpoint file with embeded powerpoint files
       */
+     @SuppressWarnings("unused")
      public void testExtractFromOwnEmbeded() throws Exception {
          String path = "ppt_with_embeded.ppt";
          ppe = new PowerPointExtractor(POIDataSamples.getSlideShowInstance().openResourceAsStream(path));
@@ -281,6 +276,7 @@ public final class TestExtractor extends
        assertContains(text, "test phrase");
     }
     
+   @SuppressWarnings("unused")
    public void testSlideMasterText() throws Exception {
       String masterTitleText = "This is the Master Title";
       String masterRandomText = "This text comes from the Master Slide";
@@ -337,10 +333,10 @@ public final class TestExtractor extends
        // Check for the english text in the mixed line
        assertContains(text, "Mix");
        
-       // Check for the chinese text in the mixed line - 表
+       // Check for the chinese text in the mixed line
        assertContains(text, "\u8868");
        
-       // Check for the chinese only text line - ハンカク
+       // Check for the chinese only text line
        assertContains(text, "\uff8a\uff9d\uff76\uff78");
     }
     
@@ -348,6 +344,7 @@ public final class TestExtractor extends
      * Tests that we can work with both {@link POIFSFileSystem}
      *  and {@link NPOIFSFileSystem}
      */
+    @SuppressWarnings("resource")
     public void testDifferentPOIFS() throws Exception {
        // Open the two filesystems
        DirectoryNode[] files = new DirectoryNode[2];
@@ -356,7 +353,7 @@ public final class TestExtractor extends
        
        // Open directly 
        for(DirectoryNode dir : files) {
-          PowerPointExtractor extractor = new PowerPointExtractor(dir, null);
+          PowerPointExtractor extractor = new PowerPointExtractor(dir);
           assertEquals(expectText, extractor.getText());
        }
 

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=1553428&r1=1553427&r2=1553428&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 Wed Dec 25 23:24:04 2013
@@ -649,7 +649,7 @@ if(false) {
       // Check we can get the english text out of that
       String text = rt.getText();
       assertContains(text, "Single byte");
-      // And the chinese - ハンカク
+      // And the chinese
       assertContains(text, "\uff8a\uff9d\uff76\uff78");
       
       // It isn't bold or italic

Modified: poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestMirr.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestMirr.java?rev=1553428&r1=1553427&r2=1553428&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestMirr.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestMirr.java Wed Dec 25 23:24:04 2013
@@ -19,8 +19,13 @@ package org.apache.poi.ss.formula.functi
 
 import junit.framework.AssertionFailedError;
 import junit.framework.TestCase;
+
 import org.apache.poi.hssf.HSSFTestDataSamples;
-import org.apache.poi.hssf.usermodel.*;
+import org.apache.poi.hssf.usermodel.HSSFCell;
+import org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator;
+import org.apache.poi.hssf.usermodel.HSSFRow;
+import org.apache.poi.hssf.usermodel.HSSFSheet;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.ss.formula.eval.ErrorEval;
 import org.apache.poi.ss.formula.eval.EvaluationException;
 import org.apache.poi.ss.usermodel.CellValue;
@@ -29,7 +34,7 @@ import org.apache.poi.ss.usermodel.CellV
  * Tests for {@link org.apache.poi.ss.formula.functions.Mirr}
  *
  * @author Carlos Delgado (carlos dot del dot est at gmail dot com)
- * @author Cédric Walter (cedric dot walter at gmail dot com)
+ * @author Cedric Walter (cedric dot walter at gmail dot com)
  * @see {@link org.apache.poi.ss.formula.functions.TestIrr}
  */
 public final class TestMirr extends TestCase {

Added: poi/trunk/test-data/poifs/poitest.pfx
URL: http://svn.apache.org/viewvc/poi/trunk/test-data/poifs/poitest.pfx?rev=1553428&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/test-data/poifs/poitest.pfx
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



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