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 [10/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/jav...

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPSchemaTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPSchemaTest.java?rev=1453395&r1=1453394&r2=1453395&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPSchemaTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XMPSchemaTest.java Wed Mar  6 15:57:44 2013
@@ -30,7 +30,6 @@ import junit.framework.Assert;
 import org.apache.xmpbox.DateConverter;
 import org.apache.xmpbox.XMPMetadata;
 import org.apache.xmpbox.XmpConstants;
-import org.apache.xmpbox.schema.XMPSchema;
 import org.apache.xmpbox.type.AbstractField;
 import org.apache.xmpbox.type.ArrayProperty;
 import org.apache.xmpbox.type.Attribute;
@@ -44,412 +43,410 @@ import org.apache.xmpbox.type.TypeMappin
 import org.junit.Before;
 import org.junit.Test;
 
-public class XMPSchemaTest {
+public class XMPSchemaTest
+{
 
-	protected XMPMetadata parent;
-	protected XMPSchema schem;
+    protected XMPMetadata parent;
+    protected XMPSchema schem;
 
-	@Before
-	public void resetDocument() throws Exception {
-		parent = XMPMetadata.createXMPMetadata();
-		schem = new XMPSchema(parent, "nsURI", "nsSchem");
-
-	}
-
-	/**
-	 * Check if Bag (Unordered Array) management is ok
-	 * 
-	 * @throws InappropriateTypeException
-	 */
-	@Test
-	public void testBagManagement() throws Exception {
-		String bagName = "BAGTEST";
-		String value1 = "valueOne";
-		String value2 = "valueTwo";
-		schem.addBagValue(bagName, schem.getMetadata()
-				.getTypeMapping().createText(null, "rdf", "li", value1));
-		schem.addQualifiedBagValue(bagName, value2);
-
-		List<String> values = schem.getUnqualifiedBagValueList(bagName);
-		Assert.assertEquals(value1, values.get(0));
-		Assert.assertEquals(value2, values.get(1));
-
-		schem.removeUnqualifiedBagValue(bagName, value1);
-		List<String> values2 = schem.getUnqualifiedBagValueList(bagName);
-		Assert.assertEquals(1, values2.size());
-		Assert.assertEquals(value2, values2.get(0));
-
-	}
-
-	@Test
-	public void testArrayList() throws Exception {
-		XMPMetadata meta = XMPMetadata.createXMPMetadata();
-		ArrayProperty newSeq = meta.getTypeMapping().createArrayProperty(null, "nsSchem",
-				"seqType", Cardinality.Seq);
-		TypeMapping tm = meta.getTypeMapping();
-		TextType li1 = tm.createText(null, "rdf", "li", "valeur1");
-		TextType li2 =tm.createText(null, "rdf", "li", "valeur2");
-		newSeq.getContainer().addProperty(li1);
-		newSeq.getContainer().addProperty(li2);
-		schem.addProperty(newSeq);
-		List<AbstractField> list = schem.getUnqualifiedArrayList("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 = parent.getTypeMapping().createBoolean( null, "rdf", "li", true);
-		String textVal = "seqValue";
-		String seqName = "SEQNAME";
-
-		schem.addUnqualifiedSequenceDateValue(seqName, date);
-		schem.addUnqualifiedSequenceValue(seqName, bool);
-		schem.addUnqualifiedSequenceValue(seqName, textVal);
-
-		List<Calendar> dates = schem.getUnqualifiedSequenceDateValueList(seqName);
-		Assert.assertEquals(1, dates.size());
-		Assert.assertEquals(date, dates.get(0));
-
-		List<String> values = schem.getUnqualifiedSequenceValueList(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));
-
-		schem.removeUnqualifiedSequenceDateValue(seqName, date);
-		Assert.assertEquals(0, schem.getUnqualifiedSequenceDateValueList(seqName).size());
-
-		schem.removeUnqualifiedSequenceValue(seqName, bool);
-		schem.removeUnqualifiedSequenceValue(seqName, textVal);
-
-		Assert.assertEquals(0, schem.getUnqualifiedSequenceValueList(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, "about", ""));
-	}
-
-	@Test
-	public void testSetSpecifiedSimpleTypeProperty() throws Exception {
-		String prop = "testprop";
-		String val = "value";
-		String val2 = "value2";
-		schem.setTextPropertyValueAsSimple(prop, val);
-		Assert.assertEquals(val, schem.getUnqualifiedTextPropertyValue(prop));
-		schem.setTextPropertyValueAsSimple(prop, val2);
-		Assert.assertEquals(val2, schem.getUnqualifiedTextPropertyValue(prop));
-		schem.setTextPropertyValueAsSimple(prop, null);
-		Assert.assertNull(schem.getUnqualifiedTextProperty(prop));
-	}
-
-	@Test
-	public void testSpecifiedSimplePropertyFormer() throws Exception {
-		String prop = "testprop";
-		String val = "value";
-		String val2 = "value2";
-		schem.setTextPropertyValueAsSimple(prop, val);
-		TextType text = schem.getMetadata().getTypeMapping().createText(null, schem.getPrefix(), prop, "value2");
-		schem.setTextProperty(text);
-		Assert.assertEquals(val2, schem.getUnqualifiedTextPropertyValue(prop));
-		Assert.assertEquals(text, schem.getUnqualifiedTextProperty(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.setBooleanPropertyValueAsSimple(bool, boolVal);
-		schem.setDatePropertyValueAsSimple(date, dateVal);
-		schem.setIntegerPropertyValueAsSimple(integ, i);
-		schem.setUnqualifiedLanguagePropertyValue(langprop, lang, langVal);
-		schem.addBagValueAsSimple(bagprop, bagVal);
-		schem.addUnqualifiedSequenceValue(seqprop, seqPropVal);
-		schem.addSequenceDateValueAsSimple(seqdate, dateVal);
-
-		Assert.assertEquals(Boolean.valueOf(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.getUnqualifiedLanguagePropertyValue(langprop, lang));
-		Assert.assertTrue(schem.getUnqualifiedBagValueList(bagprop).contains(
-				bagVal));
-		Assert.assertTrue(schem.getUnqualifiedSequenceValueList(seqprop)
-				.contains(seqPropVal));
-		Assert.assertTrue(schem.getUnqualifiedSequenceDateValueList(seqdate)
-				.contains(dateVal));
-		Assert.assertTrue(schem.getUnqualifiedLanguagePropertyLanguagesValue(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.getUnqualifiedLanguagePropertyValue(
-				langprop, lang));
-		Assert.assertTrue(schem.getUnqualifiedBagValueList(bagprop).contains(
-				bagVal));
-		Assert.assertTrue(schem.getUnqualifiedSequenceValueList(seqprop).contains(
-				seqPropVal));
-		Assert.assertTrue(schem.getUnqualifiedSequenceDateValueList(seqdate)
-				.contains(dateVal));
-		Assert.assertTrue(schem.getUnqualifiedLanguagePropertyLanguagesValue(
-				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.getNamespace());
-
-		// In real cases, rdf ns will be declared before !
-		schem.addNamespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#","rdf");
-
-		String aboutVal = "aboutTest";
-		schem.setAboutAsSimple(aboutVal);
-		Assert.assertEquals(aboutVal, schem.getAboutValue());
-
-		Attribute about = new Attribute(XmpConstants.RDF_NAMESPACE, "about", "YEP");
-		schem.setAbout(about);
-		Assert.assertEquals(about, schem.getAboutAttribute());
-
-		String textProp = "textProp";
-		String textPropVal = "TextPropTest";
-		schem.setTextPropertyValue(textProp, textPropVal);
-		Assert.assertEquals(textPropVal, schem.getUnqualifiedTextPropertyValue(textProp));
-
-		TextType text = parent.getTypeMapping().createText(null, "nsSchem", "textType", "GRINGO");
-		schem.setTextProperty(text);
-		Assert.assertEquals(text, schem.getUnqualifiedTextProperty("textType"));
-
-		Calendar dateVal = Calendar.getInstance();
-		String date = "nsSchem:dateProp";
-		schem.setDatePropertyValue(date, dateVal);
-		Assert.assertEquals(dateVal, schem.getDatePropertyValue(date));
-
-		DateType dateType = parent.getTypeMapping().createDate( null, "nsSchem", "dateType",
-				Calendar.getInstance());
-		schem.setDateProperty(dateType);
-		Assert
-				.assertEquals(dateType, schem
-						.getDateProperty("dateType"));
-
-		String bool = "nsSchem:booleanTestProp";
-		Boolean boolVal = false;
-		schem.setBooleanPropertyValue(bool, boolVal);
-		Assert.assertEquals(boolVal, schem.getBooleanPropertyValue(bool));
-
-		BooleanType boolType = parent.getTypeMapping().createBoolean( null,"nsSchem", "boolType",
-				false);
-		schem.setBooleanProperty(boolType);
-		Assert.assertEquals(boolType, schem
-				.getBooleanProperty("boolType"));
-
-		String intProp = "nsSchem:IntegerTestProp";
-		Integer intPropVal = 5;
-		schem.setIntegerPropertyValue(intProp, intPropVal);
-		Assert.assertEquals(intPropVal, schem.getIntegerPropertyValue(intProp));
-
-		IntegerType intType = parent.getTypeMapping().createInteger( null, "nsSchem", "intType", 5);
-		schem.setIntegerProperty(intType);
-		Assert.assertEquals(intType, schem
-				.getIntegerProperty("intType"));
-
-		// Check bad type verification
-		boolean ok = false;
-		try {
-			schem.getIntegerProperty("boolType");
-		} catch (IllegalArgumentException e) {
-			ok = true;
-		}
-		Assert.assertEquals(true, ok);
-		ok = false;
-		try {
-			schem.getUnqualifiedTextProperty("intType");
-		} catch (IllegalArgumentException e) {
-			ok = true;
-		}
-		Assert.assertEquals(true, ok);
-		ok = false;
-		try {
-			schem.getDateProperty("textType");
-		} catch (IllegalArgumentException e) {
-			ok = true;
-		}
-		Assert.assertEquals(true, ok);
-		ok = false;
-		try {
-			schem.getBooleanProperty("dateType");
-		} catch (IllegalArgumentException e) {
-			ok = true;
-		}
-
-	}
-
-	@Test
-	public void testAltProperties() throws Exception {
-		String altProp = "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.setUnqualifiedLanguagePropertyValue(altProp, usLang, usVal);
-		schem.setUnqualifiedLanguagePropertyValue(altProp, defaultLang, defaultVal);
-		schem.setUnqualifiedLanguagePropertyValue(altProp, frLang, frVal);
-
-		Assert.assertEquals(defaultVal, schem.getUnqualifiedLanguagePropertyValue(altProp,
-				defaultLang));
-		Assert.assertEquals(frVal, schem.getUnqualifiedLanguagePropertyValue(altProp,
-				frLang));
-		Assert.assertEquals(usVal, schem.getUnqualifiedLanguagePropertyValue(altProp,
-				usLang));
-
-		List<String> languages = schem
-				.getUnqualifiedLanguagePropertyLanguagesValue(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.setUnqualifiedLanguagePropertyValue(altProp, frLang, frVal);
-		Assert.assertEquals(frVal, schem.getUnqualifiedLanguagePropertyValue(altProp,
-				frLang));
-
-		schem.setUnqualifiedLanguagePropertyValue(altProp, frLang, null);
-		languages = schem.getUnqualifiedLanguagePropertyLanguagesValue(altProp);
-		Assert.assertFalse(languages.contains(frLang));
-		schem.setUnqualifiedLanguagePropertyValue(altProp, frLang, frVal);
-
-	}
-
-	/**
-	 * check if merging is ok
-	 * 
-	 * @throws InappropriateTypeException
-	 * @throws IOException
-	 */
-	@Test
-	public void testMergeSchema() throws Exception {
-		String bagName = "bagName";
-		String seqName = "seqName";
-		String qseqName = "test:"+seqName;
-		String altName = "AltProp";
-		String qaltName = "test:"+altName;
-
-		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,"http://www.test.org/schem/", "test");
-		schem1.addQualifiedBagValue(bagName, valBagSchem1);
-		schem1.addUnqualifiedSequenceValue(seqName, valSeqSchem1);
-		schem1.setUnqualifiedLanguagePropertyValue(altName, langAltSchem1, valAltSchem1);
-
-		XMPSchema schem2 = new XMPSchema(parent, "http://www.test.org/schem/", "test");
-		schem2.addQualifiedBagValue(bagName, valBagSchem2);
-		schem2.addUnqualifiedSequenceValue(seqName, valSeqSchem2);
-		schem2.setUnqualifiedLanguagePropertyValue(altName, langAltSchem2, valAltSchem2);
-
-		schem1.merge(schem2);
-
-		// Check if all values are present
-		Assert.assertEquals(valAltSchem2, schem1.getUnqualifiedLanguagePropertyValue(
-				altName, langAltSchem2));
-		Assert.assertEquals(valAltSchem1, schem1.getUnqualifiedLanguagePropertyValue(
-				altName, langAltSchem1));
-
-		List<String> bag = schem1.getUnqualifiedBagValueList(bagName);
-
-		Assert.assertTrue(bag.contains(valBagSchem1));
-		Assert.assertTrue(bag.contains(valBagSchem2));
-
-		List<String> seq = schem1.getUnqualifiedSequenceValueList(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 = parent.getTypeMapping().createBoolean( null, schem.getPrefix(),
-				boolname, boolVal);
-		Attribute att = new Attribute(XmpConstants.RDF_NAMESPACE, "test", "vgh");
-		schem.setAttribute(att);
-		schem.setBooleanProperty(bool);
-
-		Assert.assertEquals(schem.getAllProperties(), schem.getAllProperties());
-		Assert.assertTrue(schem.getAllProperties().contains(bool));
-		Assert.assertTrue(schem.getAllAttributes().contains(att));
+    @Before
+    public void resetDocument() throws Exception
+    {
+        parent = XMPMetadata.createXMPMetadata();
+        schem = new XMPSchema(parent, "nsURI", "nsSchem");
+
+    }
+
+    /**
+     * Check if Bag (Unordered Array) management is ok
+     * 
+     * @throws InappropriateTypeException
+     */
+    @Test
+    public void testBagManagement() throws Exception
+    {
+        String bagName = "BAGTEST";
+        String value1 = "valueOne";
+        String value2 = "valueTwo";
+        schem.addBagValue(bagName, schem.getMetadata().getTypeMapping().createText(null, "rdf", "li", value1));
+        schem.addQualifiedBagValue(bagName, value2);
+
+        List<String> values = schem.getUnqualifiedBagValueList(bagName);
+        Assert.assertEquals(value1, values.get(0));
+        Assert.assertEquals(value2, values.get(1));
+
+        schem.removeUnqualifiedBagValue(bagName, value1);
+        List<String> values2 = schem.getUnqualifiedBagValueList(bagName);
+        Assert.assertEquals(1, values2.size());
+        Assert.assertEquals(value2, values2.get(0));
+
+    }
+
+    @Test
+    public void testArrayList() throws Exception
+    {
+        XMPMetadata meta = XMPMetadata.createXMPMetadata();
+        ArrayProperty newSeq = meta.getTypeMapping().createArrayProperty(null, "nsSchem", "seqType", Cardinality.Seq);
+        TypeMapping tm = meta.getTypeMapping();
+        TextType li1 = tm.createText(null, "rdf", "li", "valeur1");
+        TextType li2 = tm.createText(null, "rdf", "li", "valeur2");
+        newSeq.getContainer().addProperty(li1);
+        newSeq.getContainer().addProperty(li2);
+        schem.addProperty(newSeq);
+        List<AbstractField> list = schem.getUnqualifiedArrayList("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 = parent.getTypeMapping().createBoolean(null, "rdf", "li", true);
+        String textVal = "seqValue";
+        String seqName = "SEQNAME";
+
+        schem.addUnqualifiedSequenceDateValue(seqName, date);
+        schem.addUnqualifiedSequenceValue(seqName, bool);
+        schem.addUnqualifiedSequenceValue(seqName, textVal);
+
+        List<Calendar> dates = schem.getUnqualifiedSequenceDateValueList(seqName);
+        Assert.assertEquals(1, dates.size());
+        Assert.assertEquals(date, dates.get(0));
+
+        List<String> values = schem.getUnqualifiedSequenceValueList(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));
+
+        schem.removeUnqualifiedSequenceDateValue(seqName, date);
+        Assert.assertEquals(0, schem.getUnqualifiedSequenceDateValueList(seqName).size());
+
+        schem.removeUnqualifiedSequenceValue(seqName, bool);
+        schem.removeUnqualifiedSequenceValue(seqName, textVal);
+
+        Assert.assertEquals(0, schem.getUnqualifiedSequenceValueList(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, "about", ""));
+    }
+
+    @Test
+    public void testSetSpecifiedSimpleTypeProperty() throws Exception
+    {
+        String prop = "testprop";
+        String val = "value";
+        String val2 = "value2";
+        schem.setTextPropertyValueAsSimple(prop, val);
+        Assert.assertEquals(val, schem.getUnqualifiedTextPropertyValue(prop));
+        schem.setTextPropertyValueAsSimple(prop, val2);
+        Assert.assertEquals(val2, schem.getUnqualifiedTextPropertyValue(prop));
+        schem.setTextPropertyValueAsSimple(prop, null);
+        Assert.assertNull(schem.getUnqualifiedTextProperty(prop));
+    }
+
+    @Test
+    public void testSpecifiedSimplePropertyFormer() throws Exception
+    {
+        String prop = "testprop";
+        String val = "value";
+        String val2 = "value2";
+        schem.setTextPropertyValueAsSimple(prop, val);
+        TextType text = schem.getMetadata().getTypeMapping().createText(null, schem.getPrefix(), prop, "value2");
+        schem.setTextProperty(text);
+        Assert.assertEquals(val2, schem.getUnqualifiedTextPropertyValue(prop));
+        Assert.assertEquals(text, schem.getUnqualifiedTextProperty(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.setBooleanPropertyValueAsSimple(bool, boolVal);
+        schem.setDatePropertyValueAsSimple(date, dateVal);
+        schem.setIntegerPropertyValueAsSimple(integ, i);
+        schem.setUnqualifiedLanguagePropertyValue(langprop, lang, langVal);
+        schem.addBagValueAsSimple(bagprop, bagVal);
+        schem.addUnqualifiedSequenceValue(seqprop, seqPropVal);
+        schem.addSequenceDateValueAsSimple(seqdate, dateVal);
+
+        Assert.assertEquals(Boolean.valueOf(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.getUnqualifiedLanguagePropertyValue(langprop, lang));
+        Assert.assertTrue(schem.getUnqualifiedBagValueList(bagprop).contains(bagVal));
+        Assert.assertTrue(schem.getUnqualifiedSequenceValueList(seqprop).contains(seqPropVal));
+        Assert.assertTrue(schem.getUnqualifiedSequenceDateValueList(seqdate).contains(dateVal));
+        Assert.assertTrue(schem.getUnqualifiedLanguagePropertyLanguagesValue(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.getUnqualifiedLanguagePropertyValue(langprop, lang));
+        Assert.assertTrue(schem.getUnqualifiedBagValueList(bagprop).contains(bagVal));
+        Assert.assertTrue(schem.getUnqualifiedSequenceValueList(seqprop).contains(seqPropVal));
+        Assert.assertTrue(schem.getUnqualifiedSequenceDateValueList(seqdate).contains(dateVal));
+        Assert.assertTrue(schem.getUnqualifiedLanguagePropertyLanguagesValue(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.getNamespace());
+
+        // In real cases, rdf ns will be declared before !
+        schem.addNamespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdf");
+
+        String aboutVal = "aboutTest";
+        schem.setAboutAsSimple(aboutVal);
+        Assert.assertEquals(aboutVal, schem.getAboutValue());
+
+        Attribute about = new Attribute(XmpConstants.RDF_NAMESPACE, "about", "YEP");
+        schem.setAbout(about);
+        Assert.assertEquals(about, schem.getAboutAttribute());
+
+        String textProp = "textProp";
+        String textPropVal = "TextPropTest";
+        schem.setTextPropertyValue(textProp, textPropVal);
+        Assert.assertEquals(textPropVal, schem.getUnqualifiedTextPropertyValue(textProp));
+
+        TextType text = parent.getTypeMapping().createText(null, "nsSchem", "textType", "GRINGO");
+        schem.setTextProperty(text);
+        Assert.assertEquals(text, schem.getUnqualifiedTextProperty("textType"));
+
+        Calendar dateVal = Calendar.getInstance();
+        String date = "nsSchem:dateProp";
+        schem.setDatePropertyValue(date, dateVal);
+        Assert.assertEquals(dateVal, schem.getDatePropertyValue(date));
+
+        DateType dateType = parent.getTypeMapping().createDate(null, "nsSchem", "dateType", Calendar.getInstance());
+        schem.setDateProperty(dateType);
+        Assert.assertEquals(dateType, schem.getDateProperty("dateType"));
+
+        String bool = "nsSchem:booleanTestProp";
+        Boolean boolVal = false;
+        schem.setBooleanPropertyValue(bool, boolVal);
+        Assert.assertEquals(boolVal, schem.getBooleanPropertyValue(bool));
+
+        BooleanType boolType = parent.getTypeMapping().createBoolean(null, "nsSchem", "boolType", false);
+        schem.setBooleanProperty(boolType);
+        Assert.assertEquals(boolType, schem.getBooleanProperty("boolType"));
+
+        String intProp = "nsSchem:IntegerTestProp";
+        Integer intPropVal = 5;
+        schem.setIntegerPropertyValue(intProp, intPropVal);
+        Assert.assertEquals(intPropVal, schem.getIntegerPropertyValue(intProp));
+
+        IntegerType intType = parent.getTypeMapping().createInteger(null, "nsSchem", "intType", 5);
+        schem.setIntegerProperty(intType);
+        Assert.assertEquals(intType, schem.getIntegerProperty("intType"));
+
+        // Check bad type verification
+        boolean ok = false;
+        try
+        {
+            schem.getIntegerProperty("boolType");
+        }
+        catch (IllegalArgumentException e)
+        {
+            ok = true;
+        }
+        Assert.assertEquals(true, ok);
+        ok = false;
+        try
+        {
+            schem.getUnqualifiedTextProperty("intType");
+        }
+        catch (IllegalArgumentException e)
+        {
+            ok = true;
+        }
+        Assert.assertEquals(true, ok);
+        ok = false;
+        try
+        {
+            schem.getDateProperty("textType");
+        }
+        catch (IllegalArgumentException e)
+        {
+            ok = true;
+        }
+        Assert.assertEquals(true, ok);
+        ok = false;
+        try
+        {
+            schem.getBooleanProperty("dateType");
+        }
+        catch (IllegalArgumentException e)
+        {
+            ok = true;
+        }
+
+    }
+
+    @Test
+    public void testAltProperties() throws Exception
+    {
+        String altProp = "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.setUnqualifiedLanguagePropertyValue(altProp, usLang, usVal);
+        schem.setUnqualifiedLanguagePropertyValue(altProp, defaultLang, defaultVal);
+        schem.setUnqualifiedLanguagePropertyValue(altProp, frLang, frVal);
+
+        Assert.assertEquals(defaultVal, schem.getUnqualifiedLanguagePropertyValue(altProp, defaultLang));
+        Assert.assertEquals(frVal, schem.getUnqualifiedLanguagePropertyValue(altProp, frLang));
+        Assert.assertEquals(usVal, schem.getUnqualifiedLanguagePropertyValue(altProp, usLang));
+
+        List<String> languages = schem.getUnqualifiedLanguagePropertyLanguagesValue(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.setUnqualifiedLanguagePropertyValue(altProp, frLang, frVal);
+        Assert.assertEquals(frVal, schem.getUnqualifiedLanguagePropertyValue(altProp, frLang));
+
+        schem.setUnqualifiedLanguagePropertyValue(altProp, frLang, null);
+        languages = schem.getUnqualifiedLanguagePropertyLanguagesValue(altProp);
+        Assert.assertFalse(languages.contains(frLang));
+        schem.setUnqualifiedLanguagePropertyValue(altProp, frLang, frVal);
+
+    }
+
+    /**
+     * check if merging is ok
+     * 
+     * @throws InappropriateTypeException
+     * @throws IOException
+     */
+    @Test
+    public void testMergeSchema() throws Exception
+    {
+        String bagName = "bagName";
+        String seqName = "seqName";
+        String qseqName = "test:" + seqName;
+        String altName = "AltProp";
+        String qaltName = "test:" + altName;
+
+        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, "http://www.test.org/schem/", "test");
+        schem1.addQualifiedBagValue(bagName, valBagSchem1);
+        schem1.addUnqualifiedSequenceValue(seqName, valSeqSchem1);
+        schem1.setUnqualifiedLanguagePropertyValue(altName, langAltSchem1, valAltSchem1);
+
+        XMPSchema schem2 = new XMPSchema(parent, "http://www.test.org/schem/", "test");
+        schem2.addQualifiedBagValue(bagName, valBagSchem2);
+        schem2.addUnqualifiedSequenceValue(seqName, valSeqSchem2);
+        schem2.setUnqualifiedLanguagePropertyValue(altName, langAltSchem2, valAltSchem2);
+
+        schem1.merge(schem2);
+
+        // Check if all values are present
+        Assert.assertEquals(valAltSchem2, schem1.getUnqualifiedLanguagePropertyValue(altName, langAltSchem2));
+        Assert.assertEquals(valAltSchem1, schem1.getUnqualifiedLanguagePropertyValue(altName, langAltSchem1));
+
+        List<String> bag = schem1.getUnqualifiedBagValueList(bagName);
+
+        Assert.assertTrue(bag.contains(valBagSchem1));
+        Assert.assertTrue(bag.contains(valBagSchem2));
+
+        List<String> seq = schem1.getUnqualifiedSequenceValueList(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 = parent.getTypeMapping().createBoolean(null, schem.getPrefix(), boolname, boolVal);
+        Attribute att = new Attribute(XmpConstants.RDF_NAMESPACE, "test", "vgh");
+        schem.setAttribute(att);
+        schem.setBooleanProperty(bool);
+
+        Assert.assertEquals(schem.getAllProperties(), schem.getAllProperties());
+        Assert.assertTrue(schem.getAllProperties().contains(bool));
+        Assert.assertTrue(schem.getAllAttributes().contains(att));
 
-		Assert.assertEquals(bool, schem.getProperty(boolname));
+        Assert.assertEquals(bool, schem.getProperty(boolname));
 
-	}
+    }
 }

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XmpRightsSchemaTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XmpRightsSchemaTest.java?rev=1453395&r1=1453394&r2=1453395&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XmpRightsSchemaTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/schema/XmpRightsSchemaTest.java Wed Mar  6 15:57:44 2013
@@ -28,7 +28,6 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.xmpbox.XMPMetadata;
-import org.apache.xmpbox.schema.XMPRightsManagementSchema;
 import org.apache.xmpbox.type.Cardinality;
 import org.apache.xmpbox.type.PropertyType;
 import org.apache.xmpbox.type.Types;
@@ -38,36 +37,36 @@ import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
 
 @RunWith(Parameterized.class)
-public class XmpRightsSchemaTest extends AbstractXMPSchemaTest {
-
-	public XmpRightsSchemaTest(String property, PropertyType type, Object value) {
-		super(property, type, value);
-	}
-
-	@Before
-	public void initTempMetaData() throws Exception {
-		metadata = XMPMetadata.createXMPMetadata();
-		schema = metadata.createAndAddXMPRightsManagementSchema();
-		schemaClass = XMPRightsManagementSchema.class;
-	}
-
-	@Parameters
-	public static Collection<Object[]> initializeParameters() throws Exception {
-		List<Object[]> data = new ArrayList<Object[]>();
-		data.add(wrapProperty("Certificate", Types.URL,
-				"http://une.url.vers.un.certificat/moncert.cer"));
-		data.add(wrapProperty("Marked", Types.Boolean, true));
-		data.add(wrapProperty("Owner", Types.ProperName, Cardinality.Bag,
-				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", Types.LangAlt, desc));
-		data.add(wrapProperty("WebStatement", Types.URL,
-				"http://une.url.vers.une.page.fr/"));
-		return data;
-	}
+public class XmpRightsSchemaTest extends AbstractXMPSchemaTest
+{
 
+    public XmpRightsSchemaTest(String property, PropertyType type, Object value)
+    {
+        super(property, type, value);
+    }
+
+    @Before
+    public void initTempMetaData() throws Exception
+    {
+        metadata = XMPMetadata.createXMPMetadata();
+        schema = metadata.createAndAddXMPRightsManagementSchema();
+        schemaClass = XMPRightsManagementSchema.class;
+    }
+
+    @Parameters
+    public static Collection<Object[]> initializeParameters() throws Exception
+    {
+        List<Object[]> data = new ArrayList<Object[]>();
+        data.add(wrapProperty("Certificate", Types.URL, "http://une.url.vers.un.certificat/moncert.cer"));
+        data.add(wrapProperty("Marked", Types.Boolean, true));
+        data.add(wrapProperty("Owner", Types.ProperName, Cardinality.Bag, 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", Types.LangAlt, desc));
+        data.add(wrapProperty("WebStatement", Types.URL, "http://une.url.vers.une.page.fr/"));
+        return data;
+    }
 
 }

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/AbstractStructuredTypeTester.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/AbstractStructuredTypeTester.java?rev=1453395&r1=1453394&r2=1453395&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/AbstractStructuredTypeTester.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/AbstractStructuredTypeTester.java Wed Mar  6 15:57:44 2013
@@ -28,97 +28,98 @@ import java.util.List;
 import junit.framework.Assert;
 
 import org.apache.xmpbox.XMPMetadata;
-import org.apache.xmpbox.type.AbstractSimpleProperty;
-import org.apache.xmpbox.type.AbstractStructuredType;
-import org.apache.xmpbox.type.TypeMapping;
-import org.apache.xmpbox.type.Types;
 import org.apache.xmpbox.xml.DomXmpParser;
 import org.junit.Test;
 
-public abstract class AbstractStructuredTypeTester {
+public abstract class AbstractStructuredTypeTester
+{
 
-	protected XMPMetadata xmp;
-	
-	protected String fieldName;
-	
-	protected Types type;
-	
-	protected Class<? extends AbstractStructuredType> clz;
-	
-	protected TypeMapping typeMapping = null;
-	
-	protected DomXmpParser builder;
-	
-	public void before () throws Exception {
-		builder = new DomXmpParser();
-		xmp = XMPMetadata.createXMPMetadata();
-		typeMapping = xmp.getTypeMapping();
-	}
-	
-	public AbstractStructuredTypeTester (Class<? extends AbstractStructuredType> clz, String fieldName, Types type) {
-		this.clz = clz;
-		this.fieldName = fieldName;
-		this.type = type;
-	}
-	
-	protected abstract AbstractStructuredType getStructured ();
-	
-	@Test
-	public void testInitializedToNull() throws Exception {
-		// default method
-		Assert.assertNull(getStructured().getProperty(fieldName));
-		// accessor
-    	Method get = clz.getMethod(TypeTestingHelper.calculateSimpleGetter(fieldName), new Class[0]);
-    	Object result = get.invoke(getStructured(), new Object [0]);
-    	Assert.assertNull(result);
-		
-	}
-	
-	@Test
-	public void testSettingValue() throws Exception {
-		Object value = TypeTestingHelper.getJavaValue(type);
-		getStructured().addSimpleProperty(fieldName, value);
-		Assert.assertNotNull(getStructured().getProperty(fieldName));
-		// check other properties not modified
-		List<Field> fields = TypeTestingHelper.getXmpFields(clz);
-		for (Field field : fields) {
-			// do not check the current name
-			String name = field.get(null).toString();
-			if (!name.equals(fieldName)) {
-				Assert.assertNull(getStructured().getProperty(name));
-			}
-		}
-	}
-
-	@Test
-	public void testPropertyType() throws Exception {
-		Object value = TypeTestingHelper.getJavaValue(type);
-		getStructured().addSimpleProperty(fieldName, value);
-		Assert.assertNotNull(getStructured().getProperty(fieldName));
-		// check property type
-		AbstractSimpleProperty asp = (AbstractSimpleProperty) getStructured().getProperty(fieldName);
-		Assert.assertEquals(type.getImplementingClass(),asp.getClass());
-	}
+    protected XMPMetadata xmp;
+
+    protected String fieldName;
+
+    protected Types type;
+
+    protected Class<? extends AbstractStructuredType> clz;
+
+    protected TypeMapping typeMapping = null;
+
+    protected DomXmpParser builder;
+
+    public void before() throws Exception
+    {
+        builder = new DomXmpParser();
+        xmp = XMPMetadata.createXMPMetadata();
+        typeMapping = xmp.getTypeMapping();
+    }
+
+    public AbstractStructuredTypeTester(Class<? extends AbstractStructuredType> clz, String fieldName, Types type)
+    {
+        this.clz = clz;
+        this.fieldName = fieldName;
+        this.type = type;
+    }
+
+    protected abstract AbstractStructuredType getStructured();
+
+    @Test
+    public void testInitializedToNull() throws Exception
+    {
+        // default method
+        Assert.assertNull(getStructured().getProperty(fieldName));
+        // accessor
+        Method get = clz.getMethod(TypeTestingHelper.calculateSimpleGetter(fieldName), new Class[0]);
+        Object result = get.invoke(getStructured(), new Object[0]);
+        Assert.assertNull(result);
+
+    }
+
+    @Test
+    public void testSettingValue() throws Exception
+    {
+        Object value = TypeTestingHelper.getJavaValue(type);
+        getStructured().addSimpleProperty(fieldName, value);
+        Assert.assertNotNull(getStructured().getProperty(fieldName));
+        // check other properties not modified
+        List<Field> fields = TypeTestingHelper.getXmpFields(clz);
+        for (Field field : fields)
+        {
+            // do not check the current name
+            String name = field.get(null).toString();
+            if (!name.equals(fieldName))
+            {
+                Assert.assertNull(getStructured().getProperty(name));
+            }
+        }
+    }
 
     @Test
-    public void testSetter () throws Exception {
-    	String setter = TypeTestingHelper.calculateSimpleSetter(fieldName);
-    	Object value = TypeTestingHelper.getJavaValue(type);
-    	Method set = clz.getMethod(setter, new Class<?>[] {TypeTestingHelper.getJavaType(type)} );
-    	set.invoke(getStructured(), new Object [] {value});
-    	// check property set
-    	Assert.assertEquals(value, ((AbstractSimpleProperty)getStructured().getProperty(fieldName)).getValue());
-    	// check getter
-    	Method get = clz.getMethod(TypeTestingHelper.calculateSimpleGetter(fieldName), new Class[0]);
-    	Object result = get.invoke(getStructured(), new Object [0]);
-//    	Assert.assertEquals(getJavaType(td),result.getClass());
-    	Assert.assertTrue(TypeTestingHelper.getJavaType(type).isAssignableFrom(result.getClass()));
-    	Assert.assertEquals(value, result);
-    	
-    }
-    
-    
-    
+    public void testPropertyType() throws Exception
+    {
+        Object value = TypeTestingHelper.getJavaValue(type);
+        getStructured().addSimpleProperty(fieldName, value);
+        Assert.assertNotNull(getStructured().getProperty(fieldName));
+        // check property type
+        AbstractSimpleProperty asp = (AbstractSimpleProperty) getStructured().getProperty(fieldName);
+        Assert.assertEquals(type.getImplementingClass(), asp.getClass());
+    }
+
+    @Test
+    public void testSetter() throws Exception
+    {
+        String setter = TypeTestingHelper.calculateSimpleSetter(fieldName);
+        Object value = TypeTestingHelper.getJavaValue(type);
+        Method set = clz.getMethod(setter, new Class<?>[] { TypeTestingHelper.getJavaType(type) });
+        set.invoke(getStructured(), new Object[] { value });
+        // check property set
+        Assert.assertEquals(value, ((AbstractSimpleProperty) getStructured().getProperty(fieldName)).getValue());
+        // check getter
+        Method get = clz.getMethod(TypeTestingHelper.calculateSimpleGetter(fieldName), new Class[0]);
+        Object result = get.invoke(getStructured(), new Object[0]);
+        // Assert.assertEquals(getJavaType(td),result.getClass());
+        Assert.assertTrue(TypeTestingHelper.getJavaType(type).isAssignableFrom(result.getClass()));
+        Assert.assertEquals(value, result);
+
+    }
 
-	
 }

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/AttributeTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/AttributeTest.java?rev=1453395&r1=1453394&r2=1453395&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/AttributeTest.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/AttributeTest.java Wed Mar  6 15:57:44 2013
@@ -23,52 +23,54 @@ package org.apache.xmpbox.type;
 
 import junit.framework.Assert;
 
-import org.apache.xmpbox.type.Attribute;
 import org.junit.Test;
 
-public class AttributeTest {
+public class AttributeTest
+{
 
-	@Test
-	public void testAtt() {
-		String nsUri = "nsUri";
-		String prefix = "prefix";
-		String localName = "localName";
-		String value = "value";
-
-		Attribute att = new Attribute(nsUri, localName, value);
-
-		Assert.assertEquals(nsUri, att.getNamespace());
-		Assert.assertEquals(localName, att.getName());
-		Assert.assertEquals(value, att.getValue());
-
-		String nsUri2 = "nsUri2";
-		String prefix2 = "prefix2";
-		String localName2 = "localName2";
-		String value2 = "value2";
-
-		att.setNsURI(nsUri2);
-		att.setName(localName2);
-		att.setValue(value2);
-
-		Assert.assertEquals(nsUri2, att.getNamespace());
-		Assert.assertEquals(localName2, att.getName());
-		Assert.assertEquals(value2, att.getValue());
-
-	}
-
-	@Test
-	public void testAttWithoutPrefix() {
-		String nsUri = "nsUri";
-		String localName = "localName";
-		String value = "value";
-
-		Attribute att = new Attribute(nsUri, localName, value);
-
-		Assert.assertEquals(nsUri, att.getNamespace());
-		Assert.assertEquals(localName, att.getName());
-
-		att = new Attribute(nsUri, localName, value);
-		Assert.assertEquals(nsUri, att.getNamespace());
-		Assert.assertEquals(localName, att.getName());
-	}
+    @Test
+    public void testAtt()
+    {
+        String nsUri = "nsUri";
+        String prefix = "prefix";
+        String localName = "localName";
+        String value = "value";
+
+        Attribute att = new Attribute(nsUri, localName, value);
+
+        Assert.assertEquals(nsUri, att.getNamespace());
+        Assert.assertEquals(localName, att.getName());
+        Assert.assertEquals(value, att.getValue());
+
+        String nsUri2 = "nsUri2";
+        String prefix2 = "prefix2";
+        String localName2 = "localName2";
+        String value2 = "value2";
+
+        att.setNsURI(nsUri2);
+        att.setName(localName2);
+        att.setValue(value2);
+
+        Assert.assertEquals(nsUri2, att.getNamespace());
+        Assert.assertEquals(localName2, att.getName());
+        Assert.assertEquals(value2, att.getValue());
+
+    }
+
+    @Test
+    public void testAttWithoutPrefix()
+    {
+        String nsUri = "nsUri";
+        String localName = "localName";
+        String value = "value";
+
+        Attribute att = new Attribute(nsUri, localName, value);
+
+        Assert.assertEquals(nsUri, att.getNamespace());
+        Assert.assertEquals(localName, att.getName());
+
+        att = new Attribute(nsUri, localName, value);
+        Assert.assertEquals(nsUri, att.getNamespace());
+        Assert.assertEquals(localName, att.getName());
+    }
 }

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestAbstractStructuredType.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestAbstractStructuredType.java?rev=1453395&r1=1453394&r2=1453395&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestAbstractStructuredType.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestAbstractStructuredType.java Wed Mar  6 15:57:44 2013
@@ -26,78 +26,79 @@ import java.util.Calendar;
 import junit.framework.Assert;
 
 import org.apache.xmpbox.XMPMetadata;
-import org.apache.xmpbox.type.AbstractStructuredType;
-import org.apache.xmpbox.type.Cardinality;
-import org.apache.xmpbox.type.PropertyType;
-import org.apache.xmpbox.type.Types;
 import org.junit.Before;
 import org.junit.Test;
 
-public class TestAbstractStructuredType {
+public class TestAbstractStructuredType
+{
 
-	private static class MyStructuredType extends AbstractStructuredType {
-		
-		@PropertyType(type = Types.Text, card = Cardinality.Simple)
-		public static final String MYTEXT ="my-text";
-
-		@PropertyType(type = Types.Date, card = Cardinality.Simple)
-		public static final String MYDATE ="my-date";
-
-		public MyStructuredType(XMPMetadata metadata, String namespaceURI,
-				String fieldPrefix) {
-			super(metadata, namespaceURI, fieldPrefix,"structuredPN");
-		}
-
-	}
-
-	
-	protected MyStructuredType st;
-	
-	public static final String MY_NS = "http://www.apache.org/test#";
-	
-	public static final String MY_PREFIX = "test";
-	
-	@Before
-	public void before () throws Exception {
-		XMPMetadata xmp = XMPMetadata.createXMPMetadata();
-		st = new MyStructuredType(xmp, MY_NS, MY_PREFIX);
-	}
-	
-	@Test
-	public void validate () throws Exception {
-		Assert.assertEquals(MY_NS, st.getNamespace());
-		Assert.assertEquals(MY_PREFIX, st.getPrefix());
-		Assert.assertEquals(MY_PREFIX, st.getPrefix());
-	}
-
-	@Test
-	public void testNonExistingProperty () throws Exception {
-		Assert.assertNull(st.getProperty("NOT_EXISTING"));
-	}
-	
-	@Test
-	public void testNotValuatedPropertyProperty () throws Exception {
-		Assert.assertNull(st.getProperty(MyStructuredType.MYTEXT));
-	}
-	
-	@Test
-	public void testValuatedTextProperty () throws Exception {
-		String s = "my value";
-		st.addSimpleProperty(MyStructuredType.MYTEXT, s);
-		Assert.assertEquals(s, st.getPropertyValueAsString(MyStructuredType.MYTEXT));
-		Assert.assertNull(st.getPropertyValueAsString(MyStructuredType.MYDATE));
-		Assert.assertNotNull(st.getProperty(MyStructuredType.MYTEXT));
-	}
-
-	@Test
-	public void testValuatedDateProperty () throws Exception {
-		Calendar c = Calendar.getInstance();
-		st.addSimpleProperty(MyStructuredType.MYDATE, c);
-		Assert.assertEquals(c, st.getDatePropertyAsCalendar(MyStructuredType.MYDATE));
-		Assert.assertNull(st.getDatePropertyAsCalendar(MyStructuredType.MYTEXT));
-		Assert.assertNotNull(st.getProperty(MyStructuredType.MYDATE));
-	}
+    private static class MyStructuredType extends AbstractStructuredType
+    {
 
+        @PropertyType(type = Types.Text, card = Cardinality.Simple)
+        public static final String MYTEXT = "my-text";
+
+        @PropertyType(type = Types.Date, card = Cardinality.Simple)
+        public static final String MYDATE = "my-date";
+
+        public MyStructuredType(XMPMetadata metadata, String namespaceURI, String fieldPrefix)
+        {
+            super(metadata, namespaceURI, fieldPrefix, "structuredPN");
+        }
+
+    }
+
+    protected MyStructuredType st;
+
+    public static final String MY_NS = "http://www.apache.org/test#";
+
+    public static final String MY_PREFIX = "test";
+
+    @Before
+    public void before() throws Exception
+    {
+        XMPMetadata xmp = XMPMetadata.createXMPMetadata();
+        st = new MyStructuredType(xmp, MY_NS, MY_PREFIX);
+    }
+
+    @Test
+    public void validate() throws Exception
+    {
+        Assert.assertEquals(MY_NS, st.getNamespace());
+        Assert.assertEquals(MY_PREFIX, st.getPrefix());
+        Assert.assertEquals(MY_PREFIX, st.getPrefix());
+    }
+
+    @Test
+    public void testNonExistingProperty() throws Exception
+    {
+        Assert.assertNull(st.getProperty("NOT_EXISTING"));
+    }
+
+    @Test
+    public void testNotValuatedPropertyProperty() throws Exception
+    {
+        Assert.assertNull(st.getProperty(MyStructuredType.MYTEXT));
+    }
+
+    @Test
+    public void testValuatedTextProperty() throws Exception
+    {
+        String s = "my value";
+        st.addSimpleProperty(MyStructuredType.MYTEXT, s);
+        Assert.assertEquals(s, st.getPropertyValueAsString(MyStructuredType.MYTEXT));
+        Assert.assertNull(st.getPropertyValueAsString(MyStructuredType.MYDATE));
+        Assert.assertNotNull(st.getProperty(MyStructuredType.MYTEXT));
+    }
+
+    @Test
+    public void testValuatedDateProperty() throws Exception
+    {
+        Calendar c = Calendar.getInstance();
+        st.addSimpleProperty(MyStructuredType.MYDATE, c);
+        Assert.assertEquals(c, st.getDatePropertyAsCalendar(MyStructuredType.MYDATE));
+        Assert.assertNull(st.getDatePropertyAsCalendar(MyStructuredType.MYTEXT));
+        Assert.assertNotNull(st.getProperty(MyStructuredType.MYDATE));
+    }
 
-	
 }

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestDerivedType.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestDerivedType.java?rev=1453395&r1=1453394&r2=1453395&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestDerivedType.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestDerivedType.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
@@ -25,18 +25,6 @@ import java.util.ArrayList;
 import java.util.Collection;
 
 import org.apache.xmpbox.XMPMetadata;
-import org.apache.xmpbox.type.AgentNameType;
-import org.apache.xmpbox.type.ChoiceType;
-import org.apache.xmpbox.type.GUIDType;
-import org.apache.xmpbox.type.LocaleType;
-import org.apache.xmpbox.type.MIMEType;
-import org.apache.xmpbox.type.PartType;
-import org.apache.xmpbox.type.ProperNameType;
-import org.apache.xmpbox.type.RenditionClassType;
-import org.apache.xmpbox.type.TextType;
-import org.apache.xmpbox.type.URIType;
-import org.apache.xmpbox.type.URLType;
-import org.apache.xmpbox.type.XPathType;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -45,84 +33,74 @@ import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
 
 @RunWith(Parameterized.class)
-public class TestDerivedType {
+public class TestDerivedType
+{
+
+    public static final String PREFIX = "myprefix";
+
+    public static final String NAME = "myname";
+
+    public static final String VALUE = "myvalue";
+
+    protected XMPMetadata xmp;
+
+    protected String type = null;
+
+    protected Class<? extends TextType> clz = null;
+
+    protected Constructor<? extends TextType> constructor = null;
+
+    public TestDerivedType(Class<? extends TextType> clz, String type)
+    {
+        super();
+        this.clz = clz;
+        this.type = type;
+    }
+
+    @Parameters
+    public static Collection<Object[]> initializeParameters() throws Exception
+    {
+        Collection<Object[]> result = new ArrayList<Object[]>();
+
+        result.add(new Object[] { AgentNameType.class, "AgentName" });
+        result.add(new Object[] { ChoiceType.class, "Choice" });
+        result.add(new Object[] { GUIDType.class, "GUID" });
+        result.add(new Object[] { LocaleType.class, "Locale" });
+        result.add(new Object[] { MIMEType.class, "MIME" });
+        result.add(new Object[] { PartType.class, "Part" });
+        result.add(new Object[] { ProperNameType.class, "ProperName" });
+        result.add(new Object[] { RenditionClassType.class, "RenditionClass" });
+        result.add(new Object[] { URIType.class, "URI" });
+        result.add(new Object[] { URLType.class, "URL" });
+        result.add(new Object[] { XPathType.class, "XPath" });
+
+        return result;
 
-	public static final String PREFIX = "myprefix";
-	
-	public static final String NAME = "myname";
-	
-	public static final String VALUE = "myvalue";
-	
-	protected XMPMetadata xmp;
-	
-	protected String type = null;
-	
-	protected Class<? extends TextType> clz = null;
-	
-	protected Constructor<? extends TextType> constructor = null;
-	
-	
-	
-    public TestDerivedType(Class<? extends TextType> clz,
-			String type) {
-		super();
-		this.clz = clz;
-		this.type = type;
-	}
-
-	@Parameters
-    public static Collection<Object[]> initializeParameters() throws Exception {
-    	Collection<Object[]> result = new ArrayList<Object[]>();
-
-    	result.add(new Object [] {AgentNameType.class,"AgentName"});
-    	result.add(new Object [] {ChoiceType.class,"Choice"});
-    	result.add(new Object [] {GUIDType.class,"GUID"});
-    	result.add(new Object [] {LocaleType.class,"Locale"});
-    	result.add(new Object [] {MIMEType.class,"MIME"});
-    	result.add(new Object [] {PartType.class,"Part"});
-    	result.add(new Object [] {ProperNameType.class,"ProperName"});
-    	result.add(new Object [] {RenditionClassType.class,"RenditionClass"});
-    	result.add(new Object [] {URIType.class,"URI"});
-    	result.add(new Object [] {URLType.class,"URL"});
-    	result.add(new Object [] {XPathType.class,"XPath"});
-    	
-    	return result;
-    	
     }
 
     @Before
-    public void before () throws Exception {
-		xmp = XMPMetadata.createXMPMetadata();
-		constructor = clz.getConstructor(new Class [] {
-				XMPMetadata.class,
-				String.class,
-				String.class,
-				String.class,
-				Object.class
-		});
-	}
-
-    protected TextType instanciate (XMPMetadata metadata, String namespaceURI, String prefix,
-			String propertyName, Object value) throws Exception {
-    	Object [] initargs = new Object [] {
-    			metadata,
-    			namespaceURI,
-    			prefix,
-    			propertyName,
-    			value
-    	};
-    	return constructor.newInstance(initargs);
+    public void before() throws Exception
+    {
+        xmp = XMPMetadata.createXMPMetadata();
+        constructor = clz.getConstructor(new Class[] { XMPMetadata.class, String.class, String.class, String.class,
+                Object.class });
+    }
+
+    protected TextType instanciate(XMPMetadata metadata, String namespaceURI, String prefix, String propertyName,
+            Object value) throws Exception
+    {
+        Object[] initargs = new Object[] { metadata, namespaceURI, prefix, propertyName, value };
+        return constructor.newInstance(initargs);
     }
 
-    
     @Test
-    public void test1 () throws Exception {
-    	TextType element = instanciate(xmp, null, PREFIX, NAME, VALUE);
-    	Assert.assertNull(element.getNamespace());
-    	Assert.assertTrue(element.getValue() instanceof String);
-    	Assert.assertEquals(VALUE, element.getValue());
-    	
+    public void test1() throws Exception
+    {
+        TextType element = instanciate(xmp, null, PREFIX, NAME, VALUE);
+        Assert.assertNull(element.getNamespace());
+        Assert.assertTrue(element.getValue() instanceof String);
+        Assert.assertEquals(VALUE, element.getValue());
+
     }
-    
-    
+
 }

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestJobType.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestJobType.java?rev=1453395&r1=1453394&r2=1453395&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestJobType.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestJobType.java Wed Mar  6 15:57:44 2013
@@ -24,51 +24,46 @@ package org.apache.xmpbox.type;
 import java.util.ArrayList;
 import java.util.Collection;
 
-import org.apache.xmpbox.type.AbstractStructuredType;
-import org.apache.xmpbox.type.JobType;
-import org.apache.xmpbox.type.Types;
 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 TestJobType extends AbstractStructuredTypeTester{
+public class TestJobType extends AbstractStructuredTypeTester
+{
 
-	protected JobType structured = null;
-	
-	@Before
-	public void before () throws Exception {
-		super.before();
-		structured = new JobType(xmp,"job");
-	}
-	
-	public TestJobType (Class<? extends AbstractStructuredType> clz, String field,Types type) {
-		super(clz, field, type);
-	}
-
-	@Override
-	protected AbstractStructuredType getStructured() {
-		return structured;
-	}
+    protected JobType structured = null;
 
-	
-    @Parameters
-    public static Collection<Object[]> initializeParameters() throws Exception {
-    	Collection<Object[]> result = new ArrayList<Object[]>();
+    @Before
+    public void before() throws Exception
+    {
+        super.before();
+        structured = new JobType(xmp, "job");
+    }
+
+    public TestJobType(Class<? extends AbstractStructuredType> clz, String field, Types type)
+    {
+        super(clz, field, type);
+    }
 
-    	result.add(new Object [] {JobType.class,"id",Types.Text});
-    	result.add(new Object [] {JobType.class,"name",Types.Text});
-    	result.add(new Object [] {JobType.class,"url",Types.URL});
-    	
-    	return result;
-    	
+    @Override
+    protected AbstractStructuredType getStructured()
+    {
+        return structured;
     }
 
+    @Parameters
+    public static Collection<Object[]> initializeParameters() throws Exception
+    {
+        Collection<Object[]> result = new ArrayList<Object[]>();
+
+        result.add(new Object[] { JobType.class, "id", Types.Text });
+        result.add(new Object[] { JobType.class, "name", Types.Text });
+        result.add(new Object[] { JobType.class, "url", Types.URL });
+
+        return result;
+
+    }
 
-    
-	
-	
-    
-	
 }

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestLayerType.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestLayerType.java?rev=1453395&r1=1453394&r2=1453395&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestLayerType.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestLayerType.java Wed Mar  6 15:57:44 2013
@@ -24,50 +24,45 @@ package org.apache.xmpbox.type;
 import java.util.ArrayList;
 import java.util.Collection;
 
-import org.apache.xmpbox.type.AbstractStructuredType;
-import org.apache.xmpbox.type.LayerType;
-import org.apache.xmpbox.type.Types;
 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 TestLayerType extends AbstractStructuredTypeTester{
+public class TestLayerType extends AbstractStructuredTypeTester
+{
 
-	protected LayerType structured = null;
-	
-	@Before
-	public void before () throws Exception {
-		super.before();
-		structured = new LayerType(xmp);
-	}
-	
-	public TestLayerType (Class<? extends AbstractStructuredType> clz, String field,Types type) {
-		super(clz, field, type);
-	}
-
-	@Override
-	protected AbstractStructuredType getStructured() {
-		return structured;
-	}
+    protected LayerType structured = null;
 
-	
-    @Parameters
-    public static Collection<Object[]> initializeParameters() throws Exception {
-    	Collection<Object[]> result = new ArrayList<Object[]>();
+    @Before
+    public void before() throws Exception
+    {
+        super.before();
+        structured = new LayerType(xmp);
+    }
 
-    	result.add(new Object [] {LayerType.class,"LayerName",Types.Text});
-    	result.add(new Object [] {LayerType.class,"LayerText",Types.Text});
-    	
-    	return result;
-    	
+    public TestLayerType(Class<? extends AbstractStructuredType> clz, String field, Types type)
+    {
+        super(clz, field, type);
     }
 
+    @Override
+    protected AbstractStructuredType getStructured()
+    {
+        return structured;
+    }
+
+    @Parameters
+    public static Collection<Object[]> initializeParameters() throws Exception
+    {
+        Collection<Object[]> result = new ArrayList<Object[]>();
+
+        result.add(new Object[] { LayerType.class, "LayerName", Types.Text });
+        result.add(new Object[] { LayerType.class, "LayerText", Types.Text });
+
+        return result;
+
+    }
 
-    
-	
-	
-    
-	
 }

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestResourceEventType.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestResourceEventType.java?rev=1453395&r1=1453394&r2=1453395&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestResourceEventType.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestResourceEventType.java Wed Mar  6 15:57:44 2013
@@ -24,54 +24,49 @@ package org.apache.xmpbox.type;
 import java.util.ArrayList;
 import java.util.Collection;
 
-import org.apache.xmpbox.type.AbstractStructuredType;
-import org.apache.xmpbox.type.ResourceEventType;
-import org.apache.xmpbox.type.Types;
 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 TestResourceEventType extends AbstractStructuredTypeTester{
+public class TestResourceEventType extends AbstractStructuredTypeTester
+{
 
-	protected ResourceEventType structured = null;
-	
-	@Before
-	public void before () throws Exception {
-		super.before();
-		structured = new ResourceEventType(xmp);
-	}
-	
-	public TestResourceEventType (Class<? extends AbstractStructuredType> clz, String field,Types type) {
-		super(clz, field, type);
-	}
-
-	@Override
-	protected AbstractStructuredType getStructured() {
-		return structured;
-	}
+    protected ResourceEventType structured = null;
 
-	
-    @Parameters
-    public static Collection<Object[]> initializeParameters() throws Exception {
-    	Collection<Object[]> result = new ArrayList<Object[]>();
+    @Before
+    public void before() throws Exception
+    {
+        super.before();
+        structured = new ResourceEventType(xmp);
+    }
+
+    public TestResourceEventType(Class<? extends AbstractStructuredType> clz, String field, Types type)
+    {
+        super(clz, field, type);
+    }
 
-    	result.add(new Object [] {ResourceEventType.class,"action",Types.Choice});
-    	result.add(new Object [] {ResourceEventType.class,"changed",Types.Text});
-    	result.add(new Object [] {ResourceEventType.class,"instanceID",Types.GUID});
-    	result.add(new Object [] {ResourceEventType.class,"parameters",Types.Text});
-    	result.add(new Object [] {ResourceEventType.class,"softwareAgent",Types.AgentName});
-    	result.add(new Object [] {ResourceEventType.class,"when",Types.Date});
-    	
-    	return result;
-    	
+    @Override
+    protected AbstractStructuredType getStructured()
+    {
+        return structured;
     }
 
+    @Parameters
+    public static Collection<Object[]> initializeParameters() throws Exception
+    {
+        Collection<Object[]> result = new ArrayList<Object[]>();
+
+        result.add(new Object[] { ResourceEventType.class, "action", Types.Choice });
+        result.add(new Object[] { ResourceEventType.class, "changed", Types.Text });
+        result.add(new Object[] { ResourceEventType.class, "instanceID", Types.GUID });
+        result.add(new Object[] { ResourceEventType.class, "parameters", Types.Text });
+        result.add(new Object[] { ResourceEventType.class, "softwareAgent", Types.AgentName });
+        result.add(new Object[] { ResourceEventType.class, "when", Types.Date });
+
+        return result;
+
+    }
 
-    
-	
-	
-    
-	
 }

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestResourceRefType.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestResourceRefType.java?rev=1453395&r1=1453394&r2=1453395&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestResourceRefType.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestResourceRefType.java Wed Mar  6 15:57:44 2013
@@ -24,64 +24,60 @@ package org.apache.xmpbox.type;
 import java.util.ArrayList;
 import java.util.Collection;
 
-import org.apache.xmpbox.type.AbstractStructuredType;
-import org.apache.xmpbox.type.ResourceRefType;
-import org.apache.xmpbox.type.Types;
 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 TestResourceRefType extends AbstractStructuredTypeTester{
+public class TestResourceRefType extends AbstractStructuredTypeTester
+{
 
-	protected ResourceRefType structured = null;
-	
-	@Before
-	public void before () throws Exception {
-		super.before();
-		structured = new ResourceRefType(xmp);
-	}
-	
-	public TestResourceRefType (Class<? extends AbstractStructuredType> clz, String field,Types type) {
-		super(clz, field, type);
-	}
-
-	@Override
-	protected AbstractStructuredType getStructured() {
-		return structured;
-	}
+    protected ResourceRefType structured = null;
 
-	
-    @Parameters
-    public static Collection<Object[]> initializeParameters() throws Exception {
-    	Collection<Object[]> result = new ArrayList<Object[]>();
+    @Before
+    public void before() throws Exception
+    {
+        super.before();
+        structured = new ResourceRefType(xmp);
+    }
+
+    public TestResourceRefType(Class<? extends AbstractStructuredType> clz, String field, Types type)
+    {
+        super(clz, field, type);
+    }
 
-//     	result.add(new Object [] {ResourceRefType.class,"alternatePaths","seq URI"});
-    	result.add(new Object [] {ResourceRefType.class,"documentID",Types.URI});
-    	result.add(new Object [] {ResourceRefType.class,"filePath",Types.URI});
-    	result.add(new Object [] {ResourceRefType.class,"fromPart",Types.Part});
-    	result.add(new Object [] {ResourceRefType.class,"instanceID",Types.URI});
-    	result.add(new Object [] {ResourceRefType.class,"lastModifyDate",Types.Date});
-    	result.add(new Object [] {ResourceRefType.class,"manager",Types.AgentName});
-    	result.add(new Object [] {ResourceRefType.class,"managerVariant",Types.Text});
-    	result.add(new Object [] {ResourceRefType.class,"manageTo",Types.URI});
-    	result.add(new Object [] {ResourceRefType.class,"manageUI",Types.URI});
-    	result.add(new Object [] {ResourceRefType.class,"maskMarkers",Types.Choice});
-    	result.add(new Object [] {ResourceRefType.class,"partMapping",Types.Text});
-    	result.add(new Object [] {ResourceRefType.class,"renditionClass",Types.RenditionClass});
-    	result.add(new Object [] {ResourceRefType.class,"renditionParams",Types.Text});
-    	result.add(new Object [] {ResourceRefType.class,"toPart",Types.Part});
-    	result.add(new Object [] {ResourceRefType.class,"versionID",Types.Text});
-    	
-    	return result;
-    	
+    @Override
+    protected AbstractStructuredType getStructured()
+    {
+        return structured;
     }
 
+    @Parameters
+    public static Collection<Object[]> initializeParameters() throws Exception
+    {
+        Collection<Object[]> result = new ArrayList<Object[]>();
+
+        // result.add(new Object []
+        // {ResourceRefType.class,"alternatePaths","seq URI"});
+        result.add(new Object[] { ResourceRefType.class, "documentID", Types.URI });
+        result.add(new Object[] { ResourceRefType.class, "filePath", Types.URI });
+        result.add(new Object[] { ResourceRefType.class, "fromPart", Types.Part });
+        result.add(new Object[] { ResourceRefType.class, "instanceID", Types.URI });
+        result.add(new Object[] { ResourceRefType.class, "lastModifyDate", Types.Date });
+        result.add(new Object[] { ResourceRefType.class, "manager", Types.AgentName });
+        result.add(new Object[] { ResourceRefType.class, "managerVariant", Types.Text });
+        result.add(new Object[] { ResourceRefType.class, "manageTo", Types.URI });
+        result.add(new Object[] { ResourceRefType.class, "manageUI", Types.URI });
+        result.add(new Object[] { ResourceRefType.class, "maskMarkers", Types.Choice });
+        result.add(new Object[] { ResourceRefType.class, "partMapping", Types.Text });
+        result.add(new Object[] { ResourceRefType.class, "renditionClass", Types.RenditionClass });
+        result.add(new Object[] { ResourceRefType.class, "renditionParams", Types.Text });
+        result.add(new Object[] { ResourceRefType.class, "toPart", Types.Part });
+        result.add(new Object[] { ResourceRefType.class, "versionID", Types.Text });
+
+        return result;
+
+    }
 
-    
-	
-	
-    
-	
 }

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestSimpleMetadataProperties.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestSimpleMetadataProperties.java?rev=1453395&r1=1453394&r2=1453395&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestSimpleMetadataProperties.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestSimpleMetadataProperties.java Wed Mar  6 15:57:44 2013
@@ -25,12 +25,6 @@ import java.util.Calendar;
 import java.util.List;
 
 import org.apache.xmpbox.XMPMetadata;
-import org.apache.xmpbox.type.Attribute;
-import org.apache.xmpbox.type.BooleanType;
-import org.apache.xmpbox.type.DateType;
-import org.apache.xmpbox.type.IntegerType;
-import org.apache.xmpbox.type.RealType;
-import org.apache.xmpbox.type.TextType;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -41,200 +35,201 @@ import org.junit.Test;
  * @author a183132
  * 
  */
-public class TestSimpleMetadataProperties {
+public class TestSimpleMetadataProperties
+{
 
-	protected XMPMetadata parent;
+    protected XMPMetadata parent;
 
-	@Before
-	public void resetDocument() throws Exception {
-		parent = XMPMetadata.createXMPMetadata();
-	}
-
-	/**
-	 * Check the detection of a bad type
-	 * 
-	 * @throws InappropriateTypeException
-	 */
-	@Test(expected = IllegalArgumentException.class)
-	public void testBooleanBadTypeDetection() {
-		new BooleanType(parent, null, "test", "booleen", "Not a Boolean");
-	}
-
-	/**
-	 * Check the detection of a bad type
-	 * 
-	 * @throws InappropriateTypeException
-	 */
-	@Test(expected = IllegalArgumentException.class)
-	public void testDateBadTypeDetection() {
-		new DateType(parent, null, "test", "date", "Bad Date");
-	}
-
-	/**
-	 * Check the detection of a bad type
-	 * 
-	 * @throws InappropriateTypeException
-	 */
-	@Test(expected = IllegalArgumentException.class)
-	public void testIntegerBadTypeDetection() {
-		new IntegerType(parent, null,"test", "integer", "Not an int");
-	}
-
-	/**
-	 * Check the detection of a bad type
-	 * 
-	 * @throws InappropriateTypeException
-	 */
-	@Test(expected = IllegalArgumentException.class)
-	public void testRealBadTypeDetection() throws Exception {
-		new RealType(parent, null,"test", "real", "Not a real");
-	}
-
-	/**
-	 * Check the detection of a bad type
-	 * 
-	 * @throws InappropriateTypeException
-	 */
-	@Test(expected = IllegalArgumentException.class)
-	public void testTextBadTypeDetection() throws Exception {
-		new TextType(parent, null,"test", "text", Calendar.getInstance());
-	}
-
-	/**
-	 * Check if information between objects and the elment generated are equals
-	 * 
-	 * @throws Exception
-	 */
-	@Test
-	public void testElementAndObjectSynchronization() throws Exception {
-		boolean boolv = true;
-		Calendar datev = Calendar.getInstance();
-		int integerv = 1;
-		float realv = Float.parseFloat("1.69");
-		String textv = "TEXTCONTENT";
-		BooleanType bool = parent.getTypeMapping().createBoolean(null, "test", "booleen", boolv);
-		DateType date =  parent.getTypeMapping().createDate( null,"test", "date", datev);
-		IntegerType integer =parent.getTypeMapping().createInteger( null, "test", "integer",
-				integerv);
-		RealType real = parent.getTypeMapping().createReal( null, "test", "real", realv);
-		TextType text = parent.getTypeMapping().createText( null,"test", "text", textv);
-
-		Assert.assertEquals(boolv, bool.getValue());
-		Assert.assertEquals(datev, date.getValue());
-		Assert.assertEquals(Integer.valueOf(integerv), integer.getValue());
-		Assert.assertEquals(realv, real.getValue(), 0);
-		Assert.assertEquals(textv, text.getStringValue());
-
-	}
-
-	/**
-	 * Check the creation from string attributes
-	 * 
-	 * @throws Exception
-	 */
-	@Test
-	public void testCreationFromString() throws Exception {
-		String boolv = "False";
-		String datev = "2010-03-22T14:33:11+01:00";
-		String integerv = "10";
-		String realv = "1.92";
-		String textv = "text";
-
-		BooleanType bool = new BooleanType(parent, null, "test", "booleen", boolv);
-		DateType date = new DateType(parent, null,"test", "date", datev);
-		IntegerType integer = new IntegerType(parent,null, "test", "integer",
-				integerv);
-		RealType real = new RealType(parent, null, "test", "real", realv);
-		TextType text = new TextType(parent, null,"test", "text", textv);
-
-		Assert.assertEquals(boolv, bool.getStringValue());
-		Assert.assertEquals(datev, date.getStringValue());
-		Assert.assertEquals(integerv, integer.getStringValue());
-		Assert.assertEquals(realv, real.getStringValue());
-		Assert.assertEquals(textv, text.getStringValue());
-	}
-
-	/**
-	 * Check creation when a namespace is specified
-	 * 
-	 * @throws Exception
-	 */
-	@Test
-	public void testObjectCreationWithNamespace() throws Exception {
-		String ns = "http://www.test.org/pdfa/";
-		BooleanType bool = parent.getTypeMapping().createBoolean( ns, "test", "booleen", true);
-		DateType date = parent.getTypeMapping().createDate( ns, "test", "date", Calendar
-				.getInstance());
-		IntegerType integer = parent.getTypeMapping().createInteger( ns, "test", "integer", 1);
-		RealType real = parent.getTypeMapping().createReal( ns, "test", "real", (float) 1.6);
-		TextType text = parent.getTypeMapping().createText( ns, "test", "text", "TEST");
-
-		Assert.assertEquals(ns, bool.getNamespace());
-		Assert.assertEquals(ns, date.getNamespace());
-		Assert.assertEquals(ns, integer.getNamespace());
-		Assert.assertEquals(ns, real.getNamespace());
-		Assert.assertEquals(ns, text.getNamespace());
-
-	}
-
-	/**
-	 * Throw InappropriateType Exception
-	 * 
-	 * @throws InappropriateTypeException
-	 */
-	@Test(expected = IllegalArgumentException.class)
-	public void testExceptionWithCause() throws Exception {
-		throw new IllegalArgumentException("TEST", new Throwable());
-	}
-
-	/**
-	 * Check if attributes management works
-	 * 
-	 * @throws Exception
-	 */
-	@Test
-	public void testAttribute() throws Exception {
-
-		IntegerType integer = new IntegerType(parent,null, "test", "integer", 1);
-		Attribute value = new Attribute("http://www.test.org/test/", "value1", "StringValue1");
-		Attribute value2 = new Attribute("http://www.test.org/test/", "value2", "StringValue2");
-
-		integer.setAttribute(value);
-
-		// System.out.println(value.getQualifiedName());
-
-		Assert.assertEquals(value, integer.getAttribute(value
-				.getName()));
-		Assert.assertTrue(integer.containsAttribute(value.getName()));
-
-		// Replacement check
-
-		integer.setAttribute(value2);
-		Assert.assertEquals(value2, integer.getAttribute(value2
-				.getName()));
-
-		integer.removeAttribute(value2.getName());
-		Assert
-				.assertFalse(integer.containsAttribute(value2
-						.getName()));
-
-		// Attribute with namespace Creation checking
-		Attribute valueNS = new Attribute("http://www.tefst2.org/test/",
-				 "value2", "StringValue.2");
-		integer.setAttribute(valueNS);
-		Attribute valueNS2 = new Attribute("http://www.test2.org/test/",
-				 "value2", "StringValueTwo");
-		integer.setAttribute(valueNS2);
-
-		List<Attribute> atts = integer.getAllAttributes();
-		/*
-		 * for (Attribute attribute : atts) {
-		 * System.out.println(attribute.getLocalName
-		 * ()+" :"+attribute.getValue()); }
-		 */
-		Assert.assertFalse(atts.contains(valueNS));
-		Assert.assertTrue(atts.contains(valueNS2));
+    @Before
+    public void resetDocument() throws Exception
+    {
+        parent = XMPMetadata.createXMPMetadata();
+    }
+
+    /**
+     * Check the detection of a bad type
+     * 
+     * @throws InappropriateTypeException
+     */
+    @Test(expected = IllegalArgumentException.class)
+    public void testBooleanBadTypeDetection()
+    {
+        new BooleanType(parent, null, "test", "booleen", "Not a Boolean");
+    }
+
+    /**
+     * Check the detection of a bad type
+     * 
+     * @throws InappropriateTypeException
+     */
+    @Test(expected = IllegalArgumentException.class)
+    public void testDateBadTypeDetection()
+    {
+        new DateType(parent, null, "test", "date", "Bad Date");
+    }
+
+    /**
+     * Check the detection of a bad type
+     * 
+     * @throws InappropriateTypeException
+     */
+    @Test(expected = IllegalArgumentException.class)
+    public void testIntegerBadTypeDetection()
+    {
+        new IntegerType(parent, null, "test", "integer", "Not an int");
+    }
+
+    /**
+     * Check the detection of a bad type
+     * 
+     * @throws InappropriateTypeException
+     */
+    @Test(expected = IllegalArgumentException.class)
+    public void testRealBadTypeDetection() throws Exception
+    {
+        new RealType(parent, null, "test", "real", "Not a real");
+    }
+
+    /**
+     * Check the detection of a bad type
+     * 
+     * @throws InappropriateTypeException
+     */
+    @Test(expected = IllegalArgumentException.class)
+    public void testTextBadTypeDetection() throws Exception
+    {
+        new TextType(parent, null, "test", "text", Calendar.getInstance());
+    }
+
+    /**
+     * Check if information between objects and the elment generated are equals
+     * 
+     * @throws Exception
+     */
+    @Test
+    public void testElementAndObjectSynchronization() throws Exception
+    {
+        boolean boolv = true;
+        Calendar datev = Calendar.getInstance();
+        int integerv = 1;
+        float realv = Float.parseFloat("1.69");
+        String textv = "TEXTCONTENT";
+        BooleanType bool = parent.getTypeMapping().createBoolean(null, "test", "booleen", boolv);
+        DateType date = parent.getTypeMapping().createDate(null, "test", "date", datev);
+        IntegerType integer = parent.getTypeMapping().createInteger(null, "test", "integer", integerv);
+        RealType real = parent.getTypeMapping().createReal(null, "test", "real", realv);
+        TextType text = parent.getTypeMapping().createText(null, "test", "text", textv);
+
+        Assert.assertEquals(boolv, bool.getValue());
+        Assert.assertEquals(datev, date.getValue());
+        Assert.assertEquals(Integer.valueOf(integerv), integer.getValue());
+        Assert.assertEquals(realv, real.getValue(), 0);
+        Assert.assertEquals(textv, text.getStringValue());
+
+    }
+
+    /**
+     * Check the creation from string attributes
+     * 
+     * @throws Exception
+     */
+    @Test
+    public void testCreationFromString() throws Exception
+    {
+        String boolv = "False";
+        String datev = "2010-03-22T14:33:11+01:00";
+        String integerv = "10";
+        String realv = "1.92";
+        String textv = "text";
+
+        BooleanType bool = new BooleanType(parent, null, "test", "booleen", boolv);
+        DateType date = new DateType(parent, null, "test", "date", datev);
+        IntegerType integer = new IntegerType(parent, null, "test", "integer", integerv);
+        RealType real = new RealType(parent, null, "test", "real", realv);
+        TextType text = new TextType(parent, null, "test", "text", textv);
+
+        Assert.assertEquals(boolv, bool.getStringValue());
+        Assert.assertEquals(datev, date.getStringValue());
+        Assert.assertEquals(integerv, integer.getStringValue());
+        Assert.assertEquals(realv, real.getStringValue());
+        Assert.assertEquals(textv, text.getStringValue());
+    }
+
+    /**
+     * Check creation when a namespace is specified
+     * 
+     * @throws Exception
+     */
+    @Test
+    public void testObjectCreationWithNamespace() throws Exception
+    {
+        String ns = "http://www.test.org/pdfa/";
+        BooleanType bool = parent.getTypeMapping().createBoolean(ns, "test", "booleen", true);
+        DateType date = parent.getTypeMapping().createDate(ns, "test", "date", Calendar.getInstance());
+        IntegerType integer = parent.getTypeMapping().createInteger(ns, "test", "integer", 1);
+        RealType real = parent.getTypeMapping().createReal(ns, "test", "real", (float) 1.6);
+        TextType text = parent.getTypeMapping().createText(ns, "test", "text", "TEST");
+
+        Assert.assertEquals(ns, bool.getNamespace());
+        Assert.assertEquals(ns, date.getNamespace());
+        Assert.assertEquals(ns, integer.getNamespace());
+        Assert.assertEquals(ns, real.getNamespace());
+        Assert.assertEquals(ns, text.getNamespace());
+
+    }
+
+    /**
+     * Throw InappropriateType Exception
+     * 
+     * @throws InappropriateTypeException
+     */
+    @Test(expected = IllegalArgumentException.class)
+    public void testExceptionWithCause() throws Exception
+    {
+        throw new IllegalArgumentException("TEST", new Throwable());
+    }
+
+    /**
+     * Check if attributes management works
+     * 
+     * @throws Exception
+     */
+    @Test
+    public void testAttribute() throws Exception
+    {
+
+        IntegerType integer = new IntegerType(parent, null, "test", "integer", 1);
+        Attribute value = new Attribute("http://www.test.org/test/", "value1", "StringValue1");
+        Attribute value2 = new Attribute("http://www.test.org/test/", "value2", "StringValue2");
+
+        integer.setAttribute(value);
+
+        // System.out.println(value.getQualifiedName());
+
+        Assert.assertEquals(value, integer.getAttribute(value.getName()));
+        Assert.assertTrue(integer.containsAttribute(value.getName()));
+
+        // Replacement check
+
+        integer.setAttribute(value2);
+        Assert.assertEquals(value2, integer.getAttribute(value2.getName()));
+
+        integer.removeAttribute(value2.getName());
+        Assert.assertFalse(integer.containsAttribute(value2.getName()));
+
+        // Attribute with namespace Creation checking
+        Attribute valueNS = new Attribute("http://www.tefst2.org/test/", "value2", "StringValue.2");
+        integer.setAttribute(valueNS);
+        Attribute valueNS2 = new Attribute("http://www.test2.org/test/", "value2", "StringValueTwo");
+        integer.setAttribute(valueNS2);
+
+        List<Attribute> atts = integer.getAllAttributes();
+        /*
+         * for (Attribute attribute : atts) { System.out.println(attribute.getLocalName ()+" :"+attribute.getValue()); }
+         */
+        Assert.assertFalse(atts.contains(valueNS));
+        Assert.assertTrue(atts.contains(valueNS2));
 
-	}
+    }
 
 }

Modified: pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestThumbnailType.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestThumbnailType.java?rev=1453395&r1=1453394&r2=1453395&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestThumbnailType.java (original)
+++ pdfbox/trunk/xmpbox/src/test/java/org/apache/xmpbox/type/TestThumbnailType.java Wed Mar  6 15:57:44 2013
@@ -24,52 +24,47 @@ package org.apache.xmpbox.type;
 import java.util.ArrayList;
 import java.util.Collection;
 
-import org.apache.xmpbox.type.AbstractStructuredType;
-import org.apache.xmpbox.type.ThumbnailType;
-import org.apache.xmpbox.type.Types;
 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 TestThumbnailType extends AbstractStructuredTypeTester{
+public class TestThumbnailType extends AbstractStructuredTypeTester
+{
 
-	protected ThumbnailType structured = null;
-	
-	@Before
-	public void before () throws Exception {
-		super.before();
-		structured = new ThumbnailType(xmp);
-	}
-	
-	public TestThumbnailType (Class<? extends AbstractStructuredType> clz, String field,Types type) {
-		super(clz, field, type);
-	}
-
-	@Override
-	protected AbstractStructuredType getStructured() {
-		return structured;
-	}
+    protected ThumbnailType structured = null;
 
-	
-    @Parameters
-    public static Collection<Object[]> initializeParameters() throws Exception {
-    	Collection<Object[]> result = new ArrayList<Object[]>();
+    @Before
+    public void before() throws Exception
+    {
+        super.before();
+        structured = new ThumbnailType(xmp);
+    }
+
+    public TestThumbnailType(Class<? extends AbstractStructuredType> clz, String field, Types type)
+    {
+        super(clz, field, type);
+    }
 
-    	result.add(new Object [] {ThumbnailType.class,"format",Types.Choice});
-    	result.add(new Object [] {ThumbnailType.class,"height",Types.Integer});
-    	result.add(new Object [] {ThumbnailType.class,"width",Types.Integer});
-    	result.add(new Object [] {ThumbnailType.class,"image",Types.Text});
-    	
-    	return result;
-    	
+    @Override
+    protected AbstractStructuredType getStructured()
+    {
+        return structured;
     }
 
+    @Parameters
+    public static Collection<Object[]> initializeParameters() throws Exception
+    {
+        Collection<Object[]> result = new ArrayList<Object[]>();
+
+        result.add(new Object[] { ThumbnailType.class, "format", Types.Choice });
+        result.add(new Object[] { ThumbnailType.class, "height", Types.Integer });
+        result.add(new Object[] { ThumbnailType.class, "width", Types.Integer });
+        result.add(new Object[] { ThumbnailType.class, "image", Types.Text });
+
+        return result;
+
+    }
 
-    
-	
-	
-    
-	
 }