You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by gb...@apache.org on 2013/03/06 16:57:52 UTC

svn commit: r1453395 [9/11] - in /pdfbox/trunk/xmpbox: ./ src/main/java/org/apache/xmpbox/ src/main/java/org/apache/xmpbox/schema/ src/main/java/org/apache/xmpbox/type/ src/main/java/org/apache/xmpbox/xml/ src/test/java/org/apache/xmpbox/ src/test/java...

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/AbstractXMPSchemaTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/AbstractXMPSchemaTest.java?rev=1453395&r1=1453394&r2=1453395&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/AbstractXMPSchemaTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/AbstractXMPSchemaTest.java Wed Mar  6 15:57:44 2013
@@ -31,7 +31,6 @@ import java.util.Map;
 import junit.framework.Assert;
 
 import org.apache.xmpbox.XMPMetadata;
-import org.apache.xmpbox.schema.XMPSchema;
 import org.apache.xmpbox.type.AgentNameType;
 import org.apache.xmpbox.type.BooleanType;
 import org.apache.xmpbox.type.Cardinality;
@@ -46,473 +45,566 @@ import org.apache.xmpbox.type.URIType;
 import org.apache.xmpbox.type.URLType;
 import org.junit.Test;
 
-public abstract class AbstractXMPSchemaTest {
+public abstract class AbstractXMPSchemaTest
+{
 
-	protected XMPMetadata metadata;
+    protected XMPMetadata metadata;
 
-	protected String property;
+    protected String property;
 
-	protected PropertyType type;
+    protected PropertyType type;
 
-	protected XMPSchema schema;
-
-	protected Class<?> schemaClass;
-
-	protected Object value;
-
-	public AbstractXMPSchemaTest(String property, PropertyType type, Object value) {
-		this.property = property;
-		this.value = value;
-		this.type = type;
-	}
-
-	public static Object[] wrapProperty(String name, Types type, Object value) {
-		return wrapProperty(name, type, Cardinality.Simple, value);
-	}
-	
-	public static Object[] wrapProperty(String name, Types type, Cardinality card, Object value) {
-//		if (type==Types.Boolean) {
-//			Assert.assertTrue(value instanceof Boolean);
-//		} else if (type==Types.Text) {
-//			Assert.assertTrue(value instanceof String);
-//		} else if (type==Types.Integer) {
-//			Assert.assertTrue(value instanceof Integer);
-//		} else if (type==Types.Date) {
-//			Assert.assertTrue(value instanceof Calendar);
-//		} else if (type==Types.URL) {
-//			Assert.assertTrue(value instanceof String);
-//		}
-		return new Object[] { name, TypeMapping.createPropertyType(type, card), value };
-	}
-
-	@Test
-	public void testGetSetValue() throws Exception {
-		if (type.type()==Types.Text && type.card()==Cardinality.Simple) {
-			testGetSetTextValue();
-		} else if (type.type()==Types.Boolean && type.card()==Cardinality.Simple) {
-			testGetSetBooleanValue();
-		} else if (type.type()==Types.Integer && type.card()==Cardinality.Simple) {
-			testGetSetIntegerValue();
-		} else if (type.type()==Types.Date && type.card()==Cardinality.Simple) {
-			testGetSetDateValue();
-		} else if (type.type()==Types.URI && type.card()==Cardinality.Simple) {
-			testGetSetTextValue();
-		} else if (type.type()==Types.URL && type.card()==Cardinality.Simple) {
-			testGetSetTextValue();
-		} else if (type.type()==Types.AgentName && type.card()==Cardinality.Simple) {
-			testGetSetTextValue();
-		} else if (type.type()==Types.LangAlt && type.card()==Cardinality.Simple) {
-			// do nothing
-		} else if (type.type()==Types.ResourceRef && type.card()==Cardinality.Simple) {
-			// do nothing
-		} else if (type.card()!=Cardinality.Simple) {
-			// do nothing
-		} else {
-			throw new Exception("Unknown type : " + type);
-		}
-	}
-
-	@Test
-	public void testGetSetProperty() throws Exception {
-		if (type.type()==Types.Text && type.card()==Cardinality.Simple) {
-			testGetSetTextProperty();
-		} else if (type.type()==Types.URI && type.card()==Cardinality.Simple) {
-			testGetSetURIProperty();
-		} else if (type.type()==Types.URL && type.card()==Cardinality.Simple) {
-			testGetSetURLProperty();
-		} else if (type.type()==Types.AgentName && type.card()==Cardinality.Simple) {
-			testGetSetAgentNameProperty();
-		} else if (type.type()==Types.Boolean && type.card()==Cardinality.Simple) {
-			testGetSetBooleanProperty();
-		} else if (type.type()==Types.Integer && type.card()==Cardinality.Simple) {
-			testGetSetIntegerProperty();
-		} else if (type.type()==Types.Date && type.card()==Cardinality.Simple) {
-			testGetSetDateProperty();
-		} else if (type.type()==Types.Text && type.card()==Cardinality.Seq) {
-			testGetSetTextListValue("seq");
-		} else if (type.type()==Types.Version && type.card()==Cardinality.Seq) {
-			testGetSetTextListValue("seq");
-		} else if (type.type()==Types.Text && type.card()==Cardinality.Bag) {
-			testGetSetTextListValue("bag");
-		} else if (type.type()==Types.ProperName && type.card()==Cardinality.Bag) {
-			testGetSetTextListValue("bag");
-		} else if (type.type()==Types.XPath && type.card()==Cardinality.Bag) {
-			testGetSetTextListValue("bag");
-		} else if (type.type()==Types.Date && type.card()==Cardinality.Seq) {
-			testGetSetDateListValue("seq");
-		} else if (type.type()==Types.LangAlt && type.card()==Cardinality.Simple) {
-			testGetSetLangAltValue();
-		} else if (type.type()==Types.Thumbnail && type.card()==Cardinality.Alt) {
-			testGetSetThumbnail();
-		} else {
-			throw new Exception("Unknown type : " + type);
-		}
-		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.type()==Types.LangAlt) {
-						// do not check method existence
-					} else if (pt.type()==Types.Thumbnail && pt.card()==Cardinality.Alt) {
-						// do not check method existence
-					} else if (pt.type()==Types.ResourceRef) {
-						// do not check method existence
-					} else if (pt.type()==Types.Version && pt.card()==Cardinality.Seq) {
-						// do not check method existence
-					} else {
-						// type test
-						PropertyType spt = retrievePropertyType(field.get(schema).toString());
-						String getNameProperty = "get" + prepareName(
-								field.get(schema).toString(), spt) + "Property";
-						Method getMethod = schemaClass.getMethod(getNameProperty);
-						Assert.assertNull(getNameProperty
-								+ " should return null when testing "
-								+ property, getMethod.invoke(schema));
-						// value test
-						String getNameValue = "get" + prepareName(
-								field.get(schema).toString(), spt);
-						getMethod = schemaClass.getMethod(getNameValue);
-						Assert.assertNotNull(getNameValue
-								+ " method should exist", getMethod);
-						Assert.assertNull(getNameValue
-								+ " should return null when testing "
-								+ property, getMethod.invoke(schema));
-					}
-				}
-			}
-		}
-	}
-
-	protected PropertyType retrievePropertyType (String prop) throws IllegalArgumentException,IllegalAccessException {
-		Field [] fields = schemaClass.getFields();
-		for (Field field : fields) {
-			if (field.isAnnotationPresent(PropertyType.class)) {
-				PropertyType pt = field.getAnnotation(PropertyType.class);
-				if (field.get(schema).equals(prop)) {
-					return pt;
-				}
-			}
-		}
-		return type;
-	}
-	
-	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 prepareName (String prop, PropertyType type) {
-		String fu = firstUpper(prop);
-		StringBuilder sb = new StringBuilder(fu.length()+1);
-		sb.append(fu);
-		if (fu.endsWith("s")) { 
-			// do nothing
-		} else if (fu.endsWith("y")) {
-			// do nothing
-		} else if (type.card()!=Cardinality.Simple) {
-			sb.append("s");
-		}
-		return sb.toString();
-	}
-	
-	protected String setMethod(String prop) {
-		StringBuilder sb = new StringBuilder(3 + prop.length());
-		sb.append("set").append(prepareName(prop, type)).append("Property");
-		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).append("Property");
-		return sb.toString();
-	}
-
-	protected String setValueMethod(String prop) {
-		String fu = firstUpper(prop);
-		StringBuilder sb = new StringBuilder(8 + prop.length());
-		sb.append("set").append(fu);
-		return sb.toString();
-	}
-
-	protected String getValueMethod(String prop) {
-		StringBuilder sb = new StringBuilder(8 + prop.length());
-		sb.append("get").append(prepareName(prop, type));
-		return sb.toString();
-	}
-
-	protected String addToValueMethod(String prop) {
-		String fu = firstUpper(prop);
-		StringBuilder sb = new StringBuilder(10 + prop.length());
-		sb.append("add").append(fu);
-		return sb.toString();
-
-	}
-
-	protected void testGetSetBooleanProperty() throws Exception {
-		String setName = setMethod(property);
-		String getName = getMethod(property);
-
-		BooleanType bt = new BooleanType(metadata,null, schema.getPrefix(),
-				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, null, schema.getPrefix(), 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, null,schema.getPrefix(),
-				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 = metadata.getTypeMapping().createText(null,schema.getPrefix(), property,
-				(String)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 testGetSetURIProperty() throws Exception {
-		String setName = setMethod(property);
-		String getName = getMethod(property);
-
-		URIType tt = metadata.getTypeMapping().createURI(null,schema.getPrefix(), property,
-				(String)value);
-		Method setMethod = schemaClass.getMethod(setName, URIType.class);
-		Method getMethod = schemaClass.getMethod(getName);
-
-		setMethod.invoke(schema, tt);
-		String found = ((TextType) getMethod.invoke(schema)).getStringValue();
-		Assert.assertEquals(value, found);
-
-	}
-
-	protected void testGetSetURLProperty() throws Exception {
-		String setName = setMethod(property);
-		String getName = getMethod(property);
-
-		URLType tt = metadata.getTypeMapping().createURL(null,schema.getPrefix(), property,
-				(String)value);
-		Method setMethod = schemaClass.getMethod(setName, URLType.class);
-		Method getMethod = schemaClass.getMethod(getName);
-
-		setMethod.invoke(schema, tt);
-		String found = ((TextType) getMethod.invoke(schema)).getStringValue();
-		Assert.assertEquals(value, found);
-
-	}
-
-	protected void testGetSetAgentNameProperty() throws Exception {
-		String setName = setMethod(property);
-		String getName = getMethod(property);
-
-		AgentNameType tt = metadata.getTypeMapping().createAgentName(null,schema.getPrefix(), property,
-				(String)value);
-		Method setMethod = schemaClass.getMethod(setName, AgentNameType.class);
-		Method getMethod = schemaClass.getMethod(getName);
-
-		setMethod.invoke(schema, tt);
-		String found = ((AgentNameType) 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);
-		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.getImage());
-
-	}
-
-	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);
+    protected XMPSchema schema;
+
+    protected Class<?> schemaClass;
+
+    protected Object value;
+
+    public AbstractXMPSchemaTest(String property, PropertyType type, Object value)
+    {
+        this.property = property;
+        this.value = value;
+        this.type = type;
+    }
+
+    public static Object[] wrapProperty(String name, Types type, Object value)
+    {
+        return wrapProperty(name, type, Cardinality.Simple, value);
+    }
+
+    public static Object[] wrapProperty(String name, Types type, Cardinality card, Object value)
+    {
+        // if (type==Types.Boolean) {
+        // Assert.assertTrue(value instanceof Boolean);
+        // } else if (type==Types.Text) {
+        // Assert.assertTrue(value instanceof String);
+        // } else if (type==Types.Integer) {
+        // Assert.assertTrue(value instanceof Integer);
+        // } else if (type==Types.Date) {
+        // Assert.assertTrue(value instanceof Calendar);
+        // } else if (type==Types.URL) {
+        // Assert.assertTrue(value instanceof String);
+        // }
+        return new Object[] { name, TypeMapping.createPropertyType(type, card), value };
+    }
+
+    @Test
+    public void testGetSetValue() throws Exception
+    {
+        if (type.type() == Types.Text && type.card() == Cardinality.Simple)
+        {
+            testGetSetTextValue();
+        }
+        else if (type.type() == Types.Boolean && type.card() == Cardinality.Simple)
+        {
+            testGetSetBooleanValue();
+        }
+        else if (type.type() == Types.Integer && type.card() == Cardinality.Simple)
+        {
+            testGetSetIntegerValue();
+        }
+        else if (type.type() == Types.Date && type.card() == Cardinality.Simple)
+        {
+            testGetSetDateValue();
+        }
+        else if (type.type() == Types.URI && type.card() == Cardinality.Simple)
+        {
+            testGetSetTextValue();
+        }
+        else if (type.type() == Types.URL && type.card() == Cardinality.Simple)
+        {
+            testGetSetTextValue();
+        }
+        else if (type.type() == Types.AgentName && type.card() == Cardinality.Simple)
+        {
+            testGetSetTextValue();
+        }
+        else if (type.type() == Types.LangAlt && type.card() == Cardinality.Simple)
+        {
+            // do nothing
+        }
+        else if (type.type() == Types.ResourceRef && type.card() == Cardinality.Simple)
+        {
+            // do nothing
+        }
+        else if (type.card() != Cardinality.Simple)
+        {
+            // do nothing
+        }
+        else
+        {
+            throw new Exception("Unknown type : " + type);
+        }
+    }
+
+    @Test
+    public void testGetSetProperty() throws Exception
+    {
+        if (type.type() == Types.Text && type.card() == Cardinality.Simple)
+        {
+            testGetSetTextProperty();
+        }
+        else if (type.type() == Types.URI && type.card() == Cardinality.Simple)
+        {
+            testGetSetURIProperty();
+        }
+        else if (type.type() == Types.URL && type.card() == Cardinality.Simple)
+        {
+            testGetSetURLProperty();
+        }
+        else if (type.type() == Types.AgentName && type.card() == Cardinality.Simple)
+        {
+            testGetSetAgentNameProperty();
+        }
+        else if (type.type() == Types.Boolean && type.card() == Cardinality.Simple)
+        {
+            testGetSetBooleanProperty();
+        }
+        else if (type.type() == Types.Integer && type.card() == Cardinality.Simple)
+        {
+            testGetSetIntegerProperty();
+        }
+        else if (type.type() == Types.Date && type.card() == Cardinality.Simple)
+        {
+            testGetSetDateProperty();
+        }
+        else if (type.type() == Types.Text && type.card() == Cardinality.Seq)
+        {
+            testGetSetTextListValue("seq");
+        }
+        else if (type.type() == Types.Version && type.card() == Cardinality.Seq)
+        {
+            testGetSetTextListValue("seq");
+        }
+        else if (type.type() == Types.Text && type.card() == Cardinality.Bag)
+        {
+            testGetSetTextListValue("bag");
+        }
+        else if (type.type() == Types.ProperName && type.card() == Cardinality.Bag)
+        {
+            testGetSetTextListValue("bag");
+        }
+        else if (type.type() == Types.XPath && type.card() == Cardinality.Bag)
+        {
+            testGetSetTextListValue("bag");
+        }
+        else if (type.type() == Types.Date && type.card() == Cardinality.Seq)
+        {
+            testGetSetDateListValue("seq");
+        }
+        else if (type.type() == Types.LangAlt && type.card() == Cardinality.Simple)
+        {
+            testGetSetLangAltValue();
+        }
+        else if (type.type() == Types.Thumbnail && type.card() == Cardinality.Alt)
+        {
+            testGetSetThumbnail();
+        }
+        else
+        {
+            throw new Exception("Unknown type : " + type);
+        }
+        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.type() == Types.LangAlt)
+                    {
+                        // do not check method existence
+                    }
+                    else if (pt.type() == Types.Thumbnail && pt.card() == Cardinality.Alt)
+                    {
+                        // do not check method existence
+                    }
+                    else if (pt.type() == Types.ResourceRef)
+                    {
+                        // do not check method existence
+                    }
+                    else if (pt.type() == Types.Version && pt.card() == Cardinality.Seq)
+                    {
+                        // do not check method existence
+                    }
+                    else
+                    {
+                        // type test
+                        PropertyType spt = retrievePropertyType(field.get(schema).toString());
+                        String getNameProperty = "get" + prepareName(field.get(schema).toString(), spt) + "Property";
+                        Method getMethod = schemaClass.getMethod(getNameProperty);
+                        Assert.assertNull(getNameProperty + " should return null when testing " + property,
+                                getMethod.invoke(schema));
+                        // value test
+                        String getNameValue = "get" + prepareName(field.get(schema).toString(), spt);
+                        getMethod = schemaClass.getMethod(getNameValue);
+                        Assert.assertNotNull(getNameValue + " method should exist", getMethod);
+                        Assert.assertNull(getNameValue + " should return null when testing " + property,
+                                getMethod.invoke(schema));
+                    }
+                }
+            }
+        }
+    }
+
+    protected PropertyType retrievePropertyType(String prop) throws IllegalArgumentException, IllegalAccessException
+    {
+        Field[] fields = schemaClass.getFields();
+        for (Field field : fields)
+        {
+            if (field.isAnnotationPresent(PropertyType.class))
+            {
+                PropertyType pt = field.getAnnotation(PropertyType.class);
+                if (field.get(schema).equals(prop))
+                {
+                    return pt;
+                }
+            }
+        }
+        return type;
+    }
+
+    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 prepareName(String prop, PropertyType type)
+    {
+        String fu = firstUpper(prop);
+        StringBuilder sb = new StringBuilder(fu.length() + 1);
+        sb.append(fu);
+        if (fu.endsWith("s"))
+        {
+            // do nothing
+        }
+        else if (fu.endsWith("y"))
+        {
+            // do nothing
+        }
+        else if (type.card() != Cardinality.Simple)
+        {
+            sb.append("s");
+        }
+        return sb.toString();
+    }
+
+    protected String setMethod(String prop)
+    {
+        StringBuilder sb = new StringBuilder(3 + prop.length());
+        sb.append("set").append(prepareName(prop, type)).append("Property");
+        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).append("Property");
+        return sb.toString();
+    }
+
+    protected String setValueMethod(String prop)
+    {
+        String fu = firstUpper(prop);
+        StringBuilder sb = new StringBuilder(8 + prop.length());
+        sb.append("set").append(fu);
+        return sb.toString();
+    }
+
+    protected String getValueMethod(String prop)
+    {
+        StringBuilder sb = new StringBuilder(8 + prop.length());
+        sb.append("get").append(prepareName(prop, type));
+        return sb.toString();
+    }
+
+    protected String addToValueMethod(String prop)
+    {
+        String fu = firstUpper(prop);
+        StringBuilder sb = new StringBuilder(10 + prop.length());
+        sb.append("add").append(fu);
+        return sb.toString();
+
+    }
+
+    protected void testGetSetBooleanProperty() throws Exception
+    {
+        String setName = setMethod(property);
+        String getName = getMethod(property);
+
+        BooleanType bt = new BooleanType(metadata, null, schema.getPrefix(), 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, null, schema.getPrefix(), 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, null, schema.getPrefix(), 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 = metadata.getTypeMapping().createText(null, schema.getPrefix(), property, (String) 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 testGetSetURIProperty() throws Exception
+    {
+        String setName = setMethod(property);
+        String getName = getMethod(property);
+
+        URIType tt = metadata.getTypeMapping().createURI(null, schema.getPrefix(), property, (String) value);
+        Method setMethod = schemaClass.getMethod(setName, URIType.class);
+        Method getMethod = schemaClass.getMethod(getName);
+
+        setMethod.invoke(schema, tt);
+        String found = ((TextType) getMethod.invoke(schema)).getStringValue();
+        Assert.assertEquals(value, found);
+
+    }
+
+    protected void testGetSetURLProperty() throws Exception
+    {
+        String setName = setMethod(property);
+        String getName = getMethod(property);
+
+        URLType tt = metadata.getTypeMapping().createURL(null, schema.getPrefix(), property, (String) value);
+        Method setMethod = schemaClass.getMethod(setName, URLType.class);
+        Method getMethod = schemaClass.getMethod(getName);
+
+        setMethod.invoke(schema, tt);
+        String found = ((TextType) getMethod.invoke(schema)).getStringValue();
+        Assert.assertEquals(value, found);
+
+    }
+
+    protected void testGetSetAgentNameProperty() throws Exception
+    {
+        String setName = setMethod(property);
+        String getName = getMethod(property);
+
+        AgentNameType tt = metadata.getTypeMapping()
+                .createAgentName(null, schema.getPrefix(), property, (String) value);
+        Method setMethod = schemaClass.getMethod(setName, AgentNameType.class);
+        Method getMethod = schemaClass.getMethod(getName);
+
+        setMethod.invoke(schema, tt);
+        String found = ((AgentNameType) 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);
+        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.getImage());
+
+    }
+
+    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);
+        Method setMethod = schemaClass.getMethod(setName, Integer.class);
+        Method getMethod = schemaClass.getMethod(getName);
 
-		setMethod.invoke(schema, value);
-		Integer found = (Integer) getMethod.invoke(schema);
+        setMethod.invoke(schema, value);
+        Integer found = (Integer) getMethod.invoke(schema);
 
-		Assert.assertEquals(value, found);
-	}
+        Assert.assertEquals(value, found);
+    }
 }

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/AdobePDFErrorsTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/AdobePDFErrorsTest.java?rev=1453395&r1=1453394&r2=1453395&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/AdobePDFErrorsTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/AdobePDFErrorsTest.java Wed Mar  6 15:57:44 2013
@@ -24,73 +24,71 @@ package org.apache.xmpbox.schema;
 import junit.framework.Assert;
 
 import org.apache.xmpbox.XMPMetadata;
