Search in sources :

Example 26 with POIDataSamples

use of org.apache.poi.POIDataSamples in project poi by apache.

the class TestExObjList method testRealFile.

@Test
public void testRealFile() throws Exception {
    POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
    HSLFSlideShow ss = new HSLFSlideShow(slTests.openResourceAsStream("WithLinks.ppt"));
    // Get the document
    Document doc = ss.getDocumentRecord();
    // Get the ExObjList
    ExObjList exObjList = doc.getExObjList(false);
    assertNotNull(exObjList);
    assertEquals(1033l, exObjList.getRecordType());
    // Check the atom
    assertNotNull(exObjList.getExObjListAtom());
    assertEquals(4, exObjList.getExObjListAtom().getObjectIDSeed());
    // Check the Hyperlinks
    assertEquals(4, exObjList.getExHyperlinks().length);
    // Check the contents
    ExHyperlink[] links = exObjList.getExHyperlinks();
    // Check they have what we expect in them
    assertEquals(1, links[0].getExHyperlinkAtom().getNumber());
    assertEquals("http://jakarta.apache.org/poi/", links[0].getLinkURL());
    assertEquals(2, links[1].getExHyperlinkAtom().getNumber());
    assertEquals("http://slashdot.org/", links[1].getLinkURL());
    assertEquals(3, links[2].getExHyperlinkAtom().getNumber());
    assertEquals("http://jakarta.apache.org/poi/hssf/", links[2].getLinkURL());
    assertEquals(4, links[3].getExHyperlinkAtom().getNumber());
    assertEquals("http://jakarta.apache.org/hslf/", links[3].getLinkURL());
    ss.close();
}
Also used : POIDataSamples(org.apache.poi.POIDataSamples) HSLFSlideShow(org.apache.poi.hslf.usermodel.HSLFSlideShow) Test(org.junit.Test)

Example 27 with POIDataSamples

use of org.apache.poi.POIDataSamples in project poi by apache.

the class TestFixedSizedProperties method initMapi.

/**
    * Initialize this test, load up the messages.
    */
@BeforeClass
public static void initMapi() throws Exception {
    POIDataSamples samples = POIDataSamples.getHSMFInstance();
    fsMessageSucceeds = new NPOIFSFileSystem(samples.getFile(messageSucceeds));
    fsMessageFails = new NPOIFSFileSystem(samples.getFile(messageFails));
    mapiMessageSucceeds = new MAPIMessage(fsMessageSucceeds);
    mapiMessageFails = new MAPIMessage(fsMessageFails);
    messageDateFormat = new SimpleDateFormat("E, d MMM yyyy HH:mm:ss", Locale.ROOT);
    messageDateFormat.setTimeZone(LocaleUtil.TIMEZONE_UTC);
    userTimeZone = LocaleUtil.getUserTimeZone();
    LocaleUtil.setUserTimeZone(LocaleUtil.TIMEZONE_UTC);
}
Also used : NPOIFSFileSystem(org.apache.poi.poifs.filesystem.NPOIFSFileSystem) POIDataSamples(org.apache.poi.POIDataSamples) SimpleDateFormat(java.text.SimpleDateFormat) BeforeClass(org.junit.BeforeClass)

Aggregations

POIDataSamples (org.apache.poi.POIDataSamples)27 Test (org.junit.Test)13 File (java.io.File)7 Before (org.junit.Before)7 HSLFSlideShow (org.apache.poi.hslf.usermodel.HSLFSlideShow)4 TempFile (org.apache.poi.util.TempFile)4 HSLFSlideShowImpl (org.apache.poi.hslf.usermodel.HSLFSlideShowImpl)3 POIFSFileSystem (org.apache.poi.poifs.filesystem.POIFSFileSystem)3 BeforeClass (org.junit.BeforeClass)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 FileInputStream (java.io.FileInputStream)2 InputStream (java.io.InputStream)2 ArrayList (java.util.ArrayList)2 MAPIAttribute (org.apache.poi.hmef.attribute.MAPIAttribute)2 BufferedReader (java.io.BufferedReader)1 FileFilter (java.io.FileFilter)1 FileOutputStream (java.io.FileOutputStream)1 InputStreamReader (java.io.InputStreamReader)1 SimpleDateFormat (java.text.SimpleDateFormat)1