commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmi...@apache.org
Subject cvs commit: jakarta-commons/jxpath/src/test/org/apache/commons/jxpath NestedTestBean.java JXPathTest.java
Date Sun, 13 Oct 2002 03:25:48 GMT
dmitri      2002/10/12 20:25:48

  Modified:    jxpath/src/test/org/apache/commons/jxpath
                        NestedTestBean.java JXPathTest.java
  Log:
  Incorporated test case from bug report 13380
  
  Revision  Changes    Path
  1.4       +8 -4      jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/NestedTestBean.java
  
  Index: NestedTestBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/NestedTestBean.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- NestedTestBean.java	12 Apr 2002 02:28:06 -0000	1.3
  +++ NestedTestBean.java	13 Oct 2002 03:25:48 -0000	1.4
  @@ -78,6 +78,10 @@
           this.name = name;
       }
   
  +    public void setName(String name){
  +        this.name = name;
  +    }
  +
       /**
        * A read-only boolean property
        */
  
  
  
  1.2       +36 -4     jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/JXPathTest.java
  
  Index: JXPathTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/JXPathTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JXPathTest.java	13 Oct 2002 03:01:03 -0000	1.1
  +++ JXPathTest.java	13 Oct 2002 03:25:48 -0000	1.2
  @@ -455,6 +455,38 @@
           assertEquals("Iterating <" + "beans/int" + ">", list(new Integer(5), new
Integer(6)), actual);
       }
   
  +    public void testIteratePointerSetValue() {
  +        JXPathContext context = JXPathContext.newContext(bean);
  +
  +        testGetValue(context, "/beans[1]/name", "Name 1");
  +        testGetValue(context, "/beans[2]/name", "Name 2");
  +
  +        // Test setting via context
  +        context.setValue("/beans[2]/name", "Name 2 set");
  +        testGetValue(context, "/beans[2]/name", "Name 2 set");
  +
  +        // Restore original value
  +        context.setValue("/beans[2]/name", "Name 2");
  +        testGetValue(context, "/beans[2]/name", "Name 2");
  +
  +        int iter_count = 0;
  +        Iterator iter = context.iteratePointers("/beans/name");
  +        while (iter.hasNext()) {
  +            iter_count++;
  +            Pointer pointer = (Pointer) iter.next();
  +            String s = (String) pointer.getValue();
  +            s = s + "suffix";
  +            pointer.setValue(s);
  +            assertEquals("pointer.getValue", s, pointer.getValue());
  +            // fails right here, the value isn't getting set in the bean.
  +            assertEquals("context.getValue", s, context.getValue(pointer.asPath()));
  +        }
  +        assertEquals("Iteration count", 2, iter_count);
  +
  +        testGetValue(context, "/beans[1]/name", "Name 1suffix");
  +        testGetValue(context, "/beans[2]/name", "Name 2suffix");
  +    }
  +
       /**
        * Test JXPath.getValue() with variables
        */
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message