Package org.apache.padaf.xmpbox

Examples of org.apache.padaf.xmpbox.XMPMetadata$SchemasContainer


  public void initNewDocumentInformation() throws Exception {

    try {
      doc = new PDDocument();
      dico = doc.getDocumentInformation();
      metadata = new XMPMetadata();
    } catch (IOException e) {
      throw new Exception("Failed to create temporary test PDF/XMP Document");
    }

  }
View Full Code Here


  protected XMPMetadata metadata;

  @Before
  public void testInit() throws Exception {
    metadata = new XMPMetadata();
  }
View Full Code Here

  protected XMPMetadata parent;

  @Before
  public void resetDocument() throws Exception {
    parent = new XMPMetadata();
  }
View Full Code Here

  protected XMPMetadata metadata;
  protected XMPSchema tmpSchem;

  @Before
  public void resetDocument() throws Exception {
    metadata = new XMPMetadata();
    tmpSchem = metadata.createAndAddDefaultSchema("test",
        "http://www.test.org/test/");

  }
View Full Code Here

  protected XMPMetadata parent;

  @Before
  public void resetDocument() throws Exception {
    parent = new XMPMetadata();
  }
View Full Code Here

  protected XMPMetadata parent;
  protected XMPSchema schem;

  @Before
  public void resetDocument() throws Exception {
    parent = new XMPMetadata();
    schem = new XMPSchema(parent, "nsSchem", "nsURI");

  }
View Full Code Here

@RunWith(Parameterized.class)
public class AdobePDFTest extends AbstractXMPSchemaTest {

  @Before
  public void initTempMetaData() throws Exception {
    metadata = new XMPMetadata();
    schema = metadata.createAndAddAdobePDFSchema();
    schemaClass = AdobePDFSchema.class;
  }
View Full Code Here

  protected XMPMetadata metadata;

  @Before
  public void initTempMetaData() throws Exception {
    metadata = new XMPMetadata();

  }
View Full Code Here

    InputStream fis = XMPDocumentBuilder.class
        .getResourceAsStream("isartorStyleXMPOK.xml");

    XMPDocumentBuilder xdb = new XMPDocumentBuilder();

    XMPMetadata metadata = xdb.parse(fis);
    // <xmpMM:DocumentID>
    Assert.assertEquals("uuid:09C78666-2F91-3A9C-92AF-3691A6D594F7",
        metadata.getXMPMediaManagementSchema().getDocumentIDValue());

    // <xmp:CreateDate>
    // <xmp:ModifyDate>
    // <xmp:MetadataDate>
    Assert.assertEquals(DateConverter
        .toCalendar("2008-01-18T16:59:54+01:00"), metadata
        .getXMPBasicSchema().getCreateDateValue());
    Assert.assertEquals(DateConverter
        .toCalendar("2008-01-18T16:59:54+01:00"), metadata
        .getXMPBasicSchema().getModifyDateValue());
    Assert.assertEquals(DateConverter
        .toCalendar("2008-01-18T16:59:54+01:00"), metadata
        .getXMPBasicSchema().getMetadataDateValue());

    // PDFA Extension
    // Check numbers of schema descriptions
    Assert.assertTrue(metadata.getPDFExtensionSchema()
        .getDescriptionSchema().size() == 1);
    SchemaDescription desc = metadata.getPDFExtensionSchema()
        .getDescriptionSchema().get(0);

    // Check description content
    Assert.assertEquals("ACME E-Mail Schema", desc.getSchema());
    Assert.assertEquals("http://www.acme.com/ns/email/1/", desc
        .getNameSpaceURI());
    Assert.assertEquals("acmeemail", desc.getPrefix());

    // Check property definition
    List<PDFAPropertyDescription> properties = desc.getProperties();
    Assert.assertTrue(properties.size() == 2);

    // Check properties content
    PDFAPropertyDescription tmpProp = properties.get(0);
    Assert.assertEquals("Delivery-Date", tmpProp.getNameValue());
    Assert.assertEquals("Date", tmpProp.getValueTypeValue());
    Assert.assertEquals("internal", tmpProp.getCategoryValue());
    Assert.assertEquals("date of email delivery", tmpProp
        .getDescriptionValue());

