use of org.apache.poi.POIDataSamples in project poi by apache.
the class TestReWrite method setUp.
@Before
public void setUp() throws Exception {
POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
pfsA = new POIFSFileSystem(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
hssA = new HSLFSlideShowImpl(pfsA);
pfsB = new POIFSFileSystem(slTests.openResourceAsStream("ParagraphStylesShorterThanCharStyles.ppt"));
hssB = new HSLFSlideShowImpl(pfsB);
pfsC = new POIFSFileSystem(slTests.openResourceAsStream("WithMacros.ppt"));
hssC = new HSLFSlideShowImpl(pfsC);
}
use of org.apache.poi.POIDataSamples in project poi by apache.
the class TestTextRunReWrite method setUp.
/**
* Load up a test PPT file with rich data
*/
@Before
public void setUp() throws Exception {
POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
String filename = "Single_Coloured_Page_With_Fonts_and_Alignments.ppt";
ss = new HSLFSlideShow(slTests.openResourceAsStream(filename));
}
use of org.apache.poi.POIDataSamples in project poi by apache.
the class TestHMEFContentsExtractor method TestExtractMessageBody_File.
@Test
public void TestExtractMessageBody_File() throws IOException {
POIDataSamples samples = POIDataSamples.getHMEFInstance();
File winmailTNEFFile = samples.getFile("quick-winmail.dat");
HMEFContentsExtractor extractor = new HMEFContentsExtractor(winmailTNEFFile);
File rtf = TempFile.createTempFile("quick-winmail-message-body", ".rtf");
assertTrue(rtf.delete());
extractor.extractMessageBody(rtf);
assertTrue("RTF message body is empty", rtf.length() > 0);
}
use of org.apache.poi.POIDataSamples in project poi by apache.
the class TestHMEFContentsExtractor method TestExtractMessageBody_OutputStream.
@Test
public void TestExtractMessageBody_OutputStream() throws IOException {
POIDataSamples samples = POIDataSamples.getHMEFInstance();
File winmailTNEFFile = samples.getFile("quick-winmail.dat");
HMEFContentsExtractor extractor = new HMEFContentsExtractor(winmailTNEFFile);
ByteArrayOutputStream out = new ByteArrayOutputStream();
extractor.extractMessageBody(out);
assertTrue(out.size() > 0);
byte[] expectedMagic = new byte[] { '{', '\\', 'r', 't', 'f' };
byte[] magic = Arrays.copyOf(out.toByteArray(), 5);
assertArrayEquals("RTF magic number", expectedMagic, magic);
out.close();
}
use of org.apache.poi.POIDataSamples in project poi by apache.
the class TestHMEFContentsExtractor method TestMain.
@Test
public void TestMain() throws IOException {
POIDataSamples samples = POIDataSamples.getHMEFInstance();
File message = samples.getFile("quick-winmail.dat");
File outputDirectory = TempFile.createTempDirectory("quick-winmail-main");
String[] args = new String[] { message.getAbsolutePath(), outputDirectory.getAbsolutePath() };
HMEFContentsExtractor.main(args);
String[] contents = new String[] { // from extractMessageBody
"message.rtf", // from extractAttachments
"quick.txt", // from extractAttachments
"quick.pdf", // from extractAttachments
"quick.xml", // from extractAttachments
"quick.doc", // from extractAttachments
"quick.html" };
for (String filename : contents) {
File f = new File(outputDirectory, filename);
assertTrue(f + " does not exist", f.exists());
}
outputDirectory.delete();
}
Aggregations