]> source.dussan.org Git - poi.git/commitdiff
Add helper test to verify that vsdx cannot even be loaded by POIXMLDocument curently.
authorDominik Stadler <centic@apache.org>
Wed, 11 Mar 2015 19:53:26 +0000 (19:53 +0000)
committerDominik Stadler <centic@apache.org>
Wed, 11 Mar 2015 19:53:26 +0000 (19:53 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1665984 13f79535-47bb-0310-9956-ffa450edef68

src/integrationtest/org/apache/poi/stress/POIXMLDocumentHandler.java

index 103bb9be7e5fba4f44f4832598f62f4dc4a84f34..c720272352c27a52cdde727e7cf18c009ae35d30 100644 (file)
@@ -20,9 +20,16 @@ import static org.junit.Assert.assertNotNull;
 
 import java.io.IOException;
 import java.io.InputStream;
+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.poifs.filesystem.POIFSFileSystem;
+import org.junit.Ignore;
+import org.junit.Test;
 
 public final class POIXMLDocumentHandler {
        protected void handlePOIXMLDocument(POIXMLDocument doc) throws Exception {
@@ -43,4 +50,26 @@ public final class POIXMLDocumentHandler {
         }
         return false;
     }
+       
+       // a test-case to test this locally without executing the full TestAllFiles
+    @Ignore("POIXMLDocument cannot handle this Visio file currently...")
+       @Test
+       public void test() throws Exception {
+               OPCPackage pkg = OPCPackage.open("test-data/diagram/test.vsdx", PackageAccess.READ);
+               try {
+                       handlePOIXMLDocument(new TestPOIXMLDocument(pkg));
+               } finally {
+                       pkg.close();
+               }
+       }
+       
+       private final static class TestPOIXMLDocument extends POIXMLDocument {
+               public TestPOIXMLDocument(OPCPackage pkg) {
+                       super(pkg);
+               }
+
+               public List<PackagePart> getAllEmbedds() throws OpenXML4JException {
+                       return null;
+               }
+       }
 }