metadata = new XMPMetadata();
}
@Test
public void testDoubleDublinCore() throws Exception {
DublinCoreSchema dc1 = metadata.createAndAddDublinCoreSchema();
String ownPrefix = "test";
DublinCoreSchema dc2 = new DublinCoreSchema(metadata, ownPrefix);
metadata.addSchema(dc2);
List<String> creators = new ArrayList<String>();
creators.add("creator1");
creators.add("creator2");
String format = "application/pdf";
dc1.setFormatValue(format);
dc1.addToCreatorValue(creators.get(0));
dc1.addToCreatorValue(creators.get(1));
String coverage = "Coverage";
dc2.setCoverageValue(coverage);
dc2.addToCreatorValue(creators.get(0));
dc2.addToCreatorValue(creators.get(1));
// We can't use metadata.getDublinCoreSchema() due to specification of
// XMPBox (see Javadoc of XMPMetadata)
Assert.assertEquals(format, ((DublinCoreSchema) metadata.getSchema(
DublinCoreSchema.PREFERRED_DC_PREFIX, DublinCoreSchema.DCURI))
.getFormatValue());
Assert.assertEquals(coverage, ((DublinCoreSchema) metadata.getSchema(
ownPrefix, DublinCoreSchema.DCURI)).getCoverageValue());
List<XMPSchema> schems = metadata.getAllSchemas();
DublinCoreSchema dc;
for (XMPSchema xmpSchema : schems) {
dc = (DublinCoreSchema) xmpSchema;
Assert.assertTrue(dc.getCreatorValue().containsAll(creators));
}
// SaveMetadataHelper.serialize(metadata, true, System.out);
}