import java.io.IOException;\r
import java.io.InputStream;\r
import java.io.OutputStream;\r
-import java.math.BigInteger;\r
import java.security.GeneralSecurityException;\r
import java.security.KeyPair;\r
-import java.security.KeyPairGenerator;\r
import java.security.KeyStore;\r
import java.security.PrivateKey;\r
import java.security.PublicKey;\r
-import java.security.SecureRandom;\r
-import java.security.cert.Certificate;\r
import java.security.cert.X509Certificate;\r
-import java.util.Date;\r
\r
import org.apache.poi.POIDataSamples;\r
import org.apache.poi.poifs.crypt.agile.AgileDecryptor;\r
import org.apache.poi.poifs.crypt.agile.AgileEncryptionVerifier;\r
import org.apache.poi.poifs.filesystem.POIFSFileSystem;\r
import org.apache.poi.util.IOUtils;\r
-import org.junit.BeforeClass;\r
import org.junit.Test;\r
\r
+/*\r
+import org.junit.BeforeClass;\r
+import java.util.Date;\r
+import java.math.BigInteger;\r
+import java.security.KeyPairGenerator;\r
+import java.security.SecureRandom;\r
+import java.security.cert.Certificate;\r
import sun.security.x509.AlgorithmId;\r
import sun.security.x509.CertificateAlgorithmId;\r
import sun.security.x509.CertificateIssuerName;\r
import sun.security.x509.X500Name;\r
import sun.security.x509.X509CertImpl;\r
import sun.security.x509.X509CertInfo;\r
+*/\r
\r
/**\r
- * {@linkplain http://stackoverflow.com/questions/1615871/creating-an-x509-certificate-in-java-without-bouncycastle}\r
+ * @see <a href="http://stackoverflow.com/questions/1615871/creating-an-x509-certificate-in-java-without-bouncycastle">creating a self-signed certificate</a> \r
*/\r
public class TestCertificateEncryption {\r
/**\r
* The keystore generation / loading is split, because normally the keystore would\r
* already exist.\r
*/ \r
- @BeforeClass\r
+ /* @BeforeClass\r
public static void initKeystore() throws GeneralSecurityException, IOException {\r
CertData certData = new CertData();\r
\r
ByteArrayOutputStream bos = new ByteArrayOutputStream();\r
keystore.store(bos, password.toCharArray());\r
pfxFileBytes = bos.toByteArray();\r
- }\r
+ } */\r
\r
public CertData loadKeystore()\r
throws GeneralSecurityException, IOException {\r
KeyStore keystore = KeyStore.getInstance("PKCS12");\r
\r
- InputStream fis = new ByteArrayInputStream(pfxFileBytes);\r
+ // InputStream fis = new ByteArrayInputStream(pfxFileBytes);\r
+ InputStream fis = POIDataSamples.getPOIFSInstance().openResourceAsStream("poitest.pfx");\r
keystore.load(fis, password.toCharArray());\r
+ fis.close();\r
\r
X509Certificate x509 = (X509Certificate)keystore.getCertificate(certAlias);\r
PrivateKey privateKey = (PrivateKey)keystore.getKey(certAlias, password.toCharArray());\r
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;
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();
/**
* 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));
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";
// 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");
}
* 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];
// Open directly
for(DirectoryNode dir : files) {
- PowerPointExtractor extractor = new PowerPointExtractor(dir, null);
+ PowerPointExtractor extractor = new PowerPointExtractor(dir);
assertEquals(expectText, extractor.getText());
}
// 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
\r
import junit.framework.AssertionFailedError;\r
import junit.framework.TestCase;\r
+\r
import org.apache.poi.hssf.HSSFTestDataSamples;\r
-import org.apache.poi.hssf.usermodel.*;\r
+import org.apache.poi.hssf.usermodel.HSSFCell;\r
+import org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator;\r
+import org.apache.poi.hssf.usermodel.HSSFRow;\r
+import org.apache.poi.hssf.usermodel.HSSFSheet;\r
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;\r
import org.apache.poi.ss.formula.eval.ErrorEval;\r
import org.apache.poi.ss.formula.eval.EvaluationException;\r
import org.apache.poi.ss.usermodel.CellValue;\r
* Tests for {@link org.apache.poi.ss.formula.functions.Mirr}\r
*\r
* @author Carlos Delgado (carlos dot del dot est at gmail dot com)\r
- * @author Cédric Walter (cedric dot walter at gmail dot com)\r
+ * @author Cedric Walter (cedric dot walter at gmail dot com)\r
* @see {@link org.apache.poi.ss.formula.functions.TestIrr}\r
*/\r
public final class TestMirr extends TestCase {\r