commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: jakarta-commons/jelly/jelly-tags/xmlunit/src/test/org/apache/commons/jelly/tags/xmlunit TestJelly.java
Date Wed, 08 Sep 2004 04:52:34 GMT
dion        2004/09/07 21:52:34

  Modified:    jelly/jelly-tags/xmlunit/src/java/org/apache/commons/jelly/tags/xmlunit
                        XMLUnitTagLibrary.java ExpectedTag.java
                        AssertDocumentsEqualTag.java ActualTag.java
                        XMLUnitTagSupport.java
               jelly/jelly-tags/xmlunit/src/test/org/apache/commons/jelly/tags/xmlunit
                        TestJelly.java
  Log:
  detab
  
  Revision  Changes    Path
  1.3       +8 -8      jakarta-commons/jelly/jelly-tags/xmlunit/src/java/org/apache/commons/jelly/tags/xmlunit/XMLUnitTagLibrary.java
  
  Index: XMLUnitTagLibrary.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/xmlunit/src/java/org/apache/commons/jelly/tags/xmlunit/XMLUnitTagLibrary.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XMLUnitTagLibrary.java	25 Feb 2004 01:31:58 -0000	1.2
  +++ XMLUnitTagLibrary.java	8 Sep 2004 04:52:34 -0000	1.3
  @@ -1,12 +1,12 @@
   /*
    * Copyright 2002,2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
  - * 
  + *
    *      http://www.apache.org/licenses/LICENSE-2.0
  - * 
  + *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  @@ -20,10 +20,10 @@
   
   public class XMLUnitTagLibrary extends TagLibrary {
   
  -	public XMLUnitTagLibrary() {
  -		registerTag("assertDocumentsEqual", AssertDocumentsEqualTag.class);
  -		registerTag("actual", ActualTag.class);
  -		registerTag("expected", ExpectedTag.class);
  -	}
  +    public XMLUnitTagLibrary() {
  +        registerTag("assertDocumentsEqual", AssertDocumentsEqualTag.class);
  +        registerTag("actual", ActualTag.class);
  +        registerTag("expected", ExpectedTag.class);
  +    }
   
   }
  
  
  
  1.4       +14 -14    jakarta-commons/jelly/jelly-tags/xmlunit/src/java/org/apache/commons/jelly/tags/xmlunit/ExpectedTag.java
  
  Index: ExpectedTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/xmlunit/src/java/org/apache/commons/jelly/tags/xmlunit/ExpectedTag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ExpectedTag.java	25 Feb 2004 01:31:58 -0000	1.3
  +++ ExpectedTag.java	8 Sep 2004 04:52:34 -0000	1.4
  @@ -1,12 +1,12 @@
   /*
    * Copyright 2002,2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
  - * 
  + *
    *      http://www.apache.org/licenses/LICENSE-2.0
  - * 
  + *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  @@ -23,17 +23,17 @@
   
   public class ExpectedTag extends XMLUnitTagSupport {
   
  -	public void doTag(XMLOutput output) throws JellyTagException {
  -		Document expectedDocument = parseBody();
  +    public void doTag(XMLOutput output) throws JellyTagException {
  +        Document expectedDocument = parseBody();
   
  -		AssertDocumentsEqualTag assertTag =
  -			(AssertDocumentsEqualTag) findAncestorWithClass(AssertDocumentsEqualTag
  -				.class);
  -		assertTag.setExpected(expectedDocument);
  -	}
  -
  -	protected SAXReader createSAXReader() {
  -		return new SAXReader();
  -	}
  +        AssertDocumentsEqualTag assertTag =
  +            (AssertDocumentsEqualTag) findAncestorWithClass(AssertDocumentsEqualTag
  +                .class);
  +        assertTag.setExpected(expectedDocument);
  +    }
  +
  +    protected SAXReader createSAXReader() {
  +        return new SAXReader();
  +    }
   
   }
  
  
  
  1.4       +82 -82    jakarta-commons/jelly/jelly-tags/xmlunit/src/java/org/apache/commons/jelly/tags/xmlunit/AssertDocumentsEqualTag.java
  
  Index: AssertDocumentsEqualTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/xmlunit/src/java/org/apache/commons/jelly/tags/xmlunit/AssertDocumentsEqualTag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AssertDocumentsEqualTag.java	25 Feb 2004 01:31:58 -0000	1.3
  +++ AssertDocumentsEqualTag.java	8 Sep 2004 04:52:34 -0000	1.4
  @@ -1,12 +1,12 @@
   /*
    * Copyright 2002,2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
  - * 
  + *
    *      http://www.apache.org/licenses/LICENSE-2.0
  - * 
  + *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  @@ -33,52 +33,52 @@
    */
   public class AssertDocumentsEqualTag extends XMLUnitTagSupport {
   
  -	private Object actual;
  -	private Document actualDocument;
  +    private Object actual;
  +    private Document actualDocument;
   
  -	private Object expected;
  -	private Document expectedDocument;
  +    private Object expected;
  +    private Document expectedDocument;
   
  -	/**
  -	 * Controls whether whitespace differences are reported as differences.
  -	 * 
  -	 * Defaults to <code>false</code>, so if <code>trim</code> is
set to
  -	 * <code>false</code> whitespace differences are detected.
  -	 */
  -	private boolean ignoreWhitespace = false;
  -
  -	public void doTag(XMLOutput output) throws JellyTagException {
  -		invokeBody(output);
  -
  -		if (actual != null) {
  -			if (actualDocument != null) {
  -				fail("Cannot specify both actual attribute and element");
  -			}
  -			actualDocument = parse(actual);
  -		}
  -
  -		if (expected != null) {
  -			if (expectedDocument != null) {
  -				fail("Cannot specify both expected attribute and element");
  -			}
  -			expectedDocument = parse(expected);
  -		}
  -
  -		if ((expectedDocument == null
  -			|| expectedDocument.getRootElement() == null)
  -			&& (actualDocument == null
  -				|| actualDocument.getRootElement() == null)) {
  -			return;
  -		}
  -
  -		if (actualDocument != null) {
  -			XMLUnit.setIgnoreWhitespace(ignoreWhitespace);
  -            
  -			Diff delta = null;
  +    /**
  +     * Controls whether whitespace differences are reported as differences.
  +     *
  +     * Defaults to <code>false</code>, so if <code>trim</code>
is set to
  +     * <code>false</code> whitespace differences are detected.
  +     */
  +    private boolean ignoreWhitespace = false;
  +
  +    public void doTag(XMLOutput output) throws JellyTagException {
  +        invokeBody(output);
  +
  +        if (actual != null) {
  +            if (actualDocument != null) {
  +                fail("Cannot specify both actual attribute and element");
  +            }
  +            actualDocument = parse(actual);
  +        }
  +
  +        if (expected != null) {
  +            if (expectedDocument != null) {
  +                fail("Cannot specify both expected attribute and element");
  +            }
  +            expectedDocument = parse(expected);
  +        }
  +
  +        if ((expectedDocument == null
  +            || expectedDocument.getRootElement() == null)
  +            && (actualDocument == null
  +                || actualDocument.getRootElement() == null)) {
  +            return;
  +        }
  +
  +        if (actualDocument != null) {
  +            XMLUnit.setIgnoreWhitespace(ignoreWhitespace);
  +
  +            Diff delta = null;
               try {
  -				delta = XMLUnit.compare(
  -					expectedDocument.asXML(),
  -					actualDocument.asXML());
  +                delta = XMLUnit.compare(
  +                    expectedDocument.asXML(),
  +                    actualDocument.asXML());
               }
               catch (SAXException e) {
                   throw new JellyTagException(e);
  @@ -89,41 +89,41 @@
               catch (ParserConfigurationException e) {
                   throw new JellyTagException(e);
               }
  -            
  -			if (delta.identical()) {
  -				return;
  -			}
  -			fail(delta.toString());
  -		}
  -	}
  -
  -	/**
  -	 * Sets the actual XML document which is either a Document, String (of an
  -	 * URI), URI, Reader, or InputStream.
  -	 */
  -	public void setActual(Object actual) {
  -		this.actual = actual;
  -	}
  -
  -	/**
  -	 * Sets the expected XML document which is either a Document, String (of an
  -	 * URI), URI, Reader, or InputStream.
  -	 */
  -	public void setExpected(Object expected) {
  -		this.expected = expected;
  -	}
  -
  -	/**
  -	 * Controls whether whitespace differences should be interpreted as
  -	 * differences or not.  The default is <code>false</code>.  Note that the
  -	 * use of the <code>trim</code> attribute is crucial here.
  -	 */
  -	public void setIgnoreWhitespace(boolean ignoreWhitespace) {
  -		this.ignoreWhitespace = ignoreWhitespace;
  -	}
  -
  -	protected SAXReader createSAXReader() {
  -		return new SAXReader();
  -	}
  +
  +            if (delta.identical()) {
  +                return;
  +            }
  +            fail(delta.toString());
  +        }
  +    }
  +
  +    /**
  +     * Sets the actual XML document which is either a Document, String (of an
  +     * URI), URI, Reader, or InputStream.
  +     */
  +    public void setActual(Object actual) {
  +        this.actual = actual;
  +    }
  +
  +    /**
  +     * Sets the expected XML document which is either a Document, String (of an
  +     * URI), URI, Reader, or InputStream.
  +     */
  +    public void setExpected(Object expected) {
  +        this.expected = expected;
  +    }
  +
  +    /**
  +     * Controls whether whitespace differences should be interpreted as
  +     * differences or not.  The default is <code>false</code>.  Note that the
  +     * use of the <code>trim</code> attribute is crucial here.
  +     */
  +    public void setIgnoreWhitespace(boolean ignoreWhitespace) {
  +        this.ignoreWhitespace = ignoreWhitespace;
  +    }
  +
  +    protected SAXReader createSAXReader() {
  +        return new SAXReader();
  +    }
   
   }
  
  
  
  1.4       +14 -14    jakarta-commons/jelly/jelly-tags/xmlunit/src/java/org/apache/commons/jelly/tags/xmlunit/ActualTag.java
  
  Index: ActualTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/xmlunit/src/java/org/apache/commons/jelly/tags/xmlunit/ActualTag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ActualTag.java	25 Feb 2004 01:31:58 -0000	1.3
  +++ ActualTag.java	8 Sep 2004 04:52:34 -0000	1.4
  @@ -1,12 +1,12 @@
   /*
    * Copyright 2002,2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
  - * 
  + *
    *      http://www.apache.org/licenses/LICENSE-2.0
  - * 
  + *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  @@ -23,16 +23,16 @@
   
   public class ActualTag extends XMLUnitTagSupport {
   
  -	public void doTag(XMLOutput output) throws JellyTagException {
  -		Document actualDocument = parseBody();
  +    public void doTag(XMLOutput output) throws JellyTagException {
  +        Document actualDocument = parseBody();
   
  -		AssertDocumentsEqualTag assertTag =
  -			(AssertDocumentsEqualTag) findAncestorWithClass(AssertDocumentsEqualTag
  -				.class);
  -		assertTag.setActual(actualDocument);
  -	}
  -
  -	protected SAXReader createSAXReader() {
  -		return new SAXReader();
  -	}
  +        AssertDocumentsEqualTag assertTag =
  +            (AssertDocumentsEqualTag) findAncestorWithClass(AssertDocumentsEqualTag
  +                .class);
  +        assertTag.setActual(actualDocument);
  +    }
  +
  +    protected SAXReader createSAXReader() {
  +        return new SAXReader();
  +    }
   }
  
  
  
  1.4       +59 -59    jakarta-commons/jelly/jelly-tags/xmlunit/src/java/org/apache/commons/jelly/tags/xmlunit/XMLUnitTagSupport.java
  
  Index: XMLUnitTagSupport.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/xmlunit/src/java/org/apache/commons/jelly/tags/xmlunit/XMLUnitTagSupport.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XMLUnitTagSupport.java	25 Feb 2004 01:31:58 -0000	1.3
  +++ XMLUnitTagSupport.java	8 Sep 2004 04:52:34 -0000	1.4
  @@ -1,12 +1,12 @@
   /*
    * Copyright 2002,2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
  - * 
  + *
    *      http://www.apache.org/licenses/LICENSE-2.0
  - * 
  + *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  @@ -31,72 +31,72 @@
   
   public abstract class XMLUnitTagSupport extends AssertTagSupport {
   
  -	/** The SAXReader used to parser the document */
  -	private SAXReader saxReader;
  +    /** The SAXReader used to parser the document */
  +    private SAXReader saxReader;
   
  -	/** @return the SAXReader used for parsing, creating one lazily if need be  */
  -	public SAXReader getSAXReader() {
  -		if (saxReader == null) {
  -			saxReader = createSAXReader();
  -		}
  -		return saxReader;
  -	}
  -
  -	/** Sets the SAXReader used for parsing */
  -	public void setSAXReader(SAXReader saxReader) {
  -		this.saxReader = saxReader;
  -	}
  -
  -	/**
  -	 * Factory method to create a new SAXReader
  -	 */
  -	protected abstract SAXReader createSAXReader();
  -
  -	/**
  -	 * Parses the body of this tag and returns the parsed document
  -	 */
  -	protected Document parseBody() throws JellyTagException {
  -		SAXContentHandler handler = new SAXContentHandler();
  -		XMLOutput newOutput = new XMLOutput(handler);
  +    /** @return the SAXReader used for parsing, creating one lazily if need be  */
  +    public SAXReader getSAXReader() {
  +        if (saxReader == null) {
  +            saxReader = createSAXReader();
  +        }
  +        return saxReader;
  +    }
  +
  +    /** Sets the SAXReader used for parsing */
  +    public void setSAXReader(SAXReader saxReader) {
  +        this.saxReader = saxReader;
  +    }
  +
  +    /**
  +     * Factory method to create a new SAXReader
  +     */
  +    protected abstract SAXReader createSAXReader();
  +
  +    /**
  +     * Parses the body of this tag and returns the parsed document
  +     */
  +    protected Document parseBody() throws JellyTagException {
  +        SAXContentHandler handler = new SAXContentHandler();
  +        XMLOutput newOutput = new XMLOutput(handler);
           try {
               handler.startDocument();
  -		    invokeBody(newOutput);
  -		    handler.endDocument();
  -        } 
  +            invokeBody(newOutput);
  +            handler.endDocument();
  +        }
           catch (SAXException e) {
               throw new JellyTagException(e);
           }
  -		return handler.getDocument();
  -	}
  +        return handler.getDocument();
  +    }
   
  -	/**
  -	 * Parses the given source
  -	 */
  -	protected Document parse(Object source) throws JellyTagException {
  +    /**
  +     * Parses the given source
  +     */
  +    protected Document parse(Object source) throws JellyTagException {
           try {
  -		    if (source instanceof Document) {
  -		        return (Document) source;
  -		    } else if (source instanceof String) {
  -		    	String uri = (String) source;
  -		    	InputStream in = context.getResourceAsStream(uri);
  -		    	return getSAXReader().read(in, uri);
  -		    } else if (source instanceof Reader) {
  -		    	return getSAXReader().read((Reader) source);
  -		    } else if (source instanceof InputStream) {
  -		    	return getSAXReader().read((InputStream) source);
  -		    } else if (source instanceof URL) {
  -		    	return getSAXReader().read((URL) source);
  -		    } else {
  -		    	throw new IllegalArgumentException(
  -		    		"Invalid source argument. Must be a Document, String, Reader, InputStream or URL."
  -		    			+ " Was type: "
  -		    			+ source.getClass().getName()
  -		    			+ " with value: "
  -		    			+ source);
  -		    }
  +            if (source instanceof Document) {
  +                return (Document) source;
  +            } else if (source instanceof String) {
  +                String uri = (String) source;
  +                InputStream in = context.getResourceAsStream(uri);
  +                return getSAXReader().read(in, uri);
  +            } else if (source instanceof Reader) {
  +                return getSAXReader().read((Reader) source);
  +            } else if (source instanceof InputStream) {
  +                return getSAXReader().read((InputStream) source);
  +            } else if (source instanceof URL) {
  +                return getSAXReader().read((URL) source);
  +            } else {
  +                throw new IllegalArgumentException(
  +                    "Invalid source argument. Must be a Document, String, Reader, InputStream
or URL."
  +                        + " Was type: "
  +                        + source.getClass().getName()
  +                        + " with value: "
  +                        + source);
  +            }
           }
           catch (DocumentException e) {
               throw new JellyTagException(e);
           }
  -	}
  +    }
   }
  
  
  
  1.3       +10 -10    jakarta-commons/jelly/jelly-tags/xmlunit/src/test/org/apache/commons/jelly/tags/xmlunit/TestJelly.java
  
  Index: TestJelly.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/jelly-tags/xmlunit/src/test/org/apache/commons/jelly/tags/xmlunit/TestJelly.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestJelly.java	25 Feb 2004 01:31:59 -0000	1.2
  +++ TestJelly.java	8 Sep 2004 04:52:34 -0000	1.3
  @@ -1,12 +1,12 @@
   /*
    * Copyright 2002,2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
  - * 
  + *
    *      http://www.apache.org/licenses/LICENSE-2.0
  - * 
  + *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  @@ -23,12 +23,12 @@
   
   public class TestJelly extends JellyTestSuite {
   
  -	public static void main(String[] args) throws Exception {
  -		TestRunner.run(suite());
  -	}
  -
  -	public static TestSuite suite() throws Exception {
  -		return createTestSuite(TestJelly.class, "suite.jelly");
  -	}
  +    public static void main(String[] args) throws Exception {
  +        TestRunner.run(suite());
  +    }
  +
  +    public static TestSuite suite() throws Exception {
  +        return createTestSuite(TestJelly.class, "suite.jelly");
  +    }
   
   }
  
  
  

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


Mime
View raw message