You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2011/07/24 15:57:54 UTC
svn commit: r1150371 [7/8] - in /pdfbox/trunk/xmpbox: ./ src/ src/main/
src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/padaf/ src/main/java/org/apache/padaf/xmpbox/
src/main/java/org/apache/padaf/xmpbox/parser/ src...
Added: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractXMPSchemaTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractXMPSchemaTest.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractXMPSchemaTest.java (added)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractXMPSchemaTest.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,435 @@
+/*****************************************************************************
+ *
+ * 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.padaf.xmpbox.schema;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.Assert;
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.schema.PropertyType;
+import org.apache.padaf.xmpbox.schema.XMPSchema;
+import org.apache.padaf.xmpbox.type.BooleanType;
+import org.apache.padaf.xmpbox.type.DateType;
+import org.apache.padaf.xmpbox.type.IntegerType;
+import org.apache.padaf.xmpbox.type.TextType;
+import org.apache.padaf.xmpbox.type.ThumbnailType;
+import org.junit.Test;
+
+public abstract class AbstractXMPSchemaTest {
+
+ protected XMPMetadata metadata;
+
+ protected String property;
+
+ protected String type;
+
+ protected XMPSchema schema;
+
+ protected Class<?> schemaClass;
+
+ protected Object value;
+
+ public AbstractXMPSchemaTest(String property, String type, Object value) {
+ this.property = property;
+ this.value = value;
+ this.type = type;
+
+ }
+
+ public static Object[] wrapProperty(String name, String type, Object value) {
+ if (type.equals("Boolean")) {
+ Assert.assertTrue(value instanceof Boolean);
+ } else if (type.equals("Text")) {
+ Assert.assertTrue(value instanceof String);
+ } else if (type.equals("Integer")) {
+ Assert.assertTrue(value instanceof Integer);
+ } else if (type.equals("Date")) {
+ Assert.assertTrue(value instanceof Calendar);
+ } else if (type.equals("URL")) {
+ Assert.assertTrue(value instanceof String);
+ }
+ return new Object[] { name, type, value };
+ }
+
+ @Test
+ public void testGetSetValue() throws Exception {
+ if (type.equals("Text")) {
+ testGetSetTextValue();
+ } else if (type.equals("Boolean")) {
+ testGetSetBooleanValue();
+ } else if (type.equals("Integer")) {
+ testGetSetIntegerValue();
+ } else if (type.equals("Date")) {
+ testGetSetDateValue();
+ } else if (type.equals("seq Text")) {
+ // do nothing
+ } else if (type.equals("bag Text")) {
+ // do nothing
+ } else if (type.equals("bag ProperName")) {
+ // do nothing
+ } else if (type.equals("bag Xpath")) {
+ // do nothing
+ } else if (type.equals("seq Date")) {
+ // do nothing
+ } else if (type.equals("Lang Alt")) {
+ // do nothing
+ } else if (type.equals("Alt Thumbnail")) {
+ // do nothing
+ } else if (type.equals("URL")) {
+ testGetSetTextValue();
+ } else {
+ throw new Exception("Unknown type : " + type);
+ }
+ }
+
+ @Test
+ public void testGetSetProperty() throws Exception {
+ if (value instanceof String) {
+ testGetSetTextProperty();
+ } else if (type.equals("Boolean")) {
+ testGetSetBooleanProperty();
+ } else if (type.equals("Integer")) {
+ testGetSetIntegerProperty();
+ } else if (type.equals("Date")) {
+ testGetSetDateProperty();
+ } else if (type.equals("seq Text")) {
+ testGetSetTextListValue("seq");
+ } else if (type.equals("bag Text")) {
+ testGetSetTextListValue("bag");
+ } else if (type.equals("bag ProperName")) {
+ testGetSetTextListValue("bag");
+ } else if (type.equals("bag Xpath")) {
+ testGetSetTextListValue("bag");
+ } else if (type.equals("seq Date")) {
+ testGetSetDateListValue("seq");
+ } else if (type.equals("Lang Alt")) {
+ testGetSetLangAltValue();
+ } else if (type.equals("Alt Thumbnail")) {
+ testGetSetThumbnail();
+ } else {
+ throw new Exception("Unknown type : " + value.getClass());
+ }
+ Field[] fields = schemaClass.getFields();
+ for (Field field : fields) {
+ if (field.isAnnotationPresent(PropertyType.class)) {
+ if (!field.get(schema).equals(property)) {
+ PropertyType pt = field.getAnnotation(PropertyType.class);
+ if (pt.propertyType().equals("Lang Alt")) {
+ // do not check method existence
+ } else if (pt.propertyType().equals("Alt Thumbnail")) {
+ // do not check method existence
+ } else {
+ // type test
+ String getName = "get"
+ + firstUpper(field.get(schema).toString());
+ Method getMethod = schemaClass.getMethod(getName);
+ Assert.assertNull(getName
+ + " should return null when testing "
+ + property, getMethod.invoke(schema));
+ // value test
+ String getNameValue = getName + "Value";
+ getMethod = schemaClass.getMethod(getNameValue);
+ Assert.assertNotNull(getNameValue
+ + " method should exist", getMethod);
+ Assert.assertNull(getNameValue
+ + " should return null when testing "
+ + property, getMethod.invoke(schema));
+ }
+ }
+ }
+ }
+ }
+
+ protected String firstUpper(String name) {
+ StringBuilder sb = new StringBuilder(name.length());
+ sb.append(name.substring(0, 1).toUpperCase());
+ sb.append(name.substring(1));
+ return sb.toString();
+ }
+
+ protected String setMethod(String prop) {
+ String fu = firstUpper(prop);
+ StringBuilder sb = new StringBuilder(3 + prop.length());
+ sb.append("set").append(fu);
+ return sb.toString();
+ }
+
+ protected String addMethod(String prop) {
+ String fu = firstUpper(prop);
+ StringBuilder sb = new StringBuilder(3 + prop.length());
+ sb.append("add").append(fu);
+ return sb.toString();
+ }
+
+ protected String getMethod(String prop) {
+ String fu = firstUpper(prop);
+ StringBuilder sb = new StringBuilder(3 + prop.length());
+ sb.append("get").append(fu);
+ return sb.toString();
+ }
+
+ protected String setValueMethod(String prop) {
+ String fu = firstUpper(prop);
+ StringBuilder sb = new StringBuilder(8 + prop.length());
+ sb.append("set").append(fu).append("Value");
+ return sb.toString();
+ }
+
+ protected String getValueMethod(String prop) {
+ String fu = firstUpper(prop);
+ StringBuilder sb = new StringBuilder(8 + prop.length());
+ sb.append("get").append(fu).append("Value");
+ return sb.toString();
+ }
+
+ protected String addToValueMethod(String prop) {
+ String fu = firstUpper(prop);
+ StringBuilder sb = new StringBuilder(10 + prop.length());
+ sb.append("addTo").append(fu).append("Value");
+ return sb.toString();
+
+ }
+
+ protected void testGetSetBooleanProperty() throws Exception {
+ String setName = setMethod(property);
+ String getName = getMethod(property);
+
+ BooleanType bt = new BooleanType(metadata, schema.getLocalPrefix(),
+ property, value);
+ Method setMethod = schemaClass.getMethod(setName, BooleanType.class);
+ Method getMethod = schemaClass.getMethod(getName);
+
+ setMethod.invoke(schema, bt);
+ Boolean found = ((BooleanType) getMethod.invoke(schema)).getValue();
+ Assert.assertEquals(value, found);
+
+ }
+
+ protected void testGetSetDateProperty() throws Exception {
+ String setName = setMethod(property);
+ String getName = getMethod(property);
+
+ DateType dt = new DateType(metadata, schema.getLocalPrefix(), property,
+ value);
+ Method setMethod = schemaClass.getMethod(setName, DateType.class);
+ Method getMethod = schemaClass.getMethod(getName);
+
+ setMethod.invoke(schema, dt);
+ Calendar found = ((DateType) getMethod.invoke(schema)).getValue();
+ Assert.assertEquals(value, found);
+ }
+
+ protected void testGetSetIntegerProperty() throws Exception {
+ String setName = setMethod(property);
+ String getName = getMethod(property);
+
+ IntegerType it = new IntegerType(metadata, schema.getLocalPrefix(),
+ property, value);
+ Method setMethod = schemaClass.getMethod(setName, IntegerType.class);
+ Method getMethod = schemaClass.getMethod(getName);
+
+ setMethod.invoke(schema, it);
+ Integer found = ((IntegerType) getMethod.invoke(schema)).getValue();
+ Assert.assertEquals(value, found);
+ }
+
+ protected void testGetSetTextProperty() throws Exception {
+ String setName = setMethod(property);
+ String getName = getMethod(property);
+
+ TextType tt = new TextType(metadata, schema.getLocalPrefix(), property,
+ value);
+ Method setMethod = schemaClass.getMethod(setName, TextType.class);
+ Method getMethod = schemaClass.getMethod(getName);
+
+ setMethod.invoke(schema, tt);
+ String found = ((TextType) getMethod.invoke(schema)).getStringValue();
+ Assert.assertEquals(value, found);
+
+ }
+
+ protected void testGetSetTextListValue(String tp) throws Exception {
+ String setName = addToValueMethod(property);
+ String getName = getValueMethod(property);
+ String[] svalue = (String[]) value;
+ Arrays.sort(svalue);
+ // push all
+ Method setMethod = schemaClass.getMethod(setName, String.class);
+ for (String string : svalue) {
+ setMethod.invoke(schema, string);
+ }
+ // retrieve
+ Method getMethod = schemaClass.getMethod(getName);
+ List<String> fields = (List<String>) getMethod.invoke(schema);
+ for (String field : fields) {
+ Assert.assertTrue(field + " should be found in list", Arrays
+ .binarySearch(svalue, field) >= 0);
+ }
+ }
+
+ protected void testGetSetDateListValue(String tp) throws Exception {
+ String setName = addToValueMethod(property);
+ String getName = getValueMethod(property);
+ Calendar[] svalue = (Calendar[]) value;
+ Arrays.sort(svalue);
+ // push all
+ Method setMethod = schemaClass.getMethod(setName, Calendar.class);
+ for (Calendar inst : svalue) {
+ setMethod.invoke(schema, inst);
+ }
+ // retrieve
+ Method getMethod = schemaClass.getMethod(getName);
+ List<Calendar> fields = (List<Calendar>) getMethod.invoke(schema);
+ for (Calendar field : fields) {
+ Assert.assertTrue(field + " should be found in list", Arrays
+ .binarySearch(svalue, field) >= 0);
+ }
+ }
+
+ protected void testGetSetThumbnail() throws Exception {
+ String addName = addMethod(property);
+ String getName = getMethod(property);
+ Method setMethod = schemaClass.getMethod(addName, Integer.class,
+ Integer.class, String.class, String.class);
+ Method getMethod = schemaClass.getMethod(getName);
+ /*
+ * <xapGImg:height>162</xapGImg:height>
+ * <xapGImg:width>216</xapGImg:width>
+ * <xapGImg:format>JPEG</xapGImg:format>
+ * <xapGImg:image>/9j/4AAQSkZJRgABAgEASABIAAD</xapGImg:image>
+ */
+ Integer height = 162;
+ Integer width = 400;
+ String format = "JPEG";
+ String img = "/9j/4AAQSkZJRgABAgEASABIAAD";
+ setMethod.invoke(schema, height, width, format, img);
+ List<ThumbnailType> found = ((List<ThumbnailType>) getMethod
+ .invoke(schema));
+ Assert.assertTrue(found.size() == 1);
+ ThumbnailType t1 = found.get(0);
+ Assert.assertEquals(height, t1.getHeight());
+ Assert.assertEquals(width, t1.getWidth());
+ Assert.assertEquals(format, t1.getFormat());
+ Assert.assertEquals(img, t1.getImg());
+
+ }
+
+ protected void testGetSetLangAltValue() throws Exception {
+ String setName = addToValueMethod(property);
+ String getName = getValueMethod(property);
+ Map<String, String> svalue = (Map<String, String>) value;
+ // push all
+ Method setMethod = schemaClass.getMethod(setName, String.class,
+ String.class);
+
+ for (Map.Entry<String, String> inst : svalue.entrySet()) {
+ setMethod.invoke(schema, inst.getKey(), inst.getValue());
+ }
+ // retrieve
+ String getLanguagesName = "get" + firstUpper(property) + "Languages";
+ Method getLanguages = schemaClass.getMethod(getLanguagesName);
+ List<String> lgs = (List<String>) getLanguages.invoke(schema);
+ for (String string : lgs) {
+ Method getMethod = schemaClass.getMethod(getName, String.class);
+ String res = (String) getMethod.invoke(schema, string);
+ Assert.assertEquals(res, svalue.get(string));
+ }
+ }
+
+ protected void testGetSetURLValue() throws Exception {
+ String setName = addToValueMethod(property);
+ String getName = getValueMethod(property);
+ String svalue = (String) value;
+ // push all
+ Method setMethod = schemaClass.getMethod(setName, String.class,
+ String.class);
+ setMethod.invoke(schema, property, svalue);
+
+ // retrieve
+ String getLanguagesName = "get" + firstUpper(property) + "Languages";
+ Method getLanguages = schemaClass.getMethod(getLanguagesName);
+ List<String> lgs = (List<String>) getLanguages.invoke(schema);
+ for (String string : lgs) {
+ Method getMethod = schemaClass.getMethod(getName, String.class);
+ String res = (String) getMethod.invoke(schema, string);
+ Assert.assertEquals(res, svalue);
+ }
+ }
+
+ protected void testGetSetTextValue() throws Exception {
+ String setName = setValueMethod(property);
+ String getName = getValueMethod(property);
+
+ Method setMethod = schemaClass.getMethod(setName, String.class);
+ Method getMethod = schemaClass.getMethod(getName);
+
+ setMethod.invoke(schema, value);
+ String found = (String) getMethod.invoke(schema);
+
+ Assert.assertEquals(value, found);
+ }
+
+ protected void testGetSetBooleanValue() throws Exception {
+ String setName = setValueMethod(property);
+ String getName = getValueMethod(property);
+
+ Method setMethod = schemaClass.getMethod(setName, Boolean.class);
+ Method getMethod = schemaClass.getMethod(getName);
+
+ setMethod.invoke(schema, value);
+ Boolean found = (Boolean) getMethod.invoke(schema);
+
+ Assert.assertEquals(value, found);
+ }
+
+ protected void testGetSetDateValue() throws Exception {
+ String setName = setValueMethod(property);
+ String getName = getValueMethod(property);
+
+ Method setMethod = schemaClass.getMethod(setName, Calendar.class);
+ Method getMethod = schemaClass.getMethod(getName);
+
+ setMethod.invoke(schema, value);
+ Calendar found = (Calendar) getMethod.invoke(schema);
+
+ Assert.assertEquals(value, found);
+ }
+
+ protected void testGetSetIntegerValue() throws Exception {
+ String setName = setValueMethod(property);
+ String getName = getValueMethod(property);
+
+ Method setMethod = schemaClass.getMethod(setName, Integer.class);
+ Method getMethod = schemaClass.getMethod(getName);
+
+ setMethod.invoke(schema, value);
+ Integer found = (Integer) getMethod.invoke(schema);
+
+ Assert.assertEquals(value, found);
+ }
+}
Propchange: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AbstractXMPSchemaTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFErrorsTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFErrorsTest.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFErrorsTest.java (added)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFErrorsTest.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,93 @@
+/*****************************************************************************
+ *
+ * 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.padaf.xmpbox.schema;
+
+import junit.framework.Assert;
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.schema.AdobePDFSchema;
+import org.apache.padaf.xmpbox.schema.PDFAIdentificationSchema;
+import org.apache.padaf.xmpbox.type.BadFieldValueException;
+import org.junit.Before;
+import org.junit.Test;
+
+public class AdobePDFErrorsTest {
+
+ protected XMPMetadata metadata;
+
+ @Before
+ public void initTempMetaData() throws Exception {
+ metadata = new XMPMetadata();
+
+ }
+
+ @Test
+ public void testPDFAIdentification() throws Exception {
+ AdobePDFSchema schem = metadata.createAndAddAdobePDFSchema();
+
+ String keywords = "keywords ihih";
+ String pdfVersion = "1.4";
+ String producer = "producer";
+
+ schem.setKeywordsValue(keywords);
+ schem.setPDFVersionValue(pdfVersion);
+
+ // Check get null if property not defined
+ Assert.assertNull(schem.getProducer());
+
+ schem.setProducerValue(producer);
+
+ Assert.assertEquals("pdf:Keywords", schem.getKeywords()
+ .getQualifiedName());
+ Assert.assertEquals(keywords, schem.getKeywordsValue());
+
+ Assert.assertEquals("pdf:PDFVersion", schem.getPDFVersion()
+ .getQualifiedName());
+ Assert.assertEquals(pdfVersion, schem.getPDFVersionValue());
+
+ Assert.assertEquals("pdf:Producer", schem.getProducer()
+ .getQualifiedName());
+ Assert.assertEquals(producer, schem.getProducerValue());
+
+ // check retrieve this schema in metadata
+ Assert.assertEquals(schem, metadata.getAdobePDFSchema());
+
+ // SaveMetadataHelper.serialize(metadata, true, System.out);
+ }
+
+ @Test(expected = BadFieldValueException.class)
+ public void testBadPDFAConformanceId() throws Exception {
+ PDFAIdentificationSchema pdfaid = metadata
+ .createAndAddPFAIdentificationSchema();
+ String conformance = "kiohiohiohiohio";
+ pdfaid.setConformanceValue(conformance);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testBadVersionIdValueType() throws Exception {
+ PDFAIdentificationSchema pdfaid = metadata
+ .createAndAddPFAIdentificationSchema();
+ pdfaid.setPartValueWithString("1");
+ pdfaid.setPartValueWithString("ojoj");
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFErrorsTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFTest.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFTest.java (added)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFTest.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,111 @@
+/*****************************************************************************
+ *
+ * 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.padaf.xmpbox.schema;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.schema.AdobePDFSchema;
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+@RunWith(Parameterized.class)
+public class AdobePDFTest extends AbstractXMPSchemaTest {
+
+ @Before
+ public void initTempMetaData() throws Exception {
+ metadata = new XMPMetadata();
+ schema = metadata.createAndAddAdobePDFSchema();
+ schemaClass = AdobePDFSchema.class;
+ }
+
+ @Parameters
+ public static Collection<Object[]> initializeParameters() throws Exception {
+ List<Object[]> data = new ArrayList<Object[]>();
+ data.add(wrapProperty("Keywords", "Text", "kw1 kw2 kw3"));
+ data.add(wrapProperty("PDFVersion", "Text", "1.4"));
+ data.add(wrapProperty("Producer", "Text", "testcase"));
+
+ return data;
+ }
+
+ public AdobePDFTest(String property, String type, Object value) {
+ super(property, type, value);
+ }
+
+ // @Test
+ // public void testPDFAIdentification() throws BadFieldValueException,
+ // TransformException{
+ // AdobePDFSchema schem=metadata.createAndAddAdobePDFSchema();
+ //
+ // String keywords="keywords ihih";
+ // String pdfVersion="1.4";
+ // String producer="producer";
+ //
+ // schem.setKeywordsValue(keywords);
+ // schem.setPDFVersionValue(pdfVersion);
+ //
+ // //Check get null if property not defined
+ // Assert.assertNull(schem.getProducer());
+ //
+ // schem.setProducerValue(producer);
+ //
+ // Assert.assertEquals("pdf:Keywords",
+ // schem.getKeywords().getQualifiedName());
+ // Assert.assertEquals(keywords, schem.getKeywordsValue());
+ //
+ // Assert.assertEquals("pdf:PDFVersion",
+ // schem.getPDFVersion().getQualifiedName());
+ // Assert.assertEquals(pdfVersion, schem.getPDFVersionValue());
+ //
+ // Assert.assertEquals("pdf:Producer",
+ // schem.getProducer().getQualifiedName());
+ // Assert.assertEquals(producer, schem.getProducerValue());
+ //
+ // //check retrieve this schema in metadata
+ // Assert.assertEquals(schem, metadata.getAdobePDFSchema());
+ //
+ // //SaveMetadataHelper.serialize(metadata, true, System.out);
+ // }
+
+ // @Test(expected=BadFieldValueException.class)
+ // public void testBadPDFAConformanceId() throws BadFieldValueException{
+ // PDFAIdentificationSchema pdfaid=
+ // metadata.createAndAddPFAIdentificationSchema();
+ // String conformance="kiohiohiohiohio";
+ // pdfaid.setConformanceValue(conformance);
+ // }
+ //
+ // @Test(expected=IllegalArgumentException.class)
+ // public void testBadVersionIdValueType() throws Exception {
+ // PDFAIdentificationSchema pdfaid=
+ // metadata.createAndAddPFAIdentificationSchema();
+ // pdfaid.setVersionIdentifierValueWithString("1");
+ // pdfaid.setVersionIdentifierValueWithString("ojoj");
+ // }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/AdobePDFTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/DublinCoreTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/DublinCoreTest.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/DublinCoreTest.java (added)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/DublinCoreTest.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,99 @@
+/*****************************************************************************
+ *
+ * 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.padaf.xmpbox.schema;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.schema.DublinCoreSchema;
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+@RunWith(Parameterized.class)
+public class DublinCoreTest extends AbstractXMPSchemaTest {
+
+ @Before
+ public void initTempMetaData() throws Exception {
+ metadata = new XMPMetadata();
+ schema = metadata.createAndAddDublinCoreSchema();
+ schemaClass = DublinCoreSchema.class;
+ }
+
+ @Parameters
+ public static Collection<Object[]> initializeParameters() throws Exception {
+ List<Object[]> data = new ArrayList<Object[]>();
+ data.add(wrapProperty("contributor", "bag Text", new String[] {
+ "contri 1", "contri 2" }));
+ data.add(wrapProperty("coverage", "Text", "scope of the resource"));
+ data.add(wrapProperty("creator", "seq Text", new String[] {
+ "creator 1", "creator 2", "creator 3" }));
+ data.add(wrapProperty("date", "seq Date", new Calendar[] { Calendar
+ .getInstance() }));
+
+ Map<String, String> desc = new HashMap<String, String>(2);
+ desc.put("fr", "en français");
+ desc.put("en", "in english");
+ data.add(wrapProperty("description", "Lang Alt", desc));
+
+ data.add(wrapProperty("format", "Text", "text/html"));
+ data.add(wrapProperty("identifier", "Text", "my id"));
+ data.add(wrapProperty("language", "bag Text", new String[] { "fr",
+ "en", "es" }));
+ data.add(wrapProperty("publisher", "bag Text", new String[] { "pub1",
+ "pub2" }));
+ data.add(wrapProperty("relation", "bag Text", new String[] { "rel1",
+ "relation 2" }));
+
+ Map<String, String> rights = new HashMap<String, String>(2);
+ rights.put("fr", "protégé");
+ rights.put("en", "protected");
+ data.add(wrapProperty("rights", "Lang Alt", rights));
+
+ data.add(wrapProperty("source", "Text", "my source"));
+ data.add(wrapProperty("subject", "bag Text", new String[] { "subj1",
+ "subj2" }));
+
+ Map<String, String> title = new HashMap<String, String>(2);
+ title.put("fr", "essai");
+ title.put("en", "test");
+ title.put("es", "prueba");
+ data.add(wrapProperty("title", "Lang Alt", title));
+
+ data.add(wrapProperty("type", "bag Text", new String[] { "text",
+ "test", "dummy" }));
+
+ return data;
+ }
+
+ public DublinCoreTest(String property, String type, Object value) {
+ super(property, type, value);
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/DublinCoreTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAExtensionTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAExtensionTest.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAExtensionTest.java (added)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAExtensionTest.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,230 @@
+/*****************************************************************************
+ *
+ * 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.padaf.xmpbox.schema;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.Assert;
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.parser.XmpSchemaException;
+import org.apache.padaf.xmpbox.schema.PDFAExtensionSchema;
+import org.apache.padaf.xmpbox.schema.PDFAPropertyDescription;
+import org.apache.padaf.xmpbox.schema.PDFAValueTypeDescription;
+import org.apache.padaf.xmpbox.schema.SchemaDescription;
+import org.apache.padaf.xmpbox.type.Attribute;
+import org.junit.Before;
+import org.junit.Test;
+
+public class PDFAExtensionTest {
+
+ protected XMPMetadata metadata;
+
+ @Before
+ public void initTempMetaData() throws Exception {
+ metadata = new XMPMetadata();
+ }
+
+ @Test
+ public void testNSManualDeclaration() throws Exception {
+ HashMap<String, String> namespaces = new HashMap<String, String>();
+ namespaces.put(PDFAExtensionSchema.PDFAEXTENSION,
+ PDFAExtensionSchema.PDFAEXTENSIONURI);
+ namespaces.put(PDFAExtensionSchema.PDFAFIELD,
+ PDFAExtensionSchema.PDFAFIELDURI);
+ namespaces.put(PDFAExtensionSchema.PDFAPROPERTY,
+ PDFAExtensionSchema.PDFAPROPERTYURI);
+ namespaces.put(PDFAExtensionSchema.PDFASCHEMA,
+ PDFAExtensionSchema.PDFASCHEMAURI);
+ namespaces.put(PDFAExtensionSchema.PDFATYPE,
+ PDFAExtensionSchema.PDFATYPEURI);
+
+ PDFAExtensionSchema schem = metadata
+ .createAndAddPDFAExtensionSchemaWithNS(namespaces);
+ Iterator<Attribute> att = schem.getAllAttributes().iterator();
+
+ // PDFAExtension is removed during the building of
+ // PDFAExtensionSchemaWithNS
+ namespaces.put(PDFAExtensionSchema.PDFAEXTENSION,
+ PDFAExtensionSchema.PDFAEXTENSIONURI);
+ Attribute tmp;
+
+ while (att.hasNext()) {
+ // System.out.println(att.next().getPropertyName());
+ tmp = att.next();
+ if (!tmp.getLocalName().equals("about")) {
+ Assert.assertTrue(namespaces.containsKey(tmp.getLocalName()));
+ }
+ }
+ }
+
+ @Test(expected = XmpSchemaException.class)
+ public void testNoPdfExtension() throws Exception {
+ Map<String, String> namespaces = new HashMap<String, String>();
+ new PDFAExtensionSchema(metadata, namespaces);
+ }
+
+ @Test
+ public void testSameSchemaTwice() throws Exception {
+ PDFAExtensionSchema schema = new PDFAExtensionSchema(metadata);
+ SchemaDescription sd1 = schema.createSchemaDescription();
+ sd1.setPrefixValue("pref1");
+ sd1.setNameSpaceURIValue("http://uri1");
+ sd1.setSchemaValue("pref 1");
+ Assert.assertNull(schema.addSchemaDescription(sd1));
+
+ SchemaDescription sd2 = schema.createSchemaDescription();
+ sd2.setPrefixValue("pref1");
+ sd2.setNameSpaceURIValue("http://uri1");
+ sd2.setSchemaValue("pref 1");
+ Assert.assertNotNull(schema.addSchemaDescription(sd2));
+
+ List<SchemaDescription> lsd = schema.getDescriptionSchema();
+ Assert.assertEquals(1, lsd.size());
+ SchemaDescription sd = lsd.get(0);
+ Assert.assertEquals("pref1", sd.getPrefix());
+ Assert.assertEquals("http://uri1", sd.getNameSpaceURI());
+ Assert.assertEquals("pref 1", sd.getSchema());
+ }
+
+ @Test
+ public void testSameNSSchemaDifferentPrefix() throws Exception {
+ PDFAExtensionSchema schema = new PDFAExtensionSchema(metadata);
+ SchemaDescription sd1 = schema.createSchemaDescription();
+ sd1.setPrefixValue("pref1");
+ sd1.setNameSpaceURIValue("http://uri1");
+ sd1.setSchemaValue("pref 1");
+ Assert.assertNull(schema.addSchemaDescription(sd1));
+
+ SchemaDescription sd2 = schema.createSchemaDescription();
+ sd2.setPrefixValue("pref2");
+ sd2.setNameSpaceURIValue("http://uri1");
+ sd2.setSchemaValue("pref 2");
+ Assert.assertNull(schema.addSchemaDescription(sd2));
+
+ List<SchemaDescription> lsd = schema.getDescriptionSchema();
+ Assert.assertEquals(2, lsd.size());
+ SchemaDescription sd = lsd.get(0);
+ Assert.assertEquals("pref1", sd.getPrefix());
+ Assert.assertEquals("http://uri1", sd.getNameSpaceURI());
+ Assert.assertEquals("pref 1", sd.getSchema());
+ }
+
+ @Test
+ public void testDifferentSchemaDifferentPrefix() throws Exception {
+ PDFAExtensionSchema schema = new PDFAExtensionSchema(metadata);
+ SchemaDescription sd1 = schema.createSchemaDescription();
+ sd1.setPrefixValue("pref1");
+ sd1.setNameSpaceURIValue("http://uri1");
+ sd1.setSchemaValue("pref 1");
+ Assert.assertNull(schema.addSchemaDescription(sd1));
+
+ SchemaDescription sd2 = schema.createSchemaDescription();
+ sd2.setPrefixValue("pref2");
+ sd2.setNameSpaceURIValue("http://uri2");
+ sd2.setSchemaValue("pref 2");
+ Assert.assertNull(schema.addSchemaDescription(sd2));
+
+ List<SchemaDescription> lsd = schema.getDescriptionSchema();
+ Assert.assertEquals(2, lsd.size());
+ SchemaDescription sd = lsd.get(0);
+ Assert.assertEquals("pref1", sd.getPrefix());
+ Assert.assertEquals("http://uri1", sd.getNameSpaceURI());
+ Assert.assertEquals("pref 1", sd.getSchema());
+ }
+
+ @Test
+ public void testPDFExt() throws Exception {
+
+ PDFAExtensionSchema schem = metadata
+ .createAndAddPDFAExtensionSchemaWithDefaultNS();
+
+ Assert.assertEquals("pdfaExtension", schem.getPrefix());
+ Assert.assertEquals("http://www.aiim.org/pdfa/ns/extension/", schem
+ .getNamespaceValue());
+
+ String schemDesc = "Schema Acte de naissance";
+ String schemURI = "http://test.apache.com/xap/adn/";
+ String schemPrefix = "adn";
+
+ SchemaDescription desc = schem.createSchemaDescription();
+ desc.setSchemaValue(schemDesc);
+ desc.setNameSpaceURIValue(schemURI);
+ desc.setPrefixValue(schemPrefix);
+ schem.addSchemaDescription(desc);
+
+ Assert.assertEquals(schemDesc, desc.getSchema());
+ Assert.assertEquals(schemURI, desc.getNameSpaceURI());
+ Assert.assertEquals(schemPrefix, desc.getPrefix());
+
+ String descExpected = "nom de la personne concernée";
+ desc.addProperty("nom", "Text", "external",
+ "nom de la personne concernee");
+ desc.addProperty("nom", "Text", "external", descExpected);
+ Assert.assertEquals(1, desc.getProperties().size());
+ Assert.assertEquals(descExpected, desc.getProperties().get(0)
+ .getDescriptionValue());
+ desc.addProperty("prénom", "Text", "external",
+ "prénom de la personne concernée");
+
+ List<PDFAPropertyDescription> list = desc.getProperties();
+ Assert.assertEquals("nom", list.get(0).getNameValue());
+ Assert.assertEquals("prénom", list.get(1).getNameValue());
+
+ // Check retrieve descriptions
+ Assert.assertEquals(desc, schem.getIteratorOfDescriptions().next());
+ Assert.assertEquals(desc, schem.getDescriptionSchema().get(0));
+
+ // check retrieve this schema in metadata
+ Assert.assertEquals(schem, metadata.getPDFExtensionSchema());
+
+ // Check if no problem when create 2 description and display result
+ SchemaDescription desc2 = schem.createSchemaDescription();
+ desc2.setSchemaValue("2eme schema de test");
+ desc2.setNameSpaceURIValue("http://test.apache.com/xap/test/");
+ desc2.setPrefixValue("tst");
+ desc2.addProperty("TestText", "OwnType", "external",
+ "just a text property");
+ schem.addSchemaDescription(desc2);
+ // Check value type
+ String valType = "OwnType";
+ String nsType = "http://test.apache.com/xap/test/";
+ String prefType = "tst";
+ String descType = "Test Own type";
+ desc2.addValueType(valType, nsType, prefType, "must be replaced", null);
+ desc2.addValueType(valType, nsType, prefType, descType, null);
+ Assert.assertEquals(1, desc2.getValueTypes().size());
+ PDFAValueTypeDescription value = desc2.getValueTypes().get(0);
+ Assert.assertEquals(valType, value.getTypeNameValue());
+ Assert.assertEquals(nsType, value.getNamespaceURIValue());
+ Assert.assertEquals(prefType, value.getPrefixValue());
+ Assert.assertEquals(descType, value.getDescriptionValue());
+
+ // SaveMetadataHelper.serialize(metadata, true, System.out);
+
+ // valuetype test
+
+ }
+}
Propchange: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAExtensionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationOthersTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationOthersTest.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationOthersTest.java (added)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationOthersTest.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,86 @@
+/*****************************************************************************
+ *
+ * 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.padaf.xmpbox.schema;
+
+import junit.framework.Assert;
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.schema.PDFAIdentificationSchema;
+import org.apache.padaf.xmpbox.type.BadFieldValueException;
+import org.junit.Before;
+import org.junit.Test;
+
+public class PDFAIdentificationOthersTest {
+
+ protected XMPMetadata metadata;
+
+ @Before
+ public void initTempMetaData() throws Exception {
+ metadata = new XMPMetadata();
+
+ }
+
+ @Test
+ public void testPDFAIdentification() throws Exception {
+ PDFAIdentificationSchema pdfaid = metadata
+ .createAndAddPFAIdentificationSchema();
+
+ Integer versionId = 1;
+ String amdId = "2005";
+ String conformance = "B";
+
+ pdfaid.setPartValueWithInt(versionId);
+ pdfaid.setAmdValue(amdId);
+ pdfaid.setConformanceValue(conformance);
+
+ Assert.assertEquals(versionId, pdfaid.getPartValue());
+ Assert.assertEquals(amdId, pdfaid.getAmendmentValue());
+ Assert.assertEquals(conformance, pdfaid.getConformanceValue());
+
+ Assert.assertEquals("" + versionId, pdfaid.getPart().getStringValue());
+ Assert.assertEquals(amdId, pdfaid.getAmd().getStringValue());
+ Assert.assertEquals(conformance, pdfaid.getConformance()
+ .getStringValue());
+
+ // check retrieve this schema in metadata
+ Assert.assertEquals(pdfaid, metadata.getPDFIdentificationSchema());
+
+ // SaveMetadataHelper.serialize(metadata, true, System.out);
+ }
+
+ @Test(expected = BadFieldValueException.class)
+ public void testBadPDFAConformanceId() throws BadFieldValueException {
+ PDFAIdentificationSchema pdfaid = metadata
+ .createAndAddPFAIdentificationSchema();
+ String conformance = "kiohiohiohiohio";
+ pdfaid.setConformanceValue(conformance);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testBadVersionIdValueType() throws Exception {
+ PDFAIdentificationSchema pdfaid = metadata
+ .createAndAddPFAIdentificationSchema();
+ pdfaid.setPartValueWithString("1");
+ pdfaid.setPartValueWithString("ojoj");
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationOthersTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationTest.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationTest.java (added)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationTest.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,59 @@
+/*****************************************************************************
+ *
+ * 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.padaf.xmpbox.schema;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.schema.PDFAIdentificationSchema;
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+@RunWith(Parameterized.class)
+public class PDFAIdentificationTest extends AbstractXMPSchemaTest {
+
+ @Before
+ public void initTempMetaData() throws Exception {
+ metadata = new XMPMetadata();
+ schema = metadata.createAndAddPFAIdentificationSchema();
+ schemaClass = PDFAIdentificationSchema.class;
+ }
+
+ @Parameters
+ public static Collection<Object[]> initializeParameters() throws Exception {
+ List<Object[]> data = new ArrayList<Object[]>();
+ data.add(wrapProperty("part", "Integer", 1));
+ data.add(wrapProperty("amd", "Text", "2005"));
+ data.add(wrapProperty("conformance", "Text", "B"));
+ return data;
+ }
+
+ public PDFAIdentificationTest(String property, String type, Object value) {
+ super(property, type, value);
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAIdentificationTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAPropertyDescriptionTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAPropertyDescriptionTest.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAPropertyDescriptionTest.java (added)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAPropertyDescriptionTest.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,86 @@
+/*****************************************************************************
+ *
+ * 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.padaf.xmpbox.schema;
+
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.schema.PDFAPropertyDescription;
+import org.apache.padaf.xmpbox.type.BadFieldValueException;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.w3c.dom.Element;
+
+public class PDFAPropertyDescriptionTest {
+
+ protected XMPMetadata parent;
+
+ @Before
+ public void resetDocument() throws Exception {
+ parent = new XMPMetadata();
+ }
+
+ @Test
+ public void testCreateOnePdfaProperty() throws Exception {
+ PDFAPropertyDescription pdfprop = new PDFAPropertyDescription(parent);
+ String name = "value Test";
+ String valueT = "Text";
+ String cat = "external";
+ String desc = "it's a test property";
+ pdfprop.setNameValue(name);
+ pdfprop.setValueTypeValue(valueT);
+ pdfprop.setCategoryValue(cat);
+ pdfprop.setDescriptionValue(desc);
+
+ Assert.assertEquals(name, pdfprop.getNameValue());
+ Assert.assertEquals(valueT, pdfprop.getValueTypeValue());
+ Assert.assertEquals(cat, pdfprop.getCategoryValue());
+ Assert.assertEquals(desc, pdfprop.getDescriptionValue());
+
+ Assert.assertEquals(name, pdfprop.getName().getStringValue());
+ Assert.assertEquals(valueT, pdfprop.getValueType().getStringValue());
+ Assert.assertEquals(cat, pdfprop.getCategory().getStringValue());
+ Assert.assertEquals(desc, pdfprop.getDescription().getStringValue());
+
+ Element e = parent.getFuturOwner().createElement("test");
+ e.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:rdf",
+ "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
+ e.appendChild(pdfprop.getElement());
+ parent.getFuturOwner().appendChild(e);
+ // XMLUtil.save(parent.getFuturOwner(), System.out, "UTF-8");
+ }
+
+ @Test(expected = BadFieldValueException.class)
+ public void testBadFieldCheckForCategory() throws Exception {
+ PDFAPropertyDescription pdfprop = new PDFAPropertyDescription(parent);
+ String name = "value Test";
+ String valueT = "Text";
+ String cat = "badvalue";
+ String desc = "it's a test property";
+ pdfprop.setNameValue(name);
+ pdfprop.setValueTypeValue(valueT);
+ pdfprop.setCategoryValue(cat);
+ pdfprop.setDescriptionValue(desc);
+
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAPropertyDescriptionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAValueTypeDescriptionTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAValueTypeDescriptionTest.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAValueTypeDescriptionTest.java (added)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAValueTypeDescriptionTest.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,122 @@
+/*****************************************************************************
+ *
+ * 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.padaf.xmpbox.schema;
+
+import javax.xml.transform.TransformerException;
+
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.schema.PDFAFieldDescription;
+import org.apache.padaf.xmpbox.schema.PDFAValueTypeDescription;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class PDFAValueTypeDescriptionTest {
+
+ protected XMPMetadata parent;
+
+ @Before
+ public void resetDocument() throws Exception {
+ parent = new XMPMetadata();
+ }
+
+ @Test
+ public void testCreateOnePdfaProperty() throws TransformerException {
+ PDFAValueTypeDescription pdfvalueType = new PDFAValueTypeDescription(
+ parent);
+ String type = "value Test";
+ String namespaceURI = "Text";
+ String prefix = "test";
+ String description = "it's a test property";
+
+ String fieldName1 = "field1";
+ String fieldValueType1 = "Text";
+ String fieldDescription1 = "Field one";
+
+ String fieldName2 = "field2";
+ String fieldValueType2 = "Text";
+ String fieldDescription2 = "Field two";
+
+ pdfvalueType.setTypeNameValue(type);
+ pdfvalueType.setNamespaceURIValue(namespaceURI);
+ pdfvalueType.setPrefixValue(prefix);
+ pdfvalueType.setDescriptionValue(description);
+
+ Assert.assertEquals("pdfaType:type", pdfvalueType.getTypeName()
+ .getQualifiedName());
+ Assert.assertEquals(type, pdfvalueType.getTypeNameValue());
+
+ Assert.assertEquals("pdfaType:namespaceURI", pdfvalueType
+ .getNamespaceURI().getQualifiedName());
+ Assert.assertEquals(namespaceURI, pdfvalueType.getNamespaceURIValue());
+
+ Assert.assertEquals("pdfaType:prefix", pdfvalueType.getPrefix()
+ .getQualifiedName());
+ Assert.assertEquals(prefix, pdfvalueType.getPrefixValue());
+
+ Assert.assertEquals("pdfaType:description", pdfvalueType
+ .getDescription().getQualifiedName());
+ Assert.assertEquals(description, pdfvalueType.getDescriptionValue());
+
+ pdfvalueType.addField(fieldName1, fieldValueType1, fieldDescription1);
+ pdfvalueType.addField(fieldName2, fieldValueType2, fieldDescription2);
+
+ PDFAFieldDescription field1, field2;
+ Assert.assertEquals(2, pdfvalueType.getFields().size());
+ field1 = pdfvalueType.getFields().get(0);
+ field2 = pdfvalueType.getFields().get(1);
+
+ Assert.assertEquals("pdfaField:name", field1.getName()
+ .getQualifiedName());
+ Assert.assertEquals(fieldName1, field1.getNameValue());
+ Assert.assertEquals("pdfaField:valueType", field1.getValueType()
+ .getQualifiedName());
+ Assert.assertEquals(fieldValueType1, field1.getValueTypeValue());
+ Assert.assertEquals("pdfaField:description", field1.getDescription()
+ .getQualifiedName());
+ Assert.assertEquals(fieldDescription1, field1.getDescriptionValue());
+
+ Assert.assertEquals("pdfaField:name", field2.getName()
+ .getQualifiedName());
+ Assert.assertEquals(fieldName2, field2.getNameValue());
+ Assert.assertEquals("pdfaField:valueType", field2.getValueType()
+ .getQualifiedName());
+ Assert.assertEquals(fieldValueType2, field2.getValueTypeValue());
+ Assert.assertEquals("pdfaField:description", field2.getDescription()
+ .getQualifiedName());
+ Assert.assertEquals(fieldDescription2, field2.getDescriptionValue());
+
+ // test add same field
+ pdfvalueType.addField(field1);
+
+ /*
+ * Element e=parent.getFuturOwner().createElement("test");
+ * e.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:rdf",
+ * "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
+ * e.appendChild(pdfvalueType.getElement());
+ * parent.getFuturOwner().appendChild(e);
+ * XMLUtil.save(parent.getFuturOwner(), System.out, "UTF-8");
+ */
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/PDFAValueTypeDescriptionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPBasicTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPBasicTest.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPBasicTest.java (added)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPBasicTest.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,153 @@
+/*****************************************************************************
+ *
+ * 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.padaf.xmpbox.schema;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.List;
+
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.schema.XMPBasicSchema;
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+@RunWith(Parameterized.class)
+public class XMPBasicTest extends AbstractXMPSchemaTest {
+
+ public XMPBasicTest(String prop, String type, Object val) {
+ super(prop, type, val);
+ }
+
+ @Before
+ public void initTempMetaData() throws Exception {
+ metadata = new XMPMetadata();
+ schema = metadata.createAndAddXMPBasicSchema();
+ schemaClass = XMPBasicSchema.class;
+ }
+
+ @Parameters
+ public static Collection<Object[]> initializeParameters() throws Exception {
+ List<Object[]> data = new ArrayList<Object[]>();
+
+ data.add(wrapProperty("Advisory", "bag Xpath", new String[] { "xpath1",
+ "xpath2" }));
+ data.add(wrapProperty("BaseURL", "URL", "URL"));
+ data.add(wrapProperty("CreateDate", "Date", Calendar.getInstance()));
+ data.add(wrapProperty("CreatorTool", "Text", "CreatorTool"));
+ data.add(wrapProperty("Identifier", "bag Text", new String[] { "id1",
+ "id2" }));
+ data.add(wrapProperty("Label", "Text", "label"));
+ data.add(wrapProperty("MetadataDate", "Date", Calendar.getInstance()));
+ data.add(wrapProperty("ModifyDate", "Date", Calendar.getInstance()));
+ data.add(wrapProperty("Nickname", "Text", "nick name"));
+ data.add(wrapProperty("Rating", "Integer", 7));
+
+ // TODO test Thumbnail when implemented in the XMPBasicSchema
+ data.add(wrapProperty("Thumbnails", "Alt Thumbnail", null));
+
+ return data;
+ }
+
+ // @Test
+ // public void testPDFExt() throws TransformException{
+ // XMPBasicSchema schem=metadata.createAndAddXMPBasicSchema();
+ //
+ // String xpath1="xpath1";
+ // String xpath2="xpath2";
+ // String url="URL";
+ // Calendar createDate=Calendar.getInstance();
+ // String creatorTool="CreatorTool";
+ // String identifier1="id1";
+ // String identifier2="id2";
+ // String label="label";
+ // Calendar metaDataDate=Calendar.getInstance();
+ // Calendar modifyDate=Calendar.getInstance();
+ // String nickname="nickname";
+ // int rate=7;
+ //
+ // schem.addAdvisoryValue(xpath1);
+ // schem.addAdvisoryValue(xpath2);
+ // schem.setBaseURLValue(url);
+ // schem.setCreateDateValue(createDate);
+ // schem.setCreatorToolValue(creatorTool);
+ // schem.addIdentifierValue(identifier1);
+ // schem.addIdentifierValue(identifier2);
+ // schem.setLabelValue(label);
+ // schem.setMetadataDateValue(metaDataDate);
+ // schem.setModifyDateValue(modifyDate);
+ // schem.setNicknameValue(nickname);
+ // schem.setRatingValue(rate);
+ //
+ // //check retrieve this schema in metadata
+ // Assert.assertEquals(schem, metadata.getXMPBasicSchema());
+ //
+ // //check values embedded in this schema
+ // Assert.assertEquals("xmp:Advisory",
+ // schem.getAdvisory().getQualifiedName());
+ // Assert.assertTrue(schem.getAdvisoryValues().contains(xpath1));
+ // Assert.assertTrue(schem.getAdvisoryValues().contains(xpath2));
+ //
+ // Assert.assertEquals("xmp:BaseURL",
+ // schem.getBaseURL().getQualifiedName());
+ // Assert.assertEquals(url, schem.getBaseURLValue());
+ //
+ // Assert.assertEquals("xmp:CreateDate",
+ // schem.getCreateDate().getQualifiedName());
+ // Assert.assertEquals(createDate, schem.getCreateDateValue());
+ //
+ // Assert.assertEquals("xmp:CreatorTool",
+ // schem.getCreatorTool().getQualifiedName());
+ // Assert.assertEquals(creatorTool, schem.getCreatorToolValue());
+ //
+ // Assert.assertEquals("xmp:Identifier",
+ // schem.getIdentifier().getQualifiedName());
+ // Assert.assertTrue(schem.getIdentifierValues().contains(identifier1));
+ // Assert.assertTrue(schem.getIdentifierValues().contains(identifier2));
+ //
+ // Assert.assertEquals("xmp:Label", schem.getLabel().getQualifiedName());
+ // Assert.assertEquals(label, schem.getLabelValue());
+ //
+ // Assert.assertEquals("xmp:MetadataDate",
+ // schem.getMetadataDate().getQualifiedName());
+ // Assert.assertEquals(metaDataDate, schem.getMetadataDateValue());
+ //
+ // Assert.assertEquals("xmp:ModifyDate",
+ // schem.getModifyDate().getQualifiedName());
+ // Assert.assertEquals(modifyDate, schem.getModifyDateValue());
+ //
+ // Assert.assertEquals("xmp:Nickname",
+ // schem.getNickname().getQualifiedName());
+ // Assert.assertEquals(nickname, schem.getNicknameValue());
+ //
+ // Assert.assertEquals("xmp:Rating", schem.getRating().getQualifiedName());
+ // Assert.assertEquals(rate, schem.getRatingValue());
+ //
+ // //SaveMetadataHelper.serialize(metadata, true, System.out);
+ //
+ // //TODO test Thumbnail when implemented in the XMPBasicSchema
+ // }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPBasicTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementTest.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementTest.java (added)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementTest.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,74 @@
+/*****************************************************************************
+ *
+ * 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.padaf.xmpbox.schema;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.schema.XMPMediaManagementSchema;
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+@RunWith(Parameterized.class)
+public class XMPMediaManagementTest extends AbstractXMPSchemaTest {
+
+ @Before
+ public void initTempMetaData() throws Exception {
+ metadata = new XMPMetadata();
+ schema = metadata.createAndAddXMPMediaManagementSchema();
+ schemaClass = XMPMediaManagementSchema.class;
+ }
+
+ @Parameters
+ public static Collection<Object[]> initializeParameters() throws Exception {
+ List<Object[]> data = new ArrayList<Object[]>();
+ data.add(wrapProperty("DocumentID", "Text",
+ "uuid:FB031973-5E75-11B2-8F06-E7F5C101C07A"));
+ data.add(wrapProperty("ResourceRef", "Text", "uuid:14"));
+ data.add(wrapProperty("Manager", "Text", "Raoul"));
+ data.add(wrapProperty("ManageTo", "Text", "uuid:36"));
+ data.add(wrapProperty("ManageUI", "Text", "uuid:3635"));
+ data.add(wrapProperty("ManageFrom", "Text", "uuid:36"));
+ data.add(wrapProperty("InstanceID", "Text", "uuid:42"));
+ data.add(wrapProperty("OriginalDocumentID", "Text", "uuid:142"));
+ data.add(wrapProperty("RenditionClass", "Text", "myclass"));
+ data.add(wrapProperty("RenditionParams", "Text", "my params"));
+ data.add(wrapProperty("VersionID", "Text", "14"));
+ data.add(wrapProperty("Versions", "seq Text", new String[] { "1", "2",
+ "3" }));
+ data.add(wrapProperty("History", "seq Text", new String[] { "action 1",
+ "action 2", "action 3" }));
+ data.add(wrapProperty("Ingredients", "bag Text", new String[] {
+ "resource1", "resource2" }));
+ return data;
+ }
+
+ public XMPMediaManagementTest(String property, String type, Object value) {
+ super(property, type, value);
+ }
+
+}
Propchange: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPMediaManagementTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPSchemaTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPSchemaTest.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPSchemaTest.java (added)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPSchemaTest.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,493 @@
+/*****************************************************************************
+ *
+ * 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.padaf.xmpbox.schema;
+
+import java.io.IOException;
+import java.util.Calendar;
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.parser.DateConverter;
+import org.apache.padaf.xmpbox.schema.XMPSchema;
+import org.apache.padaf.xmpbox.type.AbstractField;
+import org.apache.padaf.xmpbox.type.Attribute;
+import org.apache.padaf.xmpbox.type.BadFieldValueException;
+import org.apache.padaf.xmpbox.type.BooleanType;
+import org.apache.padaf.xmpbox.type.ComplexProperty;
+import org.apache.padaf.xmpbox.type.DateType;
+import org.apache.padaf.xmpbox.type.IntegerType;
+import org.apache.padaf.xmpbox.type.TextType;
+import org.junit.Before;
+import org.junit.Test;
+
+public class XMPSchemaTest {
+
+ protected XMPMetadata parent;
+ protected XMPSchema schem;
+
+ @Before
+ public void resetDocument() throws Exception {
+ parent = new XMPMetadata();
+ schem = new XMPSchema(parent, "nsSchem", "nsURI");
+
+ }
+
+ /**
+ * Check if Bag (Unordered Array) management is ok
+ *
+ * @throws InappropriateTypeException
+ */
+ @Test
+ public void testBagManagement() throws Exception {
+ String bagName = "nsSchem:BAGTEST";
+ String value1 = "valueOne";
+ String value2 = "valueTwo";
+ schem.addBagValue(bagName, new TextType(parent, "rdf", "li", value1));
+ schem.addBagValue(bagName, value2);
+
+ List<String> values = schem.getBagValueList(bagName);
+ Assert.assertEquals(value1, values.get(0));
+ Assert.assertEquals(value2, values.get(1));
+
+ schem.removeBagValue(bagName, value1);
+ List<String> values2 = schem.getBagValueList(bagName);
+ Assert.assertEquals(1, values2.size());
+ Assert.assertEquals(value2, values2.get(0));
+
+ /*
+ * System.out.println("Bag Management :");
+ * parent.getFuturOwner().appendChild(schem.getElement()); try {
+ * XMLUtil.save(parent.getFuturOwner(), System.out, "UTF-8"); } catch
+ * (TransformerException e) {
+ *
+ * e.printStackTrace(); } System.out.println("------------------");
+ */
+
+ }
+
+ @Test
+ public void testArrayList() throws Exception {
+ ComplexProperty newSeq = new ComplexProperty(parent, "nsSchem",
+ "seqType", ComplexProperty.ORDERED_ARRAY);
+ TextType li1 = new TextType(parent, "rdf", "li", "valeur1");
+ TextType li2 = new TextType(parent, "rdf", "li", "valeur2");
+ newSeq.getContainer().addProperty(li1);
+ newSeq.getContainer().addProperty(li2);
+ schem.addProperty(newSeq);
+ List<AbstractField> list = schem.getArrayList("nsSchem:seqType");
+ Assert.assertTrue(list.contains(li1));
+ Assert.assertTrue(list.contains(li2));
+
+ }
+
+ /**
+ * Check if Seq (Ordered Array) management is ok
+ *
+ * @throws InappropriateTypeException
+ * @throws IOException
+ */
+ @Test
+ public void testSeqManagement() throws Exception {
+ Calendar date = Calendar.getInstance();
+ BooleanType bool = new BooleanType(parent, "rdf", "li", "True");
+ String textVal = "seqValue";
+ String seqName = "nsSchem:SEQNAME";
+
+ schem.addSequenceDateValue(seqName, date);
+ schem.addSequenceValue(seqName, bool);
+ schem.addSequenceValue(seqName, textVal);
+
+ List<Calendar> dates = schem.getSequenceDateValueList(seqName);
+ Assert.assertEquals(1, dates.size());
+ Assert.assertEquals(date, dates.get(0));
+
+ List<String> values = schem.getSequenceValueList(seqName);
+ Assert.assertEquals(3, values.size());
+ Assert.assertEquals(DateConverter.toISO8601(date), values.get(0));
+ Assert.assertEquals(bool.getStringValue(), values.get(1));
+ Assert.assertEquals(textVal, values.get(2));
+
+ /*
+ * System.out.println("Seq Management :");
+ * parent.getFuturOwner().appendChild(schem.getElement()); try {
+ * XMLUtil.save(parent.getFuturOwner(), System.out, "UTF-8"); } catch
+ * (TransformerException e) {
+ *
+ * e.printStackTrace(); } System.out.println("------------------");
+ */
+
+ schem.removeSequenceDateValue(seqName, date);
+ Assert.assertEquals(0, schem.getSequenceDateValueList(seqName).size());
+
+ schem.removeSequenceValue(seqName, bool);
+ schem.removeSequenceValue(seqName, textVal);
+
+ Assert.assertEquals(0, schem.getSequenceValueList(seqName).size());
+ }
+
+ @Test
+ public void rdfAboutTest() {
+ Assert.assertNull(schem.getAboutValue());
+ String about = "about";
+ schem.setAboutAsSimple(about);
+ Assert.assertEquals(about, schem.getAboutValue());
+ schem.setAboutAsSimple(null);
+ Assert.assertNull(schem.getAboutValue());
+ }
+
+ @Test(expected = BadFieldValueException.class)
+ public void testBadRdfAbout() throws Exception {
+ schem.setAbout(new Attribute(null, "bill", "about", ""));
+ }
+
+ @Test
+ public void testSetSpecifiedSimpleTypeProperty() throws Exception {
+ String prop = "testprop";
+ String val = "value";
+ String val2 = "value2";
+ schem.setTextPropertyValueAsSimple(prop, val);
+ Assert.assertEquals(val, schem.getTextPropertyValueAsSimple(prop));
+ schem.setTextPropertyValueAsSimple(prop, val2);
+ Assert.assertEquals(val2, schem.getTextPropertyValueAsSimple(prop));
+ schem.setTextPropertyValueAsSimple(prop, null);
+ Assert.assertNull(schem.getTextPropertyValueAsSimple(prop));
+ }
+
+ @Test
+ public void testSpecifiedSimplePropertyFormer() throws Exception {
+ String prop = "testprop";
+ String val = "value";
+ String val2 = "value2";
+ schem.setTextPropertyValueAsSimple(prop, val);
+ TextType text = new TextType(parent, schem.getPrefix(), prop, "value2");
+ schem.setTextProperty(text);
+ Assert.assertEquals(val2, schem.getTextPropertyValueAsSimple(prop));
+ Assert.assertEquals(text, schem.getTextProperty(schem.getPrefix() + ":"
+ + prop));
+ }
+
+ @Test
+ public void testAsSimpleMethods() throws Exception {
+ String bool = "bool";
+ boolean boolVal = true;
+
+ String date = "date";
+ Calendar dateVal = Calendar.getInstance();
+
+ String integ = "integer";
+ Integer i = 1;
+
+ String langprop = "langprop";
+ String lang = "x-default";
+ String langVal = "langVal";
+
+ String bagprop = "bagProp";
+ String bagVal = "bagVal";
+
+ String seqprop = "SeqProp";
+ String seqPropVal = "seqval";
+
+ String seqdate = "SeqDate";
+
+ String prefSchem = schem.getPrefix() + ":";
+
+ schem.setBooleanPropertyValueAsSimple(bool, boolVal);
+ schem.setDatePropertyValueAsSimple(date, dateVal);
+ schem.setIntegerPropertyValueAsSimple(integ, i);
+ schem.setLanguagePropertyValueAsSimple(langprop, lang, langVal);
+ schem.addBagValueAsSimple(bagprop, bagVal);
+ schem.addSequenceValueAsSimple(seqprop, seqPropVal);
+ schem.addSequenceDateValueAsSimple(seqdate, dateVal);
+
+ Assert.assertEquals(boolVal, schem.getBooleanProperty(prefSchem + bool)
+ .getValue());
+ Assert.assertEquals(dateVal, schem.getDateProperty(prefSchem + date)
+ .getValue());
+ Assert.assertEquals("" + i, schem.getIntegerProperty(prefSchem + integ)
+ .getStringValue());
+ Assert.assertEquals(langVal, schem.getLanguagePropertyValue(prefSchem
+ + langprop, lang));
+ Assert.assertTrue(schem.getBagValueList(prefSchem + bagprop).contains(
+ bagVal));
+ Assert.assertTrue(schem.getSequenceValueList(prefSchem + seqprop)
+ .contains(seqPropVal));
+ Assert.assertTrue(schem.getSequenceDateValueList(prefSchem + seqdate)
+ .contains(dateVal));
+ Assert.assertTrue(schem.getLanguagePropertyLanguagesValue(
+ prefSchem + langprop).contains(lang));
+
+ Assert.assertEquals(boolVal, schem
+ .getBooleanPropertyValueAsSimple(bool).booleanValue());
+ Assert.assertEquals(dateVal, schem.getDatePropertyValueAsSimple(date));
+ Assert.assertEquals(i, schem.getIntegerPropertyValueAsSimple(integ));
+ Assert.assertEquals(langVal, schem.getLanguagePropertyValueAsSimple(
+ langprop, lang));
+ Assert.assertTrue(schem.getBagValueListAsSimple(bagprop).contains(
+ bagVal));
+ Assert.assertTrue(schem.getSequenceValueListAsSimple(seqprop).contains(
+ seqPropVal));
+ Assert.assertTrue(schem.getSequenceDateValueListAsSimple(seqdate)
+ .contains(dateVal));
+ Assert.assertTrue(schem.getLanguagePropertyLanguagesValueAsSimple(
+ langprop).contains(lang));
+ }
+
+ /**
+ * Test All common simple properties management in XMPSchema
+ *
+ * @throws InappropriateTypeException
+ * @throws BadFieldValueException
+ */
+ @Test
+ public void testProperties() throws Exception {
+
+ Assert.assertEquals("nsURI", schem.getNamespaceValue());
+
+ // In real cases, rdf ns will be declared before !
+ schem.setAttribute(new Attribute("http://www.w3.org/2000/xmlns/",
+ "xmlns", "rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"));
+
+ String aboutVal = "aboutTest";
+ schem.setAboutAsSimple(aboutVal);
+ Assert.assertEquals(aboutVal, schem.getAboutValue());
+
+ Attribute about = new Attribute(null, "rdf", "about", "YEP");
+ schem.setAbout(about);
+ Assert.assertEquals(about, schem.getAboutAttribute());
+
+ String textProp = "nsSchem:textProp";
+ String textPropVal = "TextPropTest";
+ schem.setTextPropertyValue(textProp, textPropVal);
+ Assert.assertEquals(textPropVal, schem.getTextPropertyValue(textProp));
+
+ TextType text = new TextType(parent, "nsSchem", "textType", "GRINGO");
+ schem.setTextProperty(text);
+ Assert.assertEquals(text, schem.getTextProperty("nsSchem:textType"));
+
+ Calendar dateVal = Calendar.getInstance();
+ String date = "nsSchem:dateProp";
+ schem.setDatePropertyValue(date, dateVal);
+ Assert.assertEquals(dateVal, schem.getDatePropertyValue(date));
+
+ DateType dateType = new DateType(parent, "nsSchem", "dateType",
+ Calendar.getInstance());
+ schem.setDateProperty(dateType);
+ Assert
+ .assertEquals(dateType, schem
+ .getDateProperty("nsSchem:dateType"));
+
+ String bool = "nsSchem:booleanTestProp";
+ Boolean boolVal = false;
+ schem.setBooleanPropertyValue(bool, boolVal);
+ Assert.assertEquals(boolVal, schem.getBooleanPropertyValue(bool));
+
+ BooleanType boolType = new BooleanType(parent, "nsSchem", "boolType",
+ false);
+ schem.setBooleanProperty(boolType);
+ Assert.assertEquals(boolType, schem
+ .getBooleanProperty("nsSchem:boolType"));
+
+ String intProp = "nsSchem:IntegerTestProp";
+ Integer intPropVal = 5;
+ schem.setIntegerPropertyValue(intProp, intPropVal);
+ Assert.assertEquals(intPropVal, schem.getIntegerPropertyValue(intProp));
+
+ IntegerType intType = new IntegerType(parent, "nsSchem", "intType", 5);
+ schem.setIntegerProperty(intType);
+ Assert.assertEquals(intType, schem
+ .getIntegerProperty("nsSchem:intType"));
+
+ // Check bad type verification
+ boolean ok = false;
+ try {
+ schem.getIntegerProperty("nsSchem:boolType");
+ } catch (IllegalArgumentException e) {
+ ok = true;
+ }
+ Assert.assertEquals(true, ok);
+ ok = false;
+ try {
+ schem.getTextProperty("nsSchem:intType");
+ } catch (IllegalArgumentException e) {
+ ok = true;
+ }
+ Assert.assertEquals(true, ok);
+ ok = false;
+ try {
+ schem.getDateProperty("nsSchem:textType");
+ } catch (IllegalArgumentException e) {
+ ok = true;
+ }
+ Assert.assertEquals(true, ok);
+ ok = false;
+ try {
+ schem.getBooleanProperty("nsSchem:dateType");
+ } catch (IllegalArgumentException e) {
+ ok = true;
+ }
+
+ /*
+ * System.out.println("Simple Properties Management :");
+ * parent.getFuturOwner().appendChild(schem.getElement()); try {
+ * XMLUtil.save(parent.getFuturOwner(), System.out, "UTF-8"); } catch
+ * (TransformerException e) {
+ *
+ * e.printStackTrace(); } System.out.println("------------------");
+ */
+
+ }
+
+ @Test
+ public void testAltProperties() throws Exception {
+ String altProp = "nsSchem:AltProp";
+
+ String defaultLang = "x-default";
+ String defaultVal = "Default Language";
+
+ String usLang = "en-us";
+ String usVal = "American Language";
+
+ String frLang = "fr-fr";
+ String frVal = "Lang française";
+
+ schem.setLanguagePropertyValue(altProp, usLang, usVal);
+ schem.setLanguagePropertyValue(altProp, defaultLang, defaultVal);
+ schem.setLanguagePropertyValue(altProp, frLang, frVal);
+
+ Assert.assertEquals(defaultVal, schem.getLanguagePropertyValue(altProp,
+ defaultLang));
+ Assert.assertEquals(frVal, schem.getLanguagePropertyValue(altProp,
+ frLang));
+ Assert.assertEquals(usVal, schem.getLanguagePropertyValue(altProp,
+ usLang));
+
+ List<String> languages = schem
+ .getLanguagePropertyLanguagesValue(altProp);
+ // default language must be in first place
+ Assert.assertEquals(defaultLang, languages.get(0));
+
+ Assert.assertTrue(languages.contains(usLang));
+ Assert.assertTrue(languages.contains(frLang));
+
+ // Test replacement/removal
+
+ frVal = "Langue française";
+
+ schem.setLanguagePropertyValue(altProp, frLang, frVal);
+ Assert.assertEquals(frVal, schem.getLanguagePropertyValue(altProp,
+ frLang));
+
+ schem.setLanguagePropertyValue(altProp, frLang, null);
+ languages = schem.getLanguagePropertyLanguagesValue(altProp);
+ Assert.assertFalse(languages.contains(frLang));
+ schem.setLanguagePropertyValue(altProp, frLang, frVal);
+
+ /*
+ * System.out.println("Alternatives lang Management :");
+ * parent.getFuturOwner().appendChild(schem.getElement()); try {
+ * XMLUtil.save(parent.getFuturOwner(), System.out, "UTF-8"); } catch
+ * (TransformerException e) {
+ *
+ * e.printStackTrace(); } System.out.println("------------------");
+ */
+
+ }
+
+ /**
+ * check if merging is ok
+ *
+ * @throws InappropriateTypeException
+ * @throws IOException
+ */
+ @Test
+ public void testMergeSchema() throws Exception {
+ String bagName = "test:bagName";
+ String seqName = "test:seqName";
+ String altName = "test:AltProp";
+
+ String valBagSchem1 = "BagvalSchem1";
+ String valBagSchem2 = "BagvalSchem2";
+
+ String valSeqSchem1 = "seqvalSchem1";
+ String valSeqSchem2 = "seqvalSchem2";
+
+ String valAltSchem1 = "altvalSchem1";
+ String langAltSchem1 = "x-default";
+
+ String valAltSchem2 = "altvalSchem2";
+ String langAltSchem2 = "fr-fr";
+
+ XMPSchema schem1 = new XMPSchema(parent, "test",
+ "http://www.test.org/schem/");
+ schem1.addBagValue(bagName, valBagSchem1);
+ schem1.addSequenceValue(seqName, valSeqSchem1);
+ schem1.setLanguagePropertyValue(altName, langAltSchem1, valAltSchem1);
+
+ XMPSchema schem2 = new XMPSchema(parent, "test",
+ "http://www.test.org/schem/");
+ schem2.addBagValue(bagName, valBagSchem2);
+ schem2.addSequenceValue(seqName, valSeqSchem2);
+ schem2.setLanguagePropertyValue(altName, langAltSchem2, valAltSchem2);
+
+ schem1.merge(schem2);
+
+ // Check if all values are present
+ Assert.assertEquals(valAltSchem2, schem1.getLanguagePropertyValue(
+ altName, langAltSchem2));
+ Assert.assertEquals(valAltSchem1, schem1.getLanguagePropertyValue(
+ altName, langAltSchem1));
+
+ List<String> bag = schem1.getBagValueList(bagName);
+
+ Assert.assertTrue(bag.contains(valBagSchem1));
+ Assert.assertTrue(bag.contains(valBagSchem2));
+
+ List<String> seq = schem1.getSequenceValueList(seqName);
+ Assert.assertTrue(seq.contains(valSeqSchem1));
+ Assert.assertTrue(seq.contains(valSeqSchem1));
+
+ }
+
+ @Test
+ public void testListAndContainerAccessor() throws Exception {
+ String boolname = "bool";
+ boolean boolVal = true;
+ BooleanType bool = new BooleanType(parent, schem.getLocalPrefix(),
+ boolname, boolVal);
+ Attribute att = new Attribute(null, "rdf", "test", "vgh");
+ schem.setAttribute(att);
+ schem.setBooleanProperty(bool);
+
+ Assert.assertEquals(schem.getAllProperties(), schem.getContent()
+ .getAllProperties());
+ Assert.assertTrue(schem.getAllProperties().contains(bool));
+ Assert.assertTrue(schem.getAllAttributes().contains(att));
+
+ Assert.assertEquals(bool, schem.getPropertyAsSimple(boolname));
+ Assert.assertEquals(bool, schem.getProperty(schem
+ .getLocalPrefixWithSeparator()
+ + boolname));
+
+ }
+}
Propchange: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XMPSchemaTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XmpRightsSchemaTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XmpRightsSchemaTest.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XmpRightsSchemaTest.java (added)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XmpRightsSchemaTest.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,71 @@
+/*****************************************************************************
+ *
+ * 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.padaf.xmpbox.schema;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+import org.apache.padaf.xmpbox.XMPMetadata;
+import org.apache.padaf.xmpbox.schema.XMPRightsManagementSchema;
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+@RunWith(Parameterized.class)
+public class XmpRightsSchemaTest extends AbstractXMPSchemaTest {
+
+ public XmpRightsSchemaTest(String property, String type, Object value) {
+ super(property, type, value);
+ }
+
+ @Before
+ public void initTempMetaData() throws Exception {
+ metadata = new XMPMetadata();
+ schema = metadata.createAndAddXMPRightsManagementSchema();
+ schemaClass = XMPRightsManagementSchema.class;
+ }
+
+ @Parameters
+ public static Collection<Object[]> initializeParameters() throws Exception {
+ List<Object[]> data = new ArrayList<Object[]>();
+ data.add(wrapProperty("Certificate", "URL",
+ "http://une.url.vers.un.certificat/moncert.cer"));
+ data.add(wrapProperty("Marked", "Boolean", true));
+ data.add(wrapProperty("Owner", "bag ProperName",
+ new String[] { "OwnerName" }));
+
+ Map<String, String> desc = new HashMap<String, String>(2);
+ desc.put("fr", "Termes d'utilisation");
+ desc.put("en", "Usage Terms");
+ data.add(wrapProperty("UsageTerms", "Lang Alt", desc));
+ data.add(wrapProperty("WebStatement", "URL",
+ "http://une.url.vers.une.page.fr/"));
+ return data;
+ }
+
+
+}
Propchange: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/schema/XmpRightsSchemaTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AttributeTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AttributeTest.java?rev=1150371&view=auto
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AttributeTest.java (added)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AttributeTest.java Sun Jul 24 13:57:39 2011
@@ -0,0 +1,83 @@
+/*****************************************************************************
+ *
+ * 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.padaf.xmpbox.type;
+
+import junit.framework.Assert;
+
+import org.apache.padaf.xmpbox.type.Attribute;
+import org.junit.Test;
+
+public class AttributeTest {
+
+ @Test
+ public void testAtt() {
+ String nsUri = "nsUri";
+ String prefix = "prefix";
+ String localName = "localName";
+ String value = "value";
+
+ Attribute att = new Attribute(nsUri, prefix, localName, value);
+
+ Assert.assertEquals(nsUri, att.getNamespace());
+ Assert.assertEquals(prefix, att.getPrefix());
+ Assert.assertEquals(localName, att.getLocalName());
+ Assert.assertEquals(prefix + ":" + localName, att.getQualifiedName());
+ Assert.assertEquals(value, att.getValue());
+
+ String nsUri2 = "nsUri2";
+ String prefix2 = "prefix2";
+ String localName2 = "localName2";
+ String value2 = "value2";
+
+ att.setNsURI(nsUri2);
+ att.setPrefix(prefix2);
+ att.setLocalName(localName2);
+ att.setValue(value2);
+
+ Assert.assertEquals(nsUri2, att.getNamespace());
+ Assert.assertEquals(prefix2, att.getPrefix());
+ Assert.assertEquals(localName2, att.getLocalName());
+ Assert.assertEquals(prefix2 + ":" + localName2, att.getQualifiedName());
+ Assert.assertEquals(value2, att.getValue());
+
+ }
+
+ @Test
+ public void testAttWithoutPrefix() {
+ String nsUri = "nsUri";
+ String localName = "localName";
+ String value = "value";
+
+ Attribute att = new Attribute(nsUri, null, localName, value);
+
+ Assert.assertEquals(nsUri, att.getNamespace());
+ Assert.assertNull(att.getPrefix());
+ Assert.assertEquals(localName, att.getLocalName());
+ Assert.assertEquals(localName, att.getQualifiedName());
+
+ att = new Attribute(nsUri, "", localName, value);
+ Assert.assertEquals(nsUri, att.getNamespace());
+ Assert.assertNull(att.getPrefix());
+ Assert.assertEquals(localName, att.getLocalName());
+ Assert.assertEquals(localName, att.getQualifiedName());
+ }
+}
Propchange: pdfbox/trunk/xmpbox/src/test/java/org/apache/padaf/xmpbox/type/AttributeTest.java
------------------------------------------------------------------------------
svn:eol-style = native