]> source.dussan.org Git - poi.git/commitdiff
Test from Tim to include PropertyList in poi-ooxml-schemas
authorNick Burch <nick@apache.org>
Sat, 8 Nov 2014 12:21:27 +0000 (12:21 +0000)
committerNick Burch <nick@apache.org>
Sat, 8 Nov 2014 12:21:27 +0000 (12:21 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1637548 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestPackageCoreProperties.java

index 1db28cb2977cfd76d3a8534beeafe7b86e6661a1..0cf3efa53c701cd89bbc76dcd21e2dc19b290a1b 100644 (file)
@@ -29,6 +29,7 @@ import java.util.TimeZone;
 
 import junit.framework.TestCase;
 
+import org.apache.poi.POIDataSamples;
 import org.apache.poi.openxml4j.OpenXML4JTestDataSamples;
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
@@ -36,6 +37,8 @@ import org.apache.poi.openxml4j.opc.internal.PackagePropertiesPart;
 import org.apache.poi.openxml4j.util.Nullable;
 import org.apache.poi.util.POILogFactory;
 import org.apache.poi.util.POILogger;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.openxmlformats.schemas.officeDocument.x2006.customProperties.CTProperty;
 
 public final class TestPackageCoreProperties extends TestCase {
     private static final POILogger logger = POILogFactory.getLogger(TestPackageCoreProperties.class);
@@ -226,4 +229,20 @@ public final class TestPackageCoreProperties extends TestCase {
         // Check
         assertEquals("Stefan Kopf", props.getCreatorProperty().getValue());
     }
+    
+    public void testListOfCustomProperties() throws Exception {
+        File inp = POIDataSamples.getSpreadSheetInstance().getFile("ExcelWithAttachments.xlsm");
+        OPCPackage pkg = OPCPackage.open(inp, PackageAccess.READ);
+        XSSFWorkbook wb = new XSSFWorkbook(pkg);
+        
+        assertNotNull(wb.getProperties());
+        assertNotNull(wb.getProperties().getCustomProperties());
+        
+        for (CTProperty prop : wb.getProperties().getCustomProperties().getUnderlyingProperties().getPropertyList()) {
+            assertNotNull(prop);
+        }
+        
+        wb.close();
+        pkg.close();
+    }
 }