    tmpProp = properties.get(1);
    Assert.assertEquals("From", tmpProp.getNameValue());
    Assert.assertEquals("mailaddress", tmpProp.getValueTypeValue());
    Assert.assertEquals("internal", tmpProp.getCategoryValue());
    Assert.assertEquals("sender email address", tmpProp
        .getDescriptionValue());

    // Check valuetype
    // Check numbers of valuetype defined
    Assert.assertTrue(desc.getValueTypes().size() == 1);
    PDFAValueTypeDescription tmpValType = desc.getValueTypes().get(0);
    Assert.assertEquals("mailaddress", tmpValType.getTypeNameValue());
    Assert.assertEquals("http://www.acme.com/ns/email/1/mailaddress/",
        tmpValType.getNamespaceURIValue());
    Assert.assertEquals("mailaddress value", tmpValType
        .getDescriptionValue());

    // Check fields associated to this value type
    Assert.assertTrue(tmpValType.getFields().size() == 2);

    PDFAFieldDescription tmpField = tmpValType.getFields().get(0);
    Assert.assertEquals("name", tmpField.getNameValue());
    Assert.assertEquals("Text", tmpField.getValueTypeValue());
    Assert.assertEquals("plaintext name", tmpField.getDescriptionValue());

    tmpField = tmpValType.getFields().get(1);
    Assert.assertEquals("mailto", tmpField.getNameValue());
    Assert.assertEquals("Text", tmpField.getValueTypeValue());
    Assert.assertEquals("email address", tmpField.getDescriptionValue());

    // Check PDFA Conformance schema
    Assert.assertEquals("1", metadata.getPDFIdentificationSchema()
        .getPart().getStringValue());
    Assert.assertEquals("B", metadata.getPDFIdentificationSchema()
        .getConformanceValue());
    Assert.assertEquals("1:2005", metadata.getPDFIdentificationSchema()
        .getAmd().getStringValue());

    // Check ADOBE PDF Schema
    Assert.assertEquals("PDFlib Personalization Server 7.0.2p5 (Win32)",
        metadata.getAdobePDFSchema().getProducerValue());

    // Check Defined Schema
    XMPSchema schem = metadata.getSchema("http://www.acme.com/ns/email/1/");
    Assert.assertEquals(DateConverter
        .toCalendar("2007-11-09T09:55:36+01:00"), schem
        .getDatePropertyValue("acmeemail:Delivery-Date"));
    Assert.assertNotNull(schem.getAbstractProperty(("acmeemail:From")));
View Full Code Here

    InputStream fis = XMPDocumentBuilder.class
        .getResourceAsStream("ThumbisartorStyle.xml");

    XMPDocumentBuilder xdb = new XMPDocumentBuilder();

    XMPMetadata metadata = xdb.parse(fis);

    // <xmpMM:DocumentID>
    Assert.assertEquals("uuid:09C78666-2F91-3A9C-92AF-3691A6D594F7",
        metadata.getXMPMediaManagementSchema().getDocumentIDValue());

    // <xmp:CreateDate>
    // <xmp:ModifyDate>
    // <xmp:MetadataDate>
    Assert.assertEquals(DateConverter
        .toCalendar("2008-01-18T16:59:54+01:00"), metadata
        .getXMPBasicSchema().getCreateDateValue());
    Assert.assertEquals(DateConverter
        .toCalendar("2008-01-18T16:59:54+01:00"), metadata
        .getXMPBasicSchema().getModifyDateValue());
    Assert.assertEquals(DateConverter
        .toCalendar("2008-01-18T16:59:54+01:00"), metadata
        .getXMPBasicSchema().getMetadataDateValue());

    // THUMBNAILS TEST
    List<ThumbnailType> thumbs = metadata.getXMPBasicSchema()
        .getThumbnails();
    Assert.assertNotNull(thumbs);
    Assert.assertEquals(1, thumbs.size());
    ThumbnailType thumb = thumbs.get(0);
    /*
     * <xapGImg:height>162</xapGImg:height>
     * <xapGImg:width>216</xapGImg:width>
     * <xapGImg:format>JPEG</xapGImg:format>
     * <xapGImg:image>/9j/4AAQSkZJRgABAgEASABIAAD</xapGImg:image>
     */
    Assert.assertEquals(new Integer(162), thumb.getHeight());
    Assert.assertEquals(new Integer(216), thumb.getWidth());
    Assert.assertEquals("JPEG", thumb.getFormat());
    Assert.assertEquals("/9j/4AAQSkZJRgABAgEASABIAAD", thumb.getImg());

