axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: ws-axis/java/test/saaj PackageTests.java
Date Tue, 10 Aug 2004 02:36:45 GMT
dims        2004/08/09 19:36:45

  Modified:    java/src/org/apache/axis/message Text.java
               java/test/message PackageTests.java
               java/test/saaj PackageTests.java
  Log:
  [PATCH] added default constrcutor, toString(), hashCode(), and equals() to Text class; added
null check to Text(CharacterData) constructor; added several new SAAJ-related tests
  from Springer, Ian P. <ian.springer@hp.com>
  
  Revision  Changes    Path
  1.12      +35 -2     ws-axis/java/src/org/apache/axis/message/Text.java
  
  Index: Text.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/message/Text.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Text.java	16 Jul 2004 16:05:04 -0000	1.11
  +++ Text.java	10 Aug 2004 02:36:45 -0000	1.12
  @@ -30,6 +30,10 @@
   public class Text extends NodeImpl implements javax.xml.soap.Text {
   
       public Text(org.w3c.dom.CharacterData data) {
  +        if ( data == null )
  +        {
  +           throw new IllegalArgumentException( "Text value may not be null." );
  +        }
           textRep = data;
       }
   
  @@ -42,6 +46,11 @@
           }
       }
   
  +    public Text()
  +    {
  +        this((String)null);
  +    }
  +
       /**
        * Retrieves whether this <CODE>Text</CODE> object
        * represents a comment.
  @@ -92,9 +101,9 @@
   
           // insert the first part again as a new node
           Text tailText = new Text(tailData);
  -        org.w3c.dom.Node myParent = (org.w3c.dom.Node)getParentNode();
  +        org.w3c.dom.Node myParent = getParentNode();
           if(myParent != null){
  -            org.w3c.dom.NodeList brothers = (org.w3c.dom.NodeList)myParent.getChildNodes();
  +            org.w3c.dom.NodeList brothers = myParent.getChildNodes();
               for(int i = 0;i  < brothers.getLength(); i++){
                   if(brothers.item(i).equals(this)){
                       myParent.insertBefore(tailText, this);
  @@ -179,4 +188,28 @@
       public void deleteData(int offset, int count) throws DOMException {
           textRep.deleteData(offset, count);
       }
  +
  +    public String toString()
  +    {
  +        return textRep.getNodeValue();
  +    }
  +
  +    public boolean equals( Object obj )
  +    {
  +        if ( !( obj instanceof Text ) )
  +        {
  +            return false;
  +        }
  +        return this == obj || hashCode() == obj.hashCode();
  +    }
  +
  +    public int hashCode()
  +    {
  +        if ( textRep == null )
  +        {
  +           return -1;
  +        }
  +        return ( textRep.getData() != null ? textRep.getData().hashCode() : 0 );
  +    }
  +
   }
  
  
  
  1.13      +1 -0      ws-axis/java/test/message/PackageTests.java
  
  Index: PackageTests.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/message/PackageTests.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- PackageTests.java	14 Mar 2004 16:58:41 -0000	1.12
  +++ PackageTests.java	10 Aug 2004 02:36:45 -0000	1.13
  @@ -44,6 +44,7 @@
           suite.addTestSuite(TestMessageSerialization.class);
           suite.addTestSuite(TestSOAPFault.class);
           suite.addTestSuite(TestMUValues.class);
  +        suite.addTestSuite(TestText.class);
    
           return suite;
       }
  
  
  
  1.11      +1 -0      ws-axis/java/test/saaj/PackageTests.java
  
  Index: PackageTests.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/saaj/PackageTests.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- PackageTests.java	8 Aug 2004 17:03:01 -0000	1.10
  +++ PackageTests.java	10 Aug 2004 02:36:45 -0000	1.11
  @@ -25,6 +25,7 @@
           suite.addTestSuite(test.saaj.TestPrefixes.class);
           suite.addTestSuite(test.saaj.TestSOAPFaults.class);
           suite.addTestSuite(test.saaj.TestDOM.class);
  +        suite.addTestSuite(test.saaj.TestSOAPElement.class);
           return suite;
       }
   }
  
  
  

Mime
View raw message