public final class TestXSLFSlideShowFactory extends BaseTestSlideShowFactory {
private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
-
+ private static final String filename = "SampleShow.pptx";
+ private static final String password = "opensesame";
+
+ @Test
+ public void testFactoryFromFile() throws Exception {
+ testFactoryFromFile(filename);
+ }
+
+ @Test
+ public void testFactoryFromStream() throws Exception {
+ testFactoryFromStream(filename);
+ }
+
+ @Test
+ public void testFactoryFromNative() throws Exception {
+ testFactoryFromNative(filename);
+ }
+
@Test
- public void testFactory() throws Exception {
- File pFile = createProtected("SampleShow.pptx", "foobaa");
- testFactory("SampleShow.pptx", pFile.getAbsolutePath(), "foobaa");
+ public void testFactoryFromProtectedFile() throws Exception {
+ File pFile = createProtected();
+ testFactoryFromProtectedFile(pFile.getAbsolutePath(), password);
}
-
+
+ @Test
+ public void testFactoryFromProtectedStream() throws Exception {
+ File pFile = createProtected();
+ testFactoryFromProtectedStream(pFile.getAbsolutePath(), password);
+ }
+
+ @Test
+ public void testFactoryFromProtectedNative() throws Exception {
+ File pFile = createProtected();
+ testFactoryFromProtectedNative(pFile.getAbsolutePath(), password);
+ }
+
+ private static File createProtected() throws IOException, GeneralSecurityException {
+ return createProtected(filename, password);
+ }
+
private static File createProtected(String basefile, String password)
throws IOException, GeneralSecurityException {
NPOIFSFileSystem fs = new NPOIFSFileSystem();
public class BaseTestSlideShowFactory {
private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
- private static void testFactoryFromFile(String file) throws Exception {
+ protected static void testFactoryFromFile(String file) throws Exception {
SlideShow<?,?> ss;
// from file
ss = SlideShowFactory.create(fromFile(file));
ss.close();
}
- private static void testFactoryFromStream(String file) throws Exception {
+ protected static void testFactoryFromStream(String file) throws Exception {
SlideShow<?,?> ss;
// from stream
ss = SlideShowFactory.create(fromStream(file));
ss.close();
}
- private static void testFactoryFromNative(String file) throws Exception {
+ protected static void testFactoryFromNative(String file) throws Exception {
SlideShow<?,?> ss;
// from NPOIFS
if (!file.contains("pptx")) {
}
}
- private static void testFactoryFromProtectedFile(String protectedFile, String password) throws Exception {
+ protected static void testFactoryFromProtectedFile(String protectedFile, String password) throws Exception {
SlideShow<?,?> ss;
// from protected file
ss = SlideShowFactory.create(fromFile(protectedFile), password);
ss.close();
}
- private static void testFactoryFromProtectedStream(String protectedFile, String password) throws Exception {
+ protected static void testFactoryFromProtectedStream(String protectedFile, String password) throws Exception {
SlideShow<?,?> ss;
// from protected stream
ss = SlideShowFactory.create(fromStream(protectedFile), password);
ss.close();
}
- private static void testFactoryFromProtectedNative(String protectedFile, String password) throws Exception {
+ protected static void testFactoryFromProtectedNative(String protectedFile, String password) throws Exception {
SlideShow<?,?> ss;
// from protected NPOIFS
NPOIFSFileSystem npoifs = new NPOIFSFileSystem(fromFile(protectedFile));