-import org.apache.xmpbox.schema.AdobePDFSchema;
-import org.apache.xmpbox.schema.PDFAIdentificationSchema;
 import org.apache.xmpbox.type.BadFieldValueException;
 import org.apache.xmpbox.xml.DomXmpParser;
 import org.junit.Before;
 import org.junit.Test;
 
-public class AdobePDFErrorsTest {
+public class AdobePDFErrorsTest
+{
 
-	protected XMPMetadata metadata;
+    protected XMPMetadata metadata;
 
-	protected DomXmpParser builder;
-	
-	@Before
-	public void initTempMetaData() throws Exception {
-		builder = new DomXmpParser();
-		metadata = XMPMetadata.createXMPMetadata();
-	}
-
-	@Test
-	public void testPDFAIdentification() throws Exception {
-		AdobePDFSchema schem = metadata.createAndAddAdobePDFSchema();
-
-		String keywords = "keywords ihih";
-		String pdfVersion = "1.4";
-		String producer = "producer";
-
-		schem.setKeywords(keywords);
-		schem.setPDFVersion(pdfVersion);
-
-		// Check get null if property not defined
-		Assert.assertNull(schem.getProducer());
-
-		schem.setProducer(producer);
-
-		Assert.assertEquals("Keywords", schem.getKeywordsProperty()
-				.getPropertyName());
-		Assert.assertEquals(keywords, schem.getKeywords());
-
-		Assert.assertEquals("PDFVersion", schem.getPDFVersionProperty()
-				.getPropertyName());
-		Assert.assertEquals(pdfVersion, schem.getPDFVersion());
-
-		Assert.assertEquals("Producer", schem.getProducerProperty()
-				.getPropertyName());
-		Assert.assertEquals(producer, schem.getProducer());
-
-		// 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.setConformance(conformance);
-	}
-
-	@Test(expected = IllegalArgumentException.class)
-	public void testBadVersionIdValueType() throws Exception {
-		PDFAIdentificationSchema pdfaid = metadata
-				.createAndAddPFAIdentificationSchema();
-		pdfaid.setPartValueWithString("1");
-		pdfaid.setPartValueWithString("ojoj");
-	}
+    protected DomXmpParser builder;
+
+    @Before
+    public void initTempMetaData() throws Exception
+    {
+        builder = new DomXmpParser();
+        metadata = XMPMetadata.createXMPMetadata();
+    }
+
+    @Test
+    public void testPDFAIdentification() throws Exception
+    {
+        AdobePDFSchema schem = metadata.createAndAddAdobePDFSchema();
+
+        String keywords = "keywords ihih";
+        String pdfVersion = "1.4";
+        String producer = "producer";
+
+        schem.setKeywords(keywords);
+        schem.setPDFVersion(pdfVersion);
+
+        // Check get null if property not defined
+        Assert.assertNull(schem.getProducer());
+
+        schem.setProducer(producer);
+
+        Assert.assertEquals("Keywords", schem.getKeywordsProperty().getPropertyName());
+        Assert.assertEquals(keywords, schem.getKeywords());
+
+        Assert.assertEquals("PDFVersion", schem.getPDFVersionProperty().getPropertyName());
+        Assert.assertEquals(pdfVersion, schem.getPDFVersion());
+
+        Assert.assertEquals("Producer", schem.getProducerProperty().getPropertyName());
+        Assert.assertEquals(producer, schem.getProducer());
+
+        // 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.setConformance(conformance);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testBadVersionIdValueType() throws Exception
+    {
+        PDFAIdentificationSchema pdfaid = metadata.createAndAddPFAIdentificationSchema();
+        pdfaid.setPartValueWithString("1");
+        pdfaid.setPartValueWithString("ojoj");
+    }
 
 }

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/AdobePDFTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/AdobePDFTest.java?rev=1453395&r1=1453394&r2=1453395&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/AdobePDFTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/AdobePDFTest.java Wed Mar  6 15:57:44 2013
@@ -21,16 +21,12 @@
 
 package org.apache.xmpbox.schema;
 
-import java.lang.annotation.Annotation;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
 import org.apache.xmpbox.XMPMetadata;
-import org.apache.xmpbox.schema.AdobePDFSchema;
-import org.apache.xmpbox.schema.PDFAIdentificationSchema;
 import org.apache.xmpbox.type.BadFieldValueException;
-import org.apache.xmpbox.type.Cardinality;
 import org.apache.xmpbox.type.PropertyType;
 import org.apache.xmpbox.type.Types;
 import org.junit.Assert;
@@ -41,67 +37,70 @@ 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 = XMPMetadata.createXMPMetadata();
-		schema = metadata.createAndAddAdobePDFSchema();
-		schemaClass = AdobePDFSchema.class;
-	}
-
-	@Parameters
-	public static Collection<Object[]> initializeParameters() throws Exception {
-		List<Object[]> data = new ArrayList<Object[]>();
-		data.add(wrapProperty("Keywords", Types.Text, "kw1 kw2 kw3"));
-		data.add(wrapProperty("PDFVersion", Types.Text, "1.4"));
-		data.add(wrapProperty("Producer", Types.Text, "testcase"));
-	
-		return data;
-	}
-
-	public AdobePDFTest(String property, PropertyType type, Object value) {
-		super(property, type, value);
-	}
-
-	@Test
-	public void testPDFAIdentification() throws Exception {
-		AdobePDFSchema schem=metadata.createAndAddAdobePDFSchema();
-
-		String keywords="keywords ihih";
-		String pdfVersion="1.4";
-		String producer="producer";
-
-		schem.setKeywords(keywords);
-		schem.setPDFVersion(pdfVersion);
-
-		//Check get null if property not defined
-		Assert.assertNull(schem.getProducer());
-
-		schem.setProducer(producer);
-
-		Assert.assertEquals("pdf", schem.getKeywordsProperty().getPrefix());
-		Assert.assertEquals("Keywords", schem.getKeywordsProperty().getPropertyName());
-		Assert.assertEquals(keywords, schem.getKeywords());
-
-		Assert.assertEquals("pdf", schem.getPDFVersionProperty().getPrefix());
-		Assert.assertEquals("PDFVersion", schem.getPDFVersionProperty().getPropertyName());
-		Assert.assertEquals(pdfVersion, schem.getPDFVersion());
-
-		Assert.assertEquals("pdf", schem.getProducerProperty().getPrefix());
-		Assert.assertEquals("Producer", schem.getProducerProperty().getPropertyName());
-		Assert.assertEquals(producer, schem.getProducer());
-
-	}
-
-	@Test(expected=BadFieldValueException.class)
-	public void testBadPDFAConformanceId() throws BadFieldValueException{
-		PDFAIdentificationSchema pdfaid=
-				metadata.createAndAddPFAIdentificationSchema();
-		String conformance="kiohiohiohiohio";
-		pdfaid.setConformance(conformance);
-	}
-
+public class AdobePDFTest extends AbstractXMPSchemaTest
+{
 
+    @Before
+    public void initTempMetaData() throws Exception
+    {
+        metadata = XMPMetadata.createXMPMetadata();
+        schema = metadata.createAndAddAdobePDFSchema();
+        schemaClass = AdobePDFSchema.class;
+    }
+
+    @Parameters
+    public static Collection<Object[]> initializeParameters() throws Exception
+    {
+        List<Object[]> data = new ArrayList<Object[]>();
+        data.add(wrapProperty("Keywords", Types.Text, "kw1 kw2 kw3"));
+        data.add(wrapProperty("PDFVersion", Types.Text, "1.4"));
+        data.add(wrapProperty("Producer", Types.Text, "testcase"));
+
+        return data;
+    }
+
+    public AdobePDFTest(String property, PropertyType type, Object value)
+    {
+        super(property, type, value);
+    }
+
+    @Test
+    public void testPDFAIdentification() throws Exception
+    {
+        AdobePDFSchema schem = metadata.createAndAddAdobePDFSchema();
+
+        String keywords = "keywords ihih";
+        String pdfVersion = "1.4";
+        String producer = "producer";
+
+        schem.setKeywords(keywords);
+        schem.setPDFVersion(pdfVersion);
+
+        // Check get null if property not defined
+        Assert.assertNull(schem.getProducer());
+
+        schem.setProducer(producer);
+
+        Assert.assertEquals("pdf", schem.getKeywordsProperty().getPrefix());
+        Assert.assertEquals("Keywords", schem.getKeywordsProperty().getPropertyName());
+        Assert.assertEquals(keywords, schem.getKeywords());
+
+        Assert.assertEquals("pdf", schem.getPDFVersionProperty().getPrefix());
+        Assert.assertEquals("PDFVersion", schem.getPDFVersionProperty().getPropertyName());
+        Assert.assertEquals(pdfVersion, schem.getPDFVersion());
+
+        Assert.assertEquals("pdf", schem.getProducerProperty().getPrefix());
+        Assert.assertEquals("Producer", schem.getProducerProperty().getPropertyName());
+        Assert.assertEquals(producer, schem.getProducer());
+
+    }
+
+    @Test(expected = BadFieldValueException.class)
+    public void testBadPDFAConformanceId() throws BadFieldValueException
+    {
+        PDFAIdentificationSchema pdfaid = metadata.createAndAddPFAIdentificationSchema();
+        String conformance = "kiohiohiohiohio";
+        pdfaid.setConformance(conformance);
+    }
 
 }

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/BasicJobTicketSchemaTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/BasicJobTicketSchemaTest.java?rev=1453395&r1=1453394&r2=1453395&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/BasicJobTicketSchemaTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/BasicJobTicketSchemaTest.java Wed Mar  6 15:57:44 2013
@@ -1,4 +1,4 @@
- /*****************************************************************************
+/*****************************************************************************
  * 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
@@ -28,7 +28,6 @@ import junit.framework.Assert;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.xmpbox.XMPMetadata;
-import org.apache.xmpbox.schema.XMPBasicJobTicketSchema;
 import org.apache.xmpbox.type.JobType;
 import org.apache.xmpbox.type.StructuredType;
 import org.apache.xmpbox.xml.DomXmpParser;
@@ -37,113 +36,121 @@ import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-public class BasicJobTicketSchemaTest {
+public class BasicJobTicketSchemaTest
+{
 
-	protected static DomXmpParser builder;
+    protected static DomXmpParser builder;
 
-	protected XMPMetadata metadata;
-	
-	protected XmpSerializer serializer;
-
-	
-	@BeforeClass
-	public static void bc () throws Exception {
-		builder = new DomXmpParser();
-	}
-	
-	@Before
-	public void initTempMetaData() throws Exception {
-		metadata = XMPMetadata.createXMPMetadata();
-		serializer = new XmpSerializer();
-	}
-
-	private InputStream transfer(ByteArrayOutputStream out) {
-		IOUtils.closeQuietly(out);
-		ByteArrayInputStream bis = new ByteArrayInputStream(out.toByteArray());
-		return bis;
-	}
-	
-	@Test
-	public void testAddTwoJobs() throws Exception {
-		
-		XMPBasicJobTicketSchema basic = metadata.createAndAddBasicJobTicketSchema();
-
-		basic.addJob("zeid1", "zename1", "zeurl1","aaa"); 
-		basic.addJob("zeid2", "zename2", "zeurl2");
-		
-//		serializer.serialize(metadata, System.out, true);
-		
-		ByteArrayOutputStream bos = new ByteArrayOutputStream();
-		serializer.serialize(metadata, bos, true);
-		InputStream is = transfer(bos);
-		XMPMetadata rxmp = builder.parse(is);
-
-		XMPBasicJobTicketSchema jt = rxmp.getBasicJobTicketSchema();
-		Assert.assertNotNull(jt);
-		Assert.assertEquals(2, jt.getJobs().size());
-		
-	}
-
-	@Test
-	public void testAddWithDefaultPrefix() throws Exception {
-		
-		XMPBasicJobTicketSchema basic = metadata.createAndAddBasicJobTicketSchema();
-
-		basic.addJob("zeid2", "zename2", "zeurl2");
-	
-//		serializer.serialize(metadata, System.out, true);
-
-		ByteArrayOutputStream bos = new ByteArrayOutputStream();
-		
-		serializer.serialize(metadata, bos, true);
-		InputStream is = transfer(bos);
-		XMPMetadata rxmp = builder.parse(is);
-
-		XMPBasicJobTicketSchema jt = rxmp.getBasicJobTicketSchema();
-		Assert.assertNotNull(jt);
-		Assert.assertEquals(1, jt.getJobs().size());
-		StructuredType stjob = JobType.class.getAnnotation(StructuredType.class);
-		
-		JobType job = jt.getJobs().get(0);
-		Assert.assertEquals("zeid2", job.getId());
-		Assert.assertEquals("zename2", job.getName());
-		Assert.assertEquals("zeurl2", job.getUrl());
-//		Assert.assertEquals("Invalid namespace",stjob.namespace(), job.getNamespace());
-//		Assert.assertEquals(stjob.preferedPrefix(), job.getPrefix());
-	
-	}
-
-	@Test
-	public void testAddWithDefinedPrefix() throws Exception {
-		
-		XMPBasicJobTicketSchema basic = metadata.createAndAddBasicJobTicketSchema();
-
-		basic.addJob("zeid2", "zename2", "zeurl2","aaa");
-		
-//		SaveMetadataHelper.serialize(metadata, System.out);
-		
-//		serializer.serialize(metadata, System.out, true);
-		
-		ByteArrayOutputStream bos = new ByteArrayOutputStream();
-		serializer.serialize(metadata, bos, true);
-		InputStream is = transfer(bos);
-		XMPMetadata rxmp = builder.parse(is);
-
-		XMPBasicJobTicketSchema jt = rxmp.getBasicJobTicketSchema();
-		Assert.assertNotNull(jt);
-		Assert.assertEquals(1, jt.getJobs().size());
-		
-		JobType job = jt.getJobs().get(0);
-//		SaveMetadataHelper.serialize(rxmp, System.out);
-
-//		StructuredType stjob = JobType.class.getAnnotation(StructuredType.class);
-
-		Assert.assertEquals("zeid2", job.getId());
-		Assert.assertEquals("zename2", job.getName());
-		Assert.assertEquals("zeurl2", job.getUrl());
-//		Assert.assertEquals(stjob.namespace(), job.getNamespace());
-//		Assert.assertEquals("aaa", job.getPrefix());
-	
-	}
+    protected XMPMetadata metadata;
+
+    protected XmpSerializer serializer;
+
+    @BeforeClass
+    public static void bc() throws Exception
+    {
+        builder = new DomXmpParser();
+    }
+
+    @Before
+    public void initTempMetaData() throws Exception
+    {
+        metadata = XMPMetadata.createXMPMetadata();
+        serializer = new XmpSerializer();
+    }
+
+    private InputStream transfer(ByteArrayOutputStream out)
+    {
+        IOUtils.closeQuietly(out);
+        ByteArrayInputStream bis = new ByteArrayInputStream(out.toByteArray());
+        return bis;
+    }
+
+    @Test
+    public void testAddTwoJobs() throws Exception
+    {
+
+        XMPBasicJobTicketSchema basic = metadata.createAndAddBasicJobTicketSchema();
+
+        basic.addJob("zeid1", "zename1", "zeurl1", "aaa");
+        basic.addJob("zeid2", "zename2", "zeurl2");
+
+        // serializer.serialize(metadata, System.out, true);
+
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        serializer.serialize(metadata, bos, true);
+        InputStream is = transfer(bos);
+        XMPMetadata rxmp = builder.parse(is);
+
+        XMPBasicJobTicketSchema jt = rxmp.getBasicJobTicketSchema();
+        Assert.assertNotNull(jt);
+        Assert.assertEquals(2, jt.getJobs().size());
+
+    }
+
+    @Test
+    public void testAddWithDefaultPrefix() throws Exception
+    {
+
+        XMPBasicJobTicketSchema basic = metadata.createAndAddBasicJobTicketSchema();
+
+        basic.addJob("zeid2", "zename2", "zeurl2");
+
+        // serializer.serialize(metadata, System.out, true);
+
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+
+        serializer.serialize(metadata, bos, true);
+        InputStream is = transfer(bos);
+        XMPMetadata rxmp = builder.parse(is);
+
+        XMPBasicJobTicketSchema jt = rxmp.getBasicJobTicketSchema();
+        Assert.assertNotNull(jt);
+        Assert.assertEquals(1, jt.getJobs().size());
+        StructuredType stjob = JobType.class.getAnnotation(StructuredType.class);
+
+        JobType job = jt.getJobs().get(0);
+        Assert.assertEquals("zeid2", job.getId());
+        Assert.assertEquals("zename2", job.getName());
+        Assert.assertEquals("zeurl2", job.getUrl());
+        // Assert.assertEquals("Invalid namespace",stjob.namespace(),
+        // job.getNamespace());
+        // Assert.assertEquals(stjob.preferedPrefix(), job.getPrefix());
+
+    }
+
+    @Test
+    public void testAddWithDefinedPrefix() throws Exception
+    {
+
+        XMPBasicJobTicketSchema basic = metadata.createAndAddBasicJobTicketSchema();
+
+        basic.addJob("zeid2", "zename2", "zeurl2", "aaa");
+
+        // SaveMetadataHelper.serialize(metadata, System.out);
+
+        // serializer.serialize(metadata, System.out, true);
+
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        serializer.serialize(metadata, bos, true);
+        InputStream is = transfer(bos);
+        XMPMetadata rxmp = builder.parse(is);
+
+        XMPBasicJobTicketSchema jt = rxmp.getBasicJobTicketSchema();
+        Assert.assertNotNull(jt);
+        Assert.assertEquals(1, jt.getJobs().size());
+
+        JobType job = jt.getJobs().get(0);
+        // SaveMetadataHelper.serialize(rxmp, System.out);
+
+        // StructuredType stjob =
+        // JobType.class.getAnnotation(StructuredType.class);
+
+        Assert.assertEquals("zeid2", job.getId());
+        Assert.assertEquals("zename2", job.getName());
+        Assert.assertEquals("zeurl2", job.getUrl());
+        // Assert.assertEquals(stjob.namespace(), job.getNamespace());
+        // Assert.assertEquals("aaa", job.getPrefix());
+
+    }
 
 }

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/DublinCoreTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/DublinCoreTest.java?rev=1453395&r1=1453394&r2=1453395&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/DublinCoreTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/DublinCoreTest.java Wed Mar  6 15:57:44 2013
@@ -1,4 +1,4 @@
- /*****************************************************************************
+/*****************************************************************************
  * 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
@@ -23,7 +23,6 @@ package org.apache.xmpbox.schema;
 import java.util.ArrayList;
 import java.util.Collection;
 
-import org.apache.xmpbox.schema.DublinCoreSchema;
 import org.apache.xmpbox.type.Cardinality;
 import org.apache.xmpbox.type.Types;
 import org.junit.Before;
@@ -32,43 +31,47 @@ import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
 
 @RunWith(Parameterized.class)
-public class DublinCoreTest extends AbstractSchemaTester {
+public class DublinCoreTest extends AbstractSchemaTester
+{
 
-	protected DublinCoreSchema schema = null;
-	
-	public DublinCoreSchema getSchema () {
-		return schema;
-	}
-	
-	@Before
-	public void before() throws Exception {
-		super.before();
-		schema = xmp.createAndAddDublinCoreSchema();
-	}
-
-	public DublinCoreTest(String fieldName, Types type, Cardinality card) {
-		super(fieldName, type, card);
-	}
-
-	@Parameters
-	public static Collection<Object[]> initializeParameters() throws Exception {
-    	Collection<Object[]> result = new ArrayList<Object[]>();
-
-    	result.add(new Object [] {"contributor", Types.ProperName,Cardinality.Bag});
-    	result.add(new Object [] {"coverage",Types.Text,Cardinality.Simple});
-    	result.add(new Object [] {"creator",Types.ProperName,Cardinality.Seq});
-    	result.add(new Object [] {"date",Types.Date,Cardinality.Seq});
-    	result.add(new Object [] {"format",Types.MIMEType,Cardinality.Simple});
-    	result.add(new Object [] {"identifier",Types.Text,Cardinality.Simple});
-    	result.add(new Object [] {"language",Types.Locale,Cardinality.Bag});
-    	result.add(new Object [] {"publisher",Types.ProperName,Cardinality.Bag});
-    	result.add(new Object [] {"relation",Types.Text,Cardinality.Bag});
-    	result.add(new Object [] {"source",Types.Text,Cardinality.Simple});
-    	result.add(new Object [] {"subject",Types.Text,Cardinality.Bag});
-    	result.add(new Object [] {"type",Types.Text,Cardinality.Bag});
-   	
-    	return result;
-	}
+    protected DublinCoreSchema schema = null;
 
+    public DublinCoreSchema getSchema()
+    {
+        return schema;
+    }
+
+    @Before
+    public void before() throws Exception
+    {
+        super.before();
+        schema = xmp.createAndAddDublinCoreSchema();
+    }
+
+    public DublinCoreTest(String fieldName, Types type, Cardinality card)
+    {
+        super(fieldName, type, card);
+    }
+
+    @Parameters
+    public static Collection<Object[]> initializeParameters() throws Exception
+    {
+        Collection<Object[]> result = new ArrayList<Object[]>();
+
+        result.add(new Object[] { "contributor", Types.ProperName, Cardinality.Bag });
+        result.add(new Object[] { "coverage", Types.Text, Cardinality.Simple });
+        result.add(new Object[] { "creator", Types.ProperName, Cardinality.Seq });
+        result.add(new Object[] { "date", Types.Date, Cardinality.Seq });
+        result.add(new Object[] { "format", Types.MIMEType, Cardinality.Simple });
+        result.add(new Object[] { "identifier", Types.Text, Cardinality.Simple });
+        result.add(new Object[] { "language", Types.Locale, Cardinality.Bag });
+        result.add(new Object[] { "publisher", Types.ProperName, Cardinality.Bag });
+        result.add(new Object[] { "relation", Types.Text, Cardinality.Bag });
+        result.add(new Object[] { "source", Types.Text, Cardinality.Simple });
+        result.add(new Object[] { "subject", Types.Text, Cardinality.Bag });
+        result.add(new Object[] { "type", Types.Text, Cardinality.Bag });
+
+        return result;
+    }
 
 }

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/PDFAIdentificationOthersTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/PDFAIdentificationOthersTest.java?rev=1453395&r1=1453394&r2=1453395&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/PDFAIdentificationOthersTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/PDFAIdentificationOthersTest.java Wed Mar  6 15:57:44 2013
@@ -24,62 +24,62 @@ package org.apache.xmpbox.schema;
 import junit.framework.Assert;
 
 import org.apache.xmpbox.XMPMetadata;
-import org.apache.xmpbox.schema.PDFAIdentificationSchema;
 import org.apache.xmpbox.type.BadFieldValueException;
 import org.junit.Before;
 import org.junit.Test;
 
-public class PDFAIdentificationOthersTest {
+public class PDFAIdentificationOthersTest
+{
 
-	protected XMPMetadata metadata;
+    protected XMPMetadata metadata;
 
-	@Before
-	public void initTempMetaData() throws Exception {
-		metadata = XMPMetadata.createXMPMetadata();
-	}
-
-	@Test
-	public void testPDFAIdentification() throws Exception {
-		PDFAIdentificationSchema pdfaid = metadata
-				.createAndAddPFAIdentificationSchema();
-
-		Integer versionId = 1;
-		String amdId = "2005";
-		String conformance = "B";
-
-		pdfaid.setPartValueWithInt(versionId);
-		pdfaid.setAmd(amdId);
-		pdfaid.setConformance(conformance);
-
-		Assert.assertEquals(versionId, pdfaid.getPart());
-		Assert.assertEquals(amdId, pdfaid.getAmendment());
-		Assert.assertEquals(conformance, pdfaid.getConformance());
-
-		Assert.assertEquals("" + versionId, pdfaid.getPartProperty().getStringValue());
-		Assert.assertEquals(amdId, pdfaid.getAmdProperty().getStringValue());
-		Assert.assertEquals(conformance, pdfaid.getConformanceProperty()
-				.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.setConformance(conformance);
-	}
-
-	@Test(expected = IllegalArgumentException.class)
-	public void testBadVersionIdValueType() throws Exception {
-		PDFAIdentificationSchema pdfaid = metadata
-				.createAndAddPFAIdentificationSchema();
-		pdfaid.setPartValueWithString("1");
-		pdfaid.setPartValueWithString("ojoj");
-	}
+    @Before
+    public void initTempMetaData() throws Exception
+    {
+        metadata = XMPMetadata.createXMPMetadata();
+    }
+
+    @Test
+    public void testPDFAIdentification() throws Exception
+    {
+        PDFAIdentificationSchema pdfaid = metadata.createAndAddPFAIdentificationSchema();
+
+        Integer versionId = 1;
+        String amdId = "2005";
+        String conformance = "B";
+
+        pdfaid.setPartValueWithInt(versionId);
+        pdfaid.setAmd(amdId);
+        pdfaid.setConformance(conformance);
+
+        Assert.assertEquals(versionId, pdfaid.getPart());
+        Assert.assertEquals(amdId, pdfaid.getAmendment());
+        Assert.assertEquals(conformance, pdfaid.getConformance());
+
+        Assert.assertEquals("" + versionId, pdfaid.getPartProperty().getStringValue());
+        Assert.assertEquals(amdId, pdfaid.getAmdProperty().getStringValue());
+        Assert.assertEquals(conformance, pdfaid.getConformanceProperty().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.setConformance(conformance);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testBadVersionIdValueType() throws Exception
+    {
+        PDFAIdentificationSchema pdfaid = metadata.createAndAddPFAIdentificationSchema();
+        pdfaid.setPartValueWithString("1");
+        pdfaid.setPartValueWithString("ojoj");
+    }
 
 }

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/PDFAIdentificationTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/PDFAIdentificationTest.java?rev=1453395&r1=1453394&r2=1453395&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/PDFAIdentificationTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/PDFAIdentificationTest.java Wed Mar  6 15:57:44 2013
@@ -26,7 +26,6 @@ import java.util.Collection;
 import java.util.List;
 
 import org.apache.xmpbox.XMPMetadata;
-import org.apache.xmpbox.schema.PDFAIdentificationSchema;
 import org.apache.xmpbox.type.PropertyType;
 import org.apache.xmpbox.type.Types;
 import org.junit.Before;
@@ -35,26 +34,30 @@ import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
 
 @RunWith(Parameterized.class)
-public class PDFAIdentificationTest extends AbstractXMPSchemaTest {
+public class PDFAIdentificationTest extends AbstractXMPSchemaTest
+{
 
-	@Before
-	public void initTempMetaData() throws Exception {
-		metadata = XMPMetadata.createXMPMetadata();
-		schema = metadata.createAndAddPFAIdentificationSchema();
-		schemaClass = PDFAIdentificationSchema.class;
-	}
-
-	@Parameters
-	public static Collection<Object[]> initializeParameters() throws Exception {
-		List<Object[]> data = new ArrayList<Object[]>();
-		data.add(wrapProperty("part", Types.Integer, 1));
-		data.add(wrapProperty("amd", Types.Text, "2005"));
-		data.add(wrapProperty("conformance", Types.Text, "B"));
-		return data;
-	}
-
-	public PDFAIdentificationTest(String property, PropertyType type, Object value) {
-		super(property, type, value);
-	}
+    @Before
+    public void initTempMetaData() throws Exception
+    {
+        metadata = XMPMetadata.createXMPMetadata();
+        schema = metadata.createAndAddPFAIdentificationSchema();
+        schemaClass = PDFAIdentificationSchema.class;
+    }
+
+    @Parameters
+    public static Collection<Object[]> initializeParameters() throws Exception
+    {
+        List<Object[]> data = new ArrayList<Object[]>();
+        data.add(wrapProperty("part", Types.Integer, 1));
+        data.add(wrapProperty("amd", Types.Text, "2005"));
+        data.add(wrapProperty("conformance", Types.Text, "B"));
+        return data;
+    }
+
+    public PDFAIdentificationTest(String property, PropertyType type, Object value)
+    {
+        super(property, type, value);
+    }
 
 }

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/PhotoshopSchemaTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/PhotoshopSchemaTest.java?rev=1453395&r1=1453394&r2=1453395&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/PhotoshopSchemaTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/PhotoshopSchemaTest.java Wed Mar  6 15:57:44 2013
@@ -1,4 +1,4 @@
- /*****************************************************************************
+/*****************************************************************************
  * 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
@@ -23,7 +23,6 @@ package org.apache.xmpbox.schema;
 import java.util.ArrayList;
 import java.util.Collection;
 
-import org.apache.xmpbox.schema.PhotoshopSchema;
 import org.apache.xmpbox.type.Cardinality;
 import org.apache.xmpbox.type.Types;
 import org.junit.Before;
@@ -32,49 +31,53 @@ import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
 
 @RunWith(Parameterized.class)
-public class PhotoshopSchemaTest extends AbstractSchemaTester {
+public class PhotoshopSchemaTest extends AbstractSchemaTester
+{
 
-	protected PhotoshopSchema schema = null;
-	
-	public PhotoshopSchema getSchema () {
-		return schema;
-	}
-	
-	@Before
-	public void before() throws Exception {
-		super.before();
-		schema = xmp.createAndAddPhotoshopSchema();
-	}
-
-	public PhotoshopSchemaTest(String fieldName, Types type, Cardinality card) {
-		super(fieldName, type, card);
-	}
-
-	@Parameters
-	public static Collection<Object[]> initializeParameters() throws Exception {
-    	Collection<Object[]> result = new ArrayList<Object[]>();
-
-    	result.add(new Object [] {"AncestorID",Types.URI,Cardinality.Simple});
-    	result.add(new Object [] {"AuthorsPosition",Types.Text,Cardinality.Simple});
-    	result.add(new Object [] {"CaptionWriter",Types.ProperName,Cardinality.Simple});
-    	result.add(new Object [] {"Category",Types.Text,Cardinality.Simple});
-    	result.add(new Object [] {"City",Types.Text,Cardinality.Simple});
-    	result.add(new Object [] {"ColorMode",Types.Integer,Cardinality.Simple});
-    	result.add(new Object [] {"Country",Types.Text,Cardinality.Simple});
-    	result.add(new Object [] {"Credit",Types.Text,Cardinality.Simple});
-    	result.add(new Object [] {"DateCreated",Types.Date,Cardinality.Simple});
-    	result.add(new Object [] {"Headline",Types.Text,Cardinality.Simple});
-    	result.add(new Object [] {"History",Types.Text,Cardinality.Simple});
-    	result.add(new Object [] {"ICCProfile",Types.Text,Cardinality.Simple});
-    	result.add(new Object [] {"Instructions",Types.Text,Cardinality.Simple});
-    	result.add(new Object [] {"Source",Types.Text,Cardinality.Simple});
-    	result.add(new Object [] {"State",Types.Text,Cardinality.Simple});
-    	result.add(new Object [] {"SupplementalCategories",Types.Text,Cardinality.Bag});
-    	result.add(new Object [] {"TransmissionReference",Types.Text,Cardinality.Simple});
-    	result.add(new Object [] {"Urgency",Types.Integer,Cardinality.Simple});
+    protected PhotoshopSchema schema = null;
 
-    	return result;
-	}
+    public PhotoshopSchema getSchema()
+    {
+        return schema;
+    }
+
+    @Before
+    public void before() throws Exception
+    {
+        super.before();
+        schema = xmp.createAndAddPhotoshopSchema();
+    }
+
+    public PhotoshopSchemaTest(String fieldName, Types type, Cardinality card)
+    {
+        super(fieldName, type, card);
+    }
+
+    @Parameters
+    public static Collection<Object[]> initializeParameters() throws Exception
+    {
+        Collection<Object[]> result = new ArrayList<Object[]>();
+
+        result.add(new Object[] { "AncestorID", Types.URI, Cardinality.Simple });
+        result.add(new Object[] { "AuthorsPosition", Types.Text, Cardinality.Simple });
+        result.add(new Object[] { "CaptionWriter", Types.ProperName, Cardinality.Simple });
+        result.add(new Object[] { "Category", Types.Text, Cardinality.Simple });
+        result.add(new Object[] { "City", Types.Text, Cardinality.Simple });
+        result.add(new Object[] { "ColorMode", Types.Integer, Cardinality.Simple });
+        result.add(new Object[] { "Country", Types.Text, Cardinality.Simple });
+        result.add(new Object[] { "Credit", Types.Text, Cardinality.Simple });
+        result.add(new Object[] { "DateCreated", Types.Date, Cardinality.Simple });
+        result.add(new Object[] { "Headline", Types.Text, Cardinality.Simple });
+        result.add(new Object[] { "History", Types.Text, Cardinality.Simple });
+        result.add(new Object[] { "ICCProfile", Types.Text, Cardinality.Simple });
+        result.add(new Object[] { "Instructions", Types.Text, Cardinality.Simple });
+        result.add(new Object[] { "Source", Types.Text, Cardinality.Simple });
+        result.add(new Object[] { "State", Types.Text, Cardinality.Simple });
+        result.add(new Object[] { "SupplementalCategories", Types.Text, Cardinality.Bag });
+        result.add(new Object[] { "TransmissionReference", Types.Text, Cardinality.Simple });
+        result.add(new Object[] { "Urgency", Types.Integer, Cardinality.Simple });
 
+        return result;
+    }
 
 }

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPBasicTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPBasicTest.java?rev=1453395&r1=1453394&r2=1453395&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPBasicTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPBasicTest.java Wed Mar  6 15:57:44 2013
@@ -27,7 +27,6 @@ import java.util.Collection;
 import java.util.List;
 
 import org.apache.xmpbox.XMPMetadata;
-import org.apache.xmpbox.schema.XMPBasicSchema;
 import org.apache.xmpbox.type.Cardinality;
 import org.apache.xmpbox.type.PropertyType;
 import org.apache.xmpbox.type.Types;
@@ -37,40 +36,41 @@ import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
 
 @RunWith(Parameterized.class)
-public class XMPBasicTest extends AbstractXMPSchemaTest {
+public class XMPBasicTest extends AbstractXMPSchemaTest
+{
 
-	public XMPBasicTest(String prop, PropertyType type, Object val) {
-		super(prop, type, val);
-	}
-
-	@Before
-	public void initTempMetaData() throws Exception {
-		metadata = XMPMetadata.createXMPMetadata();
-		schema = metadata.createAndAddXMPBasicSchema();
-		schemaClass = XMPBasicSchema.class;
-	}
-
-	@Parameters
-	public static Collection<Object[]> initializeParameters() throws Exception {
-		List<Object[]> data = new ArrayList<Object[]>();
-
-		data.add(wrapProperty("Advisory", Types.XPath, Cardinality.Bag, new String[] { "xpath1",
-				"xpath2" }));
-		data.add(wrapProperty("BaseURL", Types.URL, "URL"));
-		data.add(wrapProperty("CreateDate", Types.Date, Calendar.getInstance()));
-		data.add(wrapProperty("CreatorTool", Types.AgentName, "CreatorTool"));
-		data.add(wrapProperty("Identifier", Types.Text, Cardinality.Bag, new String[] { "id1",
-				"id2" }));
-		data.add(wrapProperty("Label", Types.Text, "label"));
-		data.add(wrapProperty("MetadataDate", Types.Date, Calendar.getInstance()));
-		data.add(wrapProperty("ModifyDate", Types.Date, Calendar.getInstance()));
-		data.add(wrapProperty("Nickname", Types.Text, "nick name"));
-		data.add(wrapProperty("Rating", Types.Integer, 7));
+    public XMPBasicTest(String prop, PropertyType type, Object val)
+    {
+        super(prop, type, val);
+    }
+
+    @Before
+    public void initTempMetaData() throws Exception
+    {
+        metadata = XMPMetadata.createXMPMetadata();
+        schema = metadata.createAndAddXMPBasicSchema();
+        schemaClass = XMPBasicSchema.class;
+    }
+
+    @Parameters
+    public static Collection<Object[]> initializeParameters() throws Exception
+    {
+        List<Object[]> data = new ArrayList<Object[]>();
+
+        data.add(wrapProperty("Advisory", Types.XPath, Cardinality.Bag, new String[] { "xpath1", "xpath2" }));
+        data.add(wrapProperty("BaseURL", Types.URL, "URL"));
+        data.add(wrapProperty("CreateDate", Types.Date, Calendar.getInstance()));
+        data.add(wrapProperty("CreatorTool", Types.AgentName, "CreatorTool"));
+        data.add(wrapProperty("Identifier", Types.Text, Cardinality.Bag, new String[] { "id1", "id2" }));
+        data.add(wrapProperty("Label", Types.Text, "label"));
+        data.add(wrapProperty("MetadataDate", Types.Date, Calendar.getInstance()));
+        data.add(wrapProperty("ModifyDate", Types.Date, Calendar.getInstance()));
+        data.add(wrapProperty("Nickname", Types.Text, "nick name"));
+        data.add(wrapProperty("Rating", Types.Integer, 7));
 
-		data.add(wrapProperty("Thumbnails", Types.Thumbnail, Cardinality.Alt, null));
-
-		return data;
-	}
+        data.add(wrapProperty("Thumbnails", Types.Thumbnail, Cardinality.Alt, null));
 
+        return data;
+    }
 
 }

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPMediaManagementTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPMediaManagementTest.java?rev=1453395&r1=1453394&r2=1453395&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPMediaManagementTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPMediaManagementTest.java Wed Mar  6 15:57:44 2013
@@ -26,7 +26,6 @@ import java.util.Collection;
 import java.util.List;
 
 import org.apache.xmpbox.XMPMetadata;
-import org.apache.xmpbox.schema.XMPMediaManagementSchema;
 import org.apache.xmpbox.type.Cardinality;
 import org.apache.xmpbox.type.PropertyType;
 import org.apache.xmpbox.type.Types;
@@ -36,40 +35,41 @@ import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
 
 @RunWith(Parameterized.class)
-public class XMPMediaManagementTest extends AbstractXMPSchemaTest {
+public class XMPMediaManagementTest extends AbstractXMPSchemaTest
+{
 
-	@Before
-	public void initTempMetaData() throws Exception {
-		metadata = XMPMetadata.createXMPMetadata();
-		schema = metadata.createAndAddXMPMediaManagementSchema();
-		schemaClass = XMPMediaManagementSchema.class;
-	}
-
-	@Parameters
-	public static Collection<Object[]> initializeParameters() throws Exception {
-		List<Object[]> data = new ArrayList<Object[]>();
-		data.add(wrapProperty("DocumentID", Types.URI,
-				"uuid:FB031973-5E75-11B2-8F06-E7F5C101C07A"));
-		data.add(wrapProperty("Manager", Types.AgentName, "Raoul"));
-		data.add(wrapProperty("ManageTo", Types.URI, "uuid:36"));
-		data.add(wrapProperty("ManageUI", Types.URI, "uuid:3635"));
-//		data.add(wrapProperty("ManageFrom", "ResourceRef", "uuid:36"));
-		data.add(wrapProperty("InstanceID", Types.URI, "uuid:42"));
-		data.add(wrapProperty("OriginalDocumentID", Types.Text, "uuid:142"));
-//		data.add(wrapProperty("RenditionClass", "Text", "myclass"));
-		data.add(wrapProperty("RenditionParams", Types.Text, "my params"));
-		data.add(wrapProperty("VersionID", Types.Text, "14"));
-		data.add(wrapProperty("Versions", Types.Version, Cardinality.Seq, new String[] { "1", "2",
-				"3" }));
-		data.add(wrapProperty("History", Types.Text, Cardinality.Seq,new String[] { "action 1",
-				"action 2", "action 3" }));
-		data.add(wrapProperty("Ingredients", Types.Text,Cardinality.Bag, new String[] {
-				"resource1", "resource2" }));
-		return data;
-	}
-
-	public XMPMediaManagementTest(String property, PropertyType type, Object value) {
-		super(property, type, value);
-	}
+    @Before
+    public void initTempMetaData() throws Exception
+    {
+        metadata = XMPMetadata.createXMPMetadata();
+        schema = metadata.createAndAddXMPMediaManagementSchema();
+        schemaClass = XMPMediaManagementSchema.class;
+    }
+
+    @Parameters
+    public static Collection<Object[]> initializeParameters() throws Exception
+    {
+        List<Object[]> data = new ArrayList<Object[]>();
+        data.add(wrapProperty("DocumentID", Types.URI, "uuid:FB031973-5E75-11B2-8F06-E7F5C101C07A"));
+        data.add(wrapProperty("Manager", Types.AgentName, "Raoul"));
+        data.add(wrapProperty("ManageTo", Types.URI, "uuid:36"));
+        data.add(wrapProperty("ManageUI", Types.URI, "uuid:3635"));
+        // data.add(wrapProperty("ManageFrom", "ResourceRef", "uuid:36"));
+        data.add(wrapProperty("InstanceID", Types.URI, "uuid:42"));
+        data.add(wrapProperty("OriginalDocumentID", Types.Text, "uuid:142"));
+        // data.add(wrapProperty("RenditionClass", "Text", "myclass"));
+        data.add(wrapProperty("RenditionParams", Types.Text, "my params"));
+        data.add(wrapProperty("VersionID", Types.Text, "14"));
+        data.add(wrapProperty("Versions", Types.Version, Cardinality.Seq, new String[] { "1", "2", "3" }));
+        data.add(wrapProperty("History", Types.Text, Cardinality.Seq,
+                new String[] { "action 1", "action 2", "action 3" }));
+        data.add(wrapProperty("Ingredients", Types.Text, Cardinality.Bag, new String[] { "resource1", "resource2" }));
+        return data;
+    }
+
+    public XMPMediaManagementTest(String property, PropertyType type, Object value)
+    {
+        super(property, type, value);
+    }
 
 }