    // PDFA Extension
    // Check numbers of schema descriptions
    Assert.assertTrue(metadata.getPDFExtensionSchema()
        .getDescriptionSchema().size() == 1);
    SchemaDescription desc = metadata.getPDFExtensionSchema()
        .getDescriptionSchema().get(0);

    // Check description content
    Assert.assertEquals("ACME E-Mail Schema", desc.getSchema());
    Assert.assertEquals("http://www.acme.com/ns/email/1/", desc
        .getNameSpaceURI());
    Assert.assertEquals("acmeemail", desc.getPrefix());

    // Check property definition
    List<PDFAPropertyDescription> properties = desc.getProperties();
    Assert.assertTrue(properties.size() == 2);

    // Check properties content
    PDFAPropertyDescription tmpProp = properties.get(0);
    Assert.assertEquals("Delivery-Date", tmpProp.getNameValue());
    Assert.assertEquals("Date", tmpProp.getValueTypeValue());
    Assert.assertEquals("internal", tmpProp.getCategoryValue());
    Assert.assertEquals("date of email delivery", tmpProp
        .getDescriptionValue());

    tmpProp = properties.get(1);
    Assert.assertEquals("From", tmpProp.getNameValue());
    Assert.assertEquals("mailaddress", tmpProp.getValueTypeValue());
    Assert.assertEquals("internal", tmpProp.getCategoryValue());
    Assert.assertEquals("sender email address", tmpProp
        .getDescriptionValue());

    // Check valuetype
    // Check numbers of valuetype defined
    Assert.assertTrue(desc.getValueTypes().size() == 1);
    PDFAValueTypeDescription tmpValType = desc.getValueTypes().get(0);
    Assert.assertEquals("mailaddress", tmpValType.getTypeNameValue());
    Assert.assertEquals("http://www.acme.com/ns/email/1/mailaddress/",
        tmpValType.getNamespaceURIValue());
    Assert.assertEquals("mailaddress value", tmpValType
        .getDescriptionValue());

    // Check fields associated to this value type
    Assert.assertTrue(tmpValType.getFields().size() == 2);

    PDFAFieldDescription tmpField = tmpValType.getFields().get(0);
    Assert.assertEquals("name", tmpField.getNameValue());
    Assert.assertEquals("Text", tmpField.getValueTypeValue());
    Assert.assertEquals("plaintext name", tmpField.getDescriptionValue());

    tmpField = tmpValType.getFields().get(1);
    Assert.assertEquals("mailto", tmpField.getNameValue());
    Assert.assertEquals("Text", tmpField.getValueTypeValue());
    Assert.assertEquals("email address", tmpField.getDescriptionValue());

    // Check PDFA Conformance schema
    Assert.assertEquals("1", metadata.getPDFIdentificationSchema()
        .getPart().getStringValue());
    Assert.assertEquals("B", metadata.getPDFIdentificationSchema()
        .getConformanceValue());
    Assert.assertEquals("1:2005", metadata.getPDFIdentificationSchema()
        .getAmdValue());

    // Check ADOBE PDF Schema
    Assert.assertEquals("PDFlib Personalization Server 7.0.2p5 (Win32)",
        metadata.getAdobePDFSchema().getProducerValue());

    // Check Defined Schema
    XMPSchema schem = metadata.getSchema("http://www.acme.com/ns/email/1/");
    Assert.assertEquals(DateConverter
        .toCalendar("2007-11-09T09:55:36+01:00"), schem
        .getDatePropertyValue("acmeemail:Delivery-Date"));
    Assert.assertNotNull(schem.getAbstractProperty(("acmeemail:From")));

View Full Code Here

TOP

Related Classes of org.apache.padaf.xmpbox.XMPMetadata$SchemasContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.