commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From morg...@apache.org
Subject cvs commit: jakarta-commons/latka/src/java/org/apache/commons/latka/jelly RequestBodyTag.java ValidateTag.java SuiteTag.java ParameterTag.java RequestTag.java SessionTag.java ParameterValueTag.java ParameterNameTag.java
Date Thu, 06 Feb 2003 17:09:19 GMT
morgand     2003/02/06 09:09:18

  Modified:    latka/src/java/org/apache/commons/latka/jelly/validators
                        HttpValidatorTagSupport.java
               latka/src/java/org/apache/commons/latka/jelly
                        RequestBodyTag.java ValidateTag.java SuiteTag.java
                        ParameterTag.java RequestTag.java SessionTag.java
                        ParameterValueTag.java ParameterNameTag.java
  Log:
  updated Latka tags with latest Jelly tag interfaces (even though
  Gump doesn't seem to care :)
  
  Revision  Changes    Path
  1.6       +4 -3      jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/validators/HttpValidatorTagSupport.java
  
  Index: HttpValidatorTagSupport.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/validators/HttpValidatorTagSupport.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- HttpValidatorTagSupport.java	17 Dec 2002 14:33:18 -0000	1.5
  +++ HttpValidatorTagSupport.java	6 Feb 2003 17:09:17 -0000	1.6
  @@ -61,6 +61,7 @@
   
   package org.apache.commons.latka.jelly.validators;
   
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   
  @@ -104,9 +105,9 @@
        * getValidator().  Override if necessary.
        * 
        * @param xmlOutput a place to write output
  -     * @exception Exception when any error occurs
  +     * @exception JellyTagException if the tag body could not be invoked
        */
  -    public void doTag(XMLOutput xmlOutput) throws Exception {
  +    public void doTag(XMLOutput xmlOutput) throws JellyTagException {
           invokeBody(xmlOutput);
           
           Validator validator = getValidator();
  
  
  
  1.3       +8 -6      jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/RequestBodyTag.java
  
  Index: RequestBodyTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/RequestBodyTag.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RequestBodyTag.java	7 Jan 2003 16:41:06 -0000	1.2
  +++ RequestBodyTag.java	6 Feb 2003 17:09:18 -0000	1.3
  @@ -61,6 +61,7 @@
   
   package org.apache.commons.latka.jelly;
   
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   
  @@ -76,15 +77,16 @@
       /**
        *
        * @param xmlOutput a place to write output
  -     * @throws Exception when any error occurs
  +     * @throws JellyTagException when the request body could not be obtained, or a tag
attempts
  +     *    to set a body for any HTTP method other than POST
        */
  -    public void doTag(XMLOutput xmlOutput) throws Exception {
  +    public void doTag(XMLOutput xmlOutput) throws JellyTagException {
   
           Request request = JellyUtils.getInstance().findParentRequest(this);
           
           int method = request.getMethod();
           if (method != Request.HTTP_METHOD_POST) {
  -            throw new LatkaException("Request bodies are only supported in POSTs");
  +            throw new JellyTagException("Request bodies are only supported in POSTs");
           }
   
           request.setRequestBody(getBodyText());
  
  
  
  1.6       +13 -6     jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/ValidateTag.java
  
  Index: ValidateTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/ValidateTag.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ValidateTag.java	7 Jan 2003 16:41:06 -0000	1.5
  +++ ValidateTag.java	6 Feb 2003 17:09:18 -0000	1.6
  @@ -61,6 +61,7 @@
   
   package org.apache.commons.latka.jelly;
   
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   
  @@ -77,12 +78,18 @@
        *  make sure the request executes, then call validators.
        *
        * @param xmlOutput a place to write output
  -     * @throws Exception when any error occurs
  +     * @throws JellyTagException if the body of the tag could not be invoked, or an HTTP
  +     *    response could not be obtained
        */
  -    public void doTag(XMLOutput xmlOutput) throws Exception {
  +    public void doTag(XMLOutput xmlOutput) throws JellyTagException {
   
           // execute the request
  -        Response response = getResponse();
  +        Response response = null;
  +        try {
  +            response = getResponse();
  +        } catch (LatkaException e) {
  +            throw new JellyTagException("could not obtain HTTP response",e);
  +        }
   
           // perform the validations, skip the validations
           // if a response could not be obtained
  
  
  
  1.22      +21 -11    jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/SuiteTag.java
  
  Index: SuiteTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/SuiteTag.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- SuiteTag.java	18 Oct 2002 19:52:12 -0000	1.21
  +++ SuiteTag.java	6 Feb 2003 17:09:18 -0000	1.22
  @@ -61,9 +61,11 @@
   
   package org.apache.commons.latka.jelly;
   
  +import java.io.IOException;
   import java.util.HashMap;
   import java.util.Map;
   
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   
  @@ -94,9 +96,10 @@
        *  Wraps Latka tests, provides some defaults for host, port etc.
        *
        * @param xmlOutput a place to write output
  -     * @throws Exception when any error occurs
  +     * @throws JellyTagException if the suite fails, either as a result of test failures
  +     *    or from problems executing tags, generating reports, etc.
        */
  -    public void doTag(XMLOutput xmlOutput) throws Exception {
  +    public void doTag(XMLOutput xmlOutput) throws JellyTagException {
           // if an enclosing tag does not specify a listener, provide a default
           boolean defaultListener = false;
           LatkaEventListener listener = null;
  @@ -123,14 +126,21 @@
           JellyUtils.getInstance().removeLatkaEventInfo(getContext());
   
           if (defaultListener == true) {
  -            Latka latka = new Latka();
  -            String transformedReport = 
  -              latka.transformXML(((XMLReporter) listener).getDocumentAsString());
  -
  -            System.out.println(transformedReport);
  +            
  +            try {
  +                Latka latka = new Latka();
  +                String transformedReport = 
  +                  latka.transformXML(((XMLReporter) listener).getDocumentAsString());
  +
  +                System.out.println(transformedReport);
  +            } catch (LatkaException e) {
  +                throw new JellyTagException("could not generate latka report",e);
  +            } catch (IOException e) {
  +                throw new JellyTagException("could not generate latka report",e);
  +            }
   
               if (eventInfo.didSuiteSucceed() == false) {
  -                throw new LatkaException("SUITE FAILED");
  +                throw new JellyTagException("SUITE FAILED");
               }
           }
   
  
  
  
  1.8       +6 -5      jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/ParameterTag.java
  
  Index: ParameterTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/ParameterTag.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ParameterTag.java	7 Jan 2003 16:41:06 -0000	1.7
  +++ ParameterTag.java	6 Feb 2003 17:09:18 -0000	1.8
  @@ -61,6 +61,7 @@
   
   package org.apache.commons.latka.jelly;
   
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   
  @@ -79,9 +80,9 @@
        *  
        *
        * @param xmlOutput a place to write output
  -     * @throws Exception when any error occurs
  +     * @throws JellyTagException if the ParameterName or ParameterValue tags could not
be invoked
        */
  -    public void doTag(XMLOutput xmlOutput) throws Exception {
  +    public void doTag(XMLOutput xmlOutput) throws JellyTagException {
   
           invokeBody(xmlOutput);
   
  
  
  
  1.11      +17 -7     jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/RequestTag.java
  
  Index: RequestTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/RequestTag.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- RequestTag.java	7 Jan 2003 16:41:06 -0000	1.10
  +++ RequestTag.java	6 Feb 2003 17:09:18 -0000	1.11
  @@ -64,6 +64,7 @@
   import java.io.IOException;
   import java.net.URL;
   
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   
  @@ -108,10 +109,14 @@
        *  Wraps Latka tests, provides some defaults for host, port etc.
        *
        * @param xmlOutput a place to write output
  -     * @throws Exception when any error occurs
  +     * @throws JellyTagException if an HTTP request could not be created
        */
  -    public void doTag(XMLOutput xmlOutput) throws Exception {
  -        _request = createRequest();
  +    public void doTag(XMLOutput xmlOutput) throws JellyTagException {
  +        try {
  +            _request = createRequest();
  +        } catch (LatkaException e) {
  +            throw new JellyTagException("could not create HTTP request",e);
  +        }
   
           LatkaEventInfo listener =
               JellyUtils.getInstance().getLatkaEventInfo(getContext());
  @@ -128,7 +133,12 @@
           
           // will throw an unrecoverable LatkaException if the request could not
           // be created, typically because of a malformed URL
  -        Response response = getResponse();
  +        Response response = null;
  +        try {
  +            response = getResponse();
  +        } catch (LatkaException e) {
  +            throw new JellyTagException("could not obtain HTTP response",e);
  +        }
           
           // if there's been a response, and the request has a label
           // make the response available to the jelly context
  
  
  
  1.13      +6 -5      jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/SessionTag.java
  
  Index: SessionTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/SessionTag.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- SessionTag.java	11 Oct 2002 22:02:12 -0000	1.12
  +++ SessionTag.java	6 Feb 2003 17:09:18 -0000	1.13
  @@ -63,6 +63,7 @@
   
   import java.util.Map;
   
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   
  @@ -83,9 +84,9 @@
        *  
        *
        * @param xmlOutput a place to write output
  -     * @throws Exception when any error occurs
  +     * @throws JellyTagException if the tag body could not be invoked
        */
  -    public void doTag(XMLOutput xmlOutput) throws Exception {
  +    public void doTag(XMLOutput xmlOutput) throws JellyTagException {
           _session = findSession(_sessionId);
           invokeBody(xmlOutput);
       }
  
  
  
  1.5       +6 -5      jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/ParameterValueTag.java
  
  Index: ParameterValueTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/ParameterValueTag.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ParameterValueTag.java	7 Jan 2003 16:41:06 -0000	1.4
  +++ ParameterValueTag.java	6 Feb 2003 17:09:18 -0000	1.5
  @@ -61,6 +61,7 @@
   
   package org.apache.commons.latka.jelly;
   
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   
  @@ -74,9 +75,9 @@
        *  
        *
        * @param xmlOutput a place to write output
  -     * @throws Exception when any error occurs
  +     * @throws JellyTagException if the paramter value could not be obtained from the body
        */
  -    public void doTag(XMLOutput xmlOutput) throws Exception {
  +    public void doTag(XMLOutput xmlOutput) throws JellyTagException {
   
           ParameterTag tag = (ParameterTag) findAncestorWithClass(ParameterTag.class);
           tag.setParamValue(getBodyText().trim());
  
  
  
  1.5       +6 -5      jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/ParameterNameTag.java
  
  Index: ParameterNameTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/ParameterNameTag.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ParameterNameTag.java	7 Jan 2003 16:34:05 -0000	1.4
  +++ ParameterNameTag.java	6 Feb 2003 17:09:18 -0000	1.5
  @@ -61,6 +61,7 @@
   
   package org.apache.commons.latka.jelly;
   
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   
  @@ -74,9 +75,9 @@
        *  
        *
        * @param xmlOutput a place to write output
  -     * @throws Exception when any error occurs
  +     * @throws JellyTagException if the body of the tag could not be obtained
        */
  -    public void doTag(XMLOutput xmlOutput) throws Exception {
  +    public void doTag(XMLOutput xmlOutput) throws JellyTagException {
   
           ParameterTag tag = (ParameterTag) findAncestorWithClass(ParameterTag.class);
           tag.setParamName(getBodyText().trim());
  
  
  

---------------------------------------------------------------------
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