Package org.apache.padaf.xmpbox.type

Examples of org.apache.padaf.xmpbox.type.IntegerType


   *
   * @throws InappropriateTypeException
   */
  @Test(expected = IllegalArgumentException.class)
  public void testIntegerBadTypeDetection() {
    new IntegerType(parent, "test", "integer", "Not an int");
  }
View Full Code Here


    int integerv = 1;
    float realv = Float.parseFloat("1.69");
    String textv = "TEXTCONTENT";
    BooleanType bool = new BooleanType(parent, "test", "booleen", boolv);
    DateType date = new DateType(parent, "test", "date", datev);
    IntegerType integer = new IntegerType(parent, "test", "integer",
        integerv);
    RealType real = new RealType(parent, "test", "real", realv);
    TextType text = new TextType(parent, "test", "text", textv);

    Assert.assertEquals(bool.getNamespace(), bool.getElement()
        .getNamespaceURI());
    Assert.assertEquals(bool.getPrefix() + ":" + bool.getPropertyName(),
        bool.getElement().getNodeName());
    Assert.assertEquals(bool.getQualifiedName(), bool.getElement()
        .getNodeName());
    Assert.assertEquals(boolv, bool.getValue());
    Assert.assertEquals(datev, date.getValue());
    Assert.assertEquals(integerv, integer.getValue());
    Assert.assertEquals(realv, real.getValue(), 0);
    Assert.assertEquals(textv, text.getStringValue());

  }
View Full Code Here

  @Test
  public void testObjectCreationFromJavaType() throws Exception {
    BooleanType bool = new BooleanType(parent, "test", "booleen", true);
    DateType date = new DateType(parent, "test", "date", Calendar
        .getInstance());
    IntegerType integer = new IntegerType(parent, "test", "integer", 1);
    RealType real = new RealType(parent, "test", "real", (float) 1.6);
    TextType text = new TextType(parent, "test", "text", "TEST");

    Element e = parent.getFuturOwner().createElement("TEST");
    parent.getFuturOwner().appendChild(e);
    e.appendChild(bool.getElement());
    e.appendChild(date.getElement());
    e.appendChild(integer.getElement());
    e.appendChild(real.getElement());
    e.appendChild(text.getElement());

    // XMLUtil.save(parent.getFuturOwner(), System.out, "UTF-8");
View Full Code Here

    String intProp = "nsSchem:IntegerTestProp";
    Integer intPropVal = 5;
    schem.setIntegerPropertyValue(intProp, intPropVal);
    Assert.assertEquals(intPropVal, schem.getIntegerPropertyValue(intProp));

    IntegerType intType = new IntegerType(parent, "nsSchem", "intType", 5);
    schem.setIntegerProperty(intType);
    Assert.assertEquals(intType, schem
        .getIntegerProperty("nsSchem:intType"));

    // Check bad type verification
View Full Code Here

    String realv = "1.92";
    String textv = "text";

    BooleanType bool = new BooleanType(parent, "test", "booleen", boolv);
    DateType date = new DateType(parent, "test", "date", datev);
    IntegerType integer = new IntegerType(parent, "test", "integer",
        integerv);
    RealType real = new RealType(parent, "test", "real", realv);
    TextType text = new TextType(parent, "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());
  }
View Full Code Here

  public void testObjectCreationWithNamespace() throws Exception {
    String ns = "http://www.test.org/pdfa/";
    BooleanType bool = new BooleanType(parent, ns, "test", "booleen", true);
    DateType date = new DateType(parent, ns, "test", "date", Calendar
        .getInstance());
    IntegerType integer = new IntegerType(parent, ns, "test", "integer", 1);
    RealType real = new RealType(parent, ns, "test", "real", (float) 1.6);
    TextType text = new TextType(parent, 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());

    Element e = parent.getFuturOwner().createElement("TEST");
    parent.getFuturOwner().appendChild(e);
    e.appendChild(bool.getElement());
    e.appendChild(date.getElement());
    e.appendChild(integer.getElement());
    e.appendChild(real.getElement());
    e.appendChild(text.getElement());

    // XMLUtil.save(parent.getFuturOwner(), System.out, "UTF-8");
View Full Code Here

   * @throws Exception
   */
  @Test
  public void testAttribute() throws Exception {

    IntegerType integer = new IntegerType(parent, "test", "integer", 1);
    Attribute value = new Attribute("http://www.test.org/test/", "test",
        "value1", "StringValue1");
    Attribute value2 = new Attribute(null, "test", "value2", "StringValue2");

    integer.setAttribute(value);

    // System.out.println(value.getQualifiedName());

    Assert.assertEquals(value, integer.getAttribute(value
        .getQualifiedName()));
    Assert.assertTrue(integer.containsAttribute(value.getQualifiedName()));

    // Replacement check

    integer.setAttribute(value2);
    Assert.assertEquals(value2, integer.getAttribute(value2
        .getQualifiedName()));

    integer.removeAttribute(value2.getQualifiedName());
    Assert
        .assertFalse(integer.containsAttribute(value2
            .getQualifiedName()));

    // Attribute with namespace Creation checking
    Attribute valueNS = new Attribute("http://www.tefst2.org/test/",
        "test2", "value2", "StringValue.2");
    integer.setAttribute(valueNS);
    Attribute valueNS2 = new Attribute("http://www.test2.org/test/",
        "test2", "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));

    parent.getFuturOwner().appendChild(integer.getElement());
    // XMLUtil.save(parent.getFuturOwner(), System.out, "UTF-8");
  }
View Full Code Here

  protected void testGetSetIntegerProperty() throws Exception {
    String setName = setMethod(property);
    String getName = getMethod(property);

    IntegerType it = new IntegerType(metadata, schema.getLocalPrefix(),
        property, value);
    Method setMethod = schemaClass.getMethod(setName, IntegerType.class);
    Method getMethod = schemaClass.getMethod(getName);

    setMethod.invoke(schema, it);
View Full Code Here

    if (type != null) {
      if (type.equals("Text")) {
        schema.getContent().addProperty(new TextType(metadata, prefix, attr.getLocalName(), attr.getValue()));
        added = true;
      } else if (type.equals("Integer")) {
        schema.getContent().addProperty(new IntegerType(metadata, prefix, attr.getLocalName(), attr.getValue()));
        added = true;
      } else if (type.equals("Boolean")) {
        schema.getContent().addProperty(new BooleanType(metadata, prefix, attr.getLocalName(), attr.getValue()));
        added = true;
      } else if (type.equals("Real")) {
View Full Code Here

      if (stype == XmpPropertyType.Text) {
        prop = new TextType(metadata, propertyName.getPrefix(),
            propertyName.getLocalPart(), reader.get()
            .getElementText());
      } else if (stype == XmpPropertyType.Integer) {
        prop = new IntegerType(metadata, propertyName.getPrefix(),
            propertyName.getLocalPart(), reader.get()
            .getElementText());
      } else if (stype == XmpPropertyType.Date) {
        prop = new DateType(metadata, propertyName.getPrefix(),
            propertyName.getLocalPart(), reader.get()
View Full Code Here

TOP

Related Classes of org.apache.padaf.xmpbox.type.IntegerType

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.