Shuffle where some of the HSMF tests live to better match package names, and stub out a few more tests
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@896923 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2bb376f55b
commit
6afb781730
@ -22,10 +22,8 @@ import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.poi.hsmf.datatypes.AttachmentChunks;
|
||||
import org.apache.poi.hsmf.datatypes.Chunk;
|
||||
import org.apache.poi.hsmf.datatypes.ChunkGroup;
|
||||
import org.apache.poi.hsmf.datatypes.Chunks;
|
||||
import org.apache.poi.hsmf.datatypes.NameIdChunks;
|
||||
|
@ -37,10 +37,20 @@ public class AttachmentChunks implements ChunkGroup {
|
||||
public StringChunk attachFileName;
|
||||
public StringChunk attachLongFileName;
|
||||
public StringChunk attachMimeTag;
|
||||
|
||||
/**
|
||||
* What the POIFS name of this attachment is.
|
||||
*/
|
||||
private String poifsName;
|
||||
|
||||
/** Holds all the chunks that were found. */
|
||||
private List<Chunk> allChunks = new ArrayList<Chunk>();
|
||||
|
||||
|
||||
public AttachmentChunks(String poifsName) {
|
||||
this.poifsName = poifsName;
|
||||
}
|
||||
|
||||
public Chunk[] getAll() {
|
||||
return allChunks.toArray(new Chunk[allChunks.size()]);
|
||||
}
|
||||
@ -48,6 +58,10 @@ public class AttachmentChunks implements ChunkGroup {
|
||||
return getAll();
|
||||
}
|
||||
|
||||
public String getPOIFSName() {
|
||||
return poifsName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the parser whenever a chunk is found.
|
||||
*/
|
||||
|
@ -60,7 +60,7 @@ public final class POIFSChunkParser {
|
||||
|
||||
// Do we know what to do with it?
|
||||
if(dir.getName().startsWith(AttachmentChunks.PREFIX)) {
|
||||
group = new AttachmentChunks();
|
||||
group = new AttachmentChunks(dir.getName());
|
||||
}
|
||||
if(dir.getName().startsWith(NameIdChunks.PREFIX)) {
|
||||
group = new NameIdChunks();
|
||||
|
@ -20,7 +20,8 @@ package org.apache.poi.hsmf;
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.apache.poi.hsmf.model.*;
|
||||
import org.apache.poi.hsmf.datatypes.*;
|
||||
import org.apache.poi.hsmf.parsers.*;
|
||||
|
||||
public final class AllHSMFTests {
|
||||
|
||||
@ -29,9 +30,13 @@ public final class AllHSMFTests {
|
||||
suite.addTestSuite(TestBlankFileRead.class);
|
||||
suite.addTestSuite(TestSimpleFileRead.class);
|
||||
suite.addTestSuite(TestOutlook30FileRead.class);
|
||||
suite.addTestSuite(TestChunkData.class);
|
||||
suite.addTestSuite(TestFileWithAttachmentsRead.class);
|
||||
|
||||
suite.addTestSuite(TestChunkData.class);
|
||||
suite.addTestSuite(TestTypes.class);
|
||||
|
||||
suite.addTestSuite(TestPOIFSChunkParser.class);
|
||||
|
||||
return suite;
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
package org.apache.poi.hsmf.model;
|
||||
package org.apache.poi.hsmf;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -15,7 +15,7 @@
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
package org.apache.poi.hsmf.model;
|
||||
package org.apache.poi.hsmf;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
@ -15,7 +15,7 @@
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
package org.apache.poi.hsmf.model;
|
||||
package org.apache.poi.hsmf;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -15,7 +15,7 @@
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
package org.apache.poi.hsmf.model;
|
||||
package org.apache.poi.hsmf;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -15,7 +15,7 @@
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
package org.apache.poi.hsmf.model;
|
||||
package org.apache.poi.hsmf.datatypes;
|
||||
|
||||
import org.apache.poi.hsmf.datatypes.Chunk;
|
||||
import org.apache.poi.hsmf.datatypes.Chunks;
|
@ -15,7 +15,7 @@
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
package org.apache.poi.hsmf.model;
|
||||
package org.apache.poi.hsmf.datatypes;
|
||||
|
||||
import org.apache.poi.hsmf.datatypes.Types;
|
||||
|
@ -0,0 +1,56 @@
|
||||
/* ====================================================================
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
package org.apache.poi.hsmf.parsers;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
||||
import org.apache.poi.POIDataSamples;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
* Tests to verify that the chunk parser works properly
|
||||
*/
|
||||
public final class TestPOIFSChunkParser extends TestCase {
|
||||
private POIDataSamples samples;
|
||||
|
||||
public TestPOIFSChunkParser() throws IOException {
|
||||
samples = POIDataSamples.getHSMFInstance();
|
||||
}
|
||||
|
||||
public void testFindsRecips() throws IOException {
|
||||
|
||||
}
|
||||
|
||||
public void testFindsAttachments() throws IOException {
|
||||
POIFSFileSystem with = new POIFSFileSystem(
|
||||
new FileInputStream(samples.getFile("attachment_test_msg.msg"))
|
||||
);
|
||||
POIFSFileSystem without = new POIFSFileSystem(
|
||||
new FileInputStream(samples.getFile("simple_test_msg.msg"))
|
||||
);
|
||||
|
||||
// Check details on the one with
|
||||
|
||||
// One with, from the top
|
||||
|
||||
// One without, from the top
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user