diff options
author | Dustin Spicuzza <virtuald@apache.org> | 2015-10-19 06:26:57 +0000 |
---|---|---|
committer | Dustin Spicuzza <virtuald@apache.org> | 2015-10-19 06:26:57 +0000 |
commit | bc6ee96e1a409cfeae97c6cd2805b2ef9c420ac7 (patch) | |
tree | c4928538118e474ba2895a91b0742563bc5b8de7 /src/integrationtest | |
parent | 9716fd9a06c1005f8e9383fcdf8c6d6cb6620aa4 (diff) | |
download | poi-bc6ee96e1a409cfeae97c6cd2805b2ef9c420ac7.tar.gz poi-bc6ee96e1a409cfeae97c6cd2805b2ef9c420ac7.zip |
Add Visio OOXML text extractor + tests
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1709361 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/integrationtest')
-rw-r--r-- | src/integrationtest/org/apache/poi/TestAllFiles.java | 2 | ||||
-rw-r--r-- | src/integrationtest/org/apache/poi/stress/XDGFFileHandler.java | 36 |
2 files changed, 5 insertions, 33 deletions
diff --git a/src/integrationtest/org/apache/poi/TestAllFiles.java b/src/integrationtest/org/apache/poi/TestAllFiles.java index d453da27f9..6231065e7f 100644 --- a/src/integrationtest/org/apache/poi/TestAllFiles.java +++ b/src/integrationtest/org/apache/poi/TestAllFiles.java @@ -105,7 +105,7 @@ public class TestAllFiles { // Visio - binary HANDLERS.put(".vsd", new HDGFFileHandler()); - // Visio - ooxml (currently unsupported) + // Visio - ooxml HANDLERS.put(".vsdm", new XDGFFileHandler()); HANDLERS.put(".vsdx", new XDGFFileHandler()); HANDLERS.put(".vssm", new XDGFFileHandler()); diff --git a/src/integrationtest/org/apache/poi/stress/XDGFFileHandler.java b/src/integrationtest/org/apache/poi/stress/XDGFFileHandler.java index 4c4fd6088b..9b7d03f8a5 100644 --- a/src/integrationtest/org/apache/poi/stress/XDGFFileHandler.java +++ b/src/integrationtest/org/apache/poi/stress/XDGFFileHandler.java @@ -16,19 +16,11 @@ ==================================================================== */ package org.apache.poi.stress; -import java.io.File; -import java.io.IOException; import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; -import org.apache.poi.POIXMLDocument; -import org.apache.poi.openxml4j.exceptions.OpenXML4JException; import org.apache.poi.openxml4j.opc.OPCPackage; import org.apache.poi.openxml4j.opc.PackageAccess; -import org.apache.poi.openxml4j.opc.PackagePart; -import org.apache.poi.openxml4j.opc.PackageRelationshipTypes; -import org.apache.poi.util.PackageHelper; +import org.apache.poi.xdgf.usermodel.XmlVisioDocument; import org.junit.Test; public class XDGFFileHandler extends AbstractFileHandler { @@ -37,39 +29,19 @@ public class XDGFFileHandler extends AbstractFileHandler { // ignore password protected files if (POIXMLDocumentHandler.isEncrypted(stream)) return; - TestXDGFXMLDocument doc = new TestXDGFXMLDocument(stream); + XmlVisioDocument doc = new XmlVisioDocument(stream); new POIXMLDocumentHandler().handlePOIXMLDocument(doc); } - - @Override - public void handleExtracting(File file) throws Exception { - // TODO: extraction/actual operations not supported yet - } - + // a test-case to test this locally without executing the full TestAllFiles @Test public void test() throws Exception { OPCPackage pkg = OPCPackage.open("test-data/diagram/test.vsdx", PackageAccess.READ); try { - TestXDGFXMLDocument doc = new TestXDGFXMLDocument(pkg); + XmlVisioDocument doc = new XmlVisioDocument(pkg); new POIXMLDocumentHandler().handlePOIXMLDocument(doc); } finally { pkg.close(); } } - - // TODO: Get rid of this when full visio ooxml support is added - private final static class TestXDGFXMLDocument extends POIXMLDocument { - public TestXDGFXMLDocument(OPCPackage pkg) { - super(pkg, PackageRelationshipTypes.VISIO_CORE_DOCUMENT); - } - - public TestXDGFXMLDocument(InputStream is) throws IOException { - this(PackageHelper.open(is)); - } - - public List<PackagePart> getAllEmbedds() throws OpenXML4JException { - return new ArrayList<PackagePart>(); - } - } }
\ No newline at end of file |