Ejemplo n.º 1
0
 public void testAddInlineProperties2() throws JaxenException {
   PropertyHolderImpl phi = new PropertyHolderImpl();
   PropertyImpl pi1 = new PropertyImpl();
   pi1.setName("BiLd");
   pi1.setValue("/path");
   phi.setProperties(new Property[] {pi1});
   PropertyUtils.addInlineProperties(elm, phi.getProperties());
   assertNodeCount(elm, "property[@name='image' and @value='/path']", 1);
 }
Ejemplo n.º 2
0
 /*
  * in: name="name1" value="value1"
  * out: <property name="name1" value="value1"/>
  */
 public void testAddProperties1() throws JaxenException {
   PropertyHolderImpl phi = new PropertyHolderImpl();
   PropertyImpl pi = new PropertyImpl();
   pi.setName("color");
   pi.setValue("red");
   phi.setProperties(new Property[] {pi});
   PropertyUtils.addProperties(elm, phi.getProperties());
   assertNodeCount(elm, "property[@name='color' and @value='red']", 1);
 }
Ejemplo n.º 3
0
  /*
   * in: name="img/href" value="a"
   *     name="image/src" value="b"
   *
   * out:
   * <property name="image">
   *   <property name="href" value="a"/>
   *   <property name="src" value="b"/>
   * </property>
   */
  public void testAddProperties2() throws JaxenException {
    PropertyHolderImpl phi = new PropertyHolderImpl();

    PropertyImpl p1 = new PropertyImpl();
    p1.setName("image.href");
    p1.setValue("a");

    PropertyImpl p2 = new PropertyImpl();
    p2.setName("image.src");
    p2.setValue("b");

    phi.setProperties(new Property[] {p1, p2});
    PropertyUtils.addProperties(elm, phi.getProperties());

    // XmlUtils.print(doc, new PrintWriter(System.out));

    assertNodeCount(elm, "property[@name='image']", 1);
    assertNodeCount(elm, "property", 1);
    assertNodeCount(elm, "property/property[@name='href' and @value='a']", 1);
    assertNodeCount(elm, "property/property[@name='src' and @value='b']", 1);
  }
Ejemplo n.º 4
0
  /*
   * in: name="LiNk" value="VaLuE"
   * out: <property name="link" value="VaLuE"/>
   */
  public void testAddInlineProperties() throws JaxenException {
    PropertyHolderImpl phi = new PropertyHolderImpl();
    // pi1 = inline property
    PropertyImpl pi1 = new PropertyImpl();
    pi1.setName("LiNk");
    pi1.setValue("VaLuE");

    // pi2 = !inline property
    PropertyImpl pi2 = new PropertyImpl();
    pi2.setName("NoLiNk");
    pi2.setValue("NoVaLuE");

    phi.setProperties(new Property[] {pi1, pi2});
    PropertyUtils.addInlineProperties(elm, phi.getProperties());
    assertNodeCount(elm, "property[@name='link' and @value='VaLuE']", 1);
    assertNodeCount(elm, "property[@name='LiNk']", 0);
    assertNodeCount(elm, "property[@name='NoLiNk']", 0);

    PropertyUtils.addProperties(elm, phi.getProperties());
    assertNodeCount(elm, "property[@name='LiNk']", 1);
    assertNodeCount(elm, "property[@name='NoLiNk']", 1);
  }
Ejemplo n.º 5
0
  public static void addProperties(CellImpl c, int i) {
    Property[] props = new Property[1];
    PropertyImpl p = new PropertyImpl();
    props[0] = p;

    switch ((i / 2) % 10) {
      case 0:
        p.setName("arrow");
        p.setValue("up");
        break;
      case 1:
        p.setName("arrow");
        p.setValue("down");
        break;
      case 2:
        p.setName("arrow");
        p.setValue("none");
        break;
      case 4:
        p.setName("style");
        p.setValue("red");
        break;
      case 5:
        p.setName("style");
        p.setValue("yellow");
        break;
      case 6:
        p.setName("style");
        p.setValue("green");
        break;
      default:
        break;
    }
    p.setLabel(p.getName());

    c.setProperties(props);
  }