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/resources org.apache.commons.latka.report.xsl
Date Mon, 29 Apr 2002 18:20:22 GMT
morgand     02/04/29 11:20:21

  Modified:    latka/src/distribution/conf report.dtd suite.ent
               latka/src/java/org/apache/commons/latka
                        AbstractReporter.java XMLReporter.java
               latka/src/java/org/apache/commons/latka/event
                        LatkaEventListener.java LatkaEventPublisher.java
               latka/src/java/org/apache/commons/latka/junit
                        JUnitEventReporter.java JUnitTestAdapter.java
               latka/src/java/org/apache/commons/latka/xml
                        SessionHandler.java SuiteHandler.java
               latka/src/resources org.apache.commons.latka.report.xsl
  Added:       latka/src/java/org/apache/commons/latka/event
                        ReportMessageEvent.java
  Log:
  added reportMessage tag to suite and report DTDs
  
  Revision  Changes    Path
  1.2       +4 -1      jakarta-commons/latka/src/distribution/conf/report.dtd
  
  Index: report.dtd
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/latka/src/distribution/conf/report.dtd,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- report.dtd	22 Apr 2002 15:48:34 -0000	1.1
  +++ report.dtd	29 Apr 2002 18:20:21 -0000	1.2
  @@ -1,8 +1,11 @@
   <?xml encoding="UTF-8" ?>
   
  -<!ELEMENT report (request+)>
  +<!ELEMENT report ( (request | reportMessage)+ )>
   <!ATTLIST report suiteSuccess (true|false) #REQUIRED
                    label         CDATA        #IMPLIED>
  +
  +<!ELEMENT reportMessage EMPTY>
  +<!ATTLIST reportMessage message CDATA #REQUIRED>
   
   <!ELEMENT request (requestSuccess | requestFailure |
                      requestSkipped | requestError)>
  
  
  
  1.3       +6 -2      jakarta-commons/latka/src/distribution/conf/suite.ent
  
  Index: suite.ent
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/latka/src/distribution/conf/suite.ent,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- suite.ent	27 Apr 2002 17:47:39 -0000	1.2
  +++ suite.ent	29 Apr 2002 18:20:21 -0000	1.3
  @@ -7,14 +7,18 @@
   <!ENTITY % tests.ent SYSTEM "tests.ent">
   %tests.ent;
   
  -<!ELEMENT suite ( (session | request)+ )>
  +<!ELEMENT suite ( (session | request | reportMessage)+ )>
   <!ATTLIST suite defaultHost  CDATA #IMPLIED
                   defaultPort  CDATA #IMPLIED
                   defaultProxyHost    CDATA #IMPLIED
                   defaultProxyPort    CDATA #IMPLIED
                   label        CDATA #IMPLIED>
  +                
  +<!-- prints out a message to the log generated by the test -->
  +<!ELEMENT reportMessage EMPTY>
  +<!ATTLIST reportMessage message CDATA #REQUIRED>
   
  -<!ELEMENT session (request+)>
  +<!ELEMENT session ( (request | reportMessage)+)>
   <!-- tests that use the same session_id share the same environment -->
   <!ATTLIST session sessionId CDATA #IMPLIED
                     label      CDATA #IMPLIED>
  
  
  
  1.18      +1 -5      jakarta-commons/latka/src/java/org/apache/commons/latka/AbstractReporter.java
  
  Index: AbstractReporter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/AbstractReporter.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- AbstractReporter.java	11 Apr 2002 13:54:02 -0000	1.17
  +++ AbstractReporter.java	29 Apr 2002 18:20:21 -0000	1.18
  @@ -1,8 +1,4 @@
   /*
  - *
  - *
  - *
  - *
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
  @@ -80,7 +76,7 @@
    *
    * @author Rodney Waldhoff
    * @author Morgan Delagrange
  - * @version $Revision: 1.17 $
  + * @version $Revision: 1.18 $
    */
   public abstract class AbstractReporter implements LatkaEventInfo {
   
  
  
  
  1.18      +8 -5      jakarta-commons/latka/src/java/org/apache/commons/latka/XMLReporter.java
  
  Index: XMLReporter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/XMLReporter.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- XMLReporter.java	11 Apr 2002 13:54:02 -0000	1.17
  +++ XMLReporter.java	29 Apr 2002 18:20:21 -0000	1.18
  @@ -1,8 +1,4 @@
   /*
  - *
  - *
  - *
  - *
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
  @@ -67,6 +63,7 @@
   import java.io.StringWriter;
   // latka imports
   import org.apache.commons.latka.http.Request;
  +import org.apache.commons.latka.event.ReportMessageEvent;
   import org.apache.commons.latka.event.RequestErrorEvent;
   import org.apache.commons.latka.event.RequestEvent;
   import org.apache.commons.latka.event.RequestFailedEvent;
  @@ -87,7 +84,7 @@
    *
    * @author Morgan Delagrange
    * @author dIon Gillard
  - * @version $Id: XMLReporter.java,v 1.17 2002/04/11 13:54:02 dion Exp $
  + * @version $Id: XMLReporter.java,v 1.18 2002/04/29 18:20:21 morgand Exp $
    */
   public class XMLReporter extends AbstractReporter {
       /** JDOM document produced as output */
  @@ -218,6 +215,12 @@
           _rootElement.addContent(createRequestElement(event)
                                   .addContent(new Element("requestSkipped")));
   
  +    }
  +
  +    public void reportMessage(ReportMessageEvent event) {
  +        Element messageElement = new Element("reportMessage")
  +          .setAttribute("message",event.getMessage());
  +        _rootElement.addContent(messageElement);
       }
   
       /**
  
  
  
  1.11      +10 -5     jakarta-commons/latka/src/java/org/apache/commons/latka/event/LatkaEventListener.java
  
  Index: LatkaEventListener.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/event/LatkaEventListener.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- LatkaEventListener.java	11 Apr 2002 13:33:35 -0000	1.10
  +++ LatkaEventListener.java	29 Apr 2002 18:20:21 -0000	1.11
  @@ -1,8 +1,4 @@
   /*
  - *
  - *
  - *
  - *
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
  @@ -67,7 +63,7 @@
    * @author Rodney Waldhoff
    * @author Morgan Delagrange
    * @author dIon Gillard
  - * @version $Id: LatkaEventListener.java,v 1.10 2002/04/11 13:33:35 dion Exp $
  + * @version $Id: LatkaEventListener.java,v 1.11 2002/04/29 18:20:21 morgand Exp $
    */
   public interface LatkaEventListener {
   
  @@ -110,6 +106,15 @@
       *               response.
       */
      public void requestError(RequestEvent event);
  +
  +   /**
  +    * Invoked if a Latka suite wants to send a message to the 
  +    * report generated for the test.  Some implementations
  +    * of the LatkaEventListener may not generate reports.
  +    * 
  +    * @param event  Event containing the report message
  +    */
  +   public void reportMessage(ReportMessageEvent event);
   
      /**
       * Invoke when all requests completed.
  
  
  
  1.9       +9 -6      jakarta-commons/latka/src/java/org/apache/commons/latka/event/LatkaEventPublisher.java
  
  Index: LatkaEventPublisher.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/event/LatkaEventPublisher.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- LatkaEventPublisher.java	11 Apr 2002 13:59:49 -0000	1.8
  +++ LatkaEventPublisher.java	29 Apr 2002 18:20:21 -0000	1.9
  @@ -1,8 +1,4 @@
   /*
  - *
  - *
  - *
  - *
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
  @@ -71,7 +67,7 @@
    * 
    * @author Morgan Delagrange
    * @author <a href="mailto:dion@multitask.com.au">dIon Gillard</a>
  - * @version $Id: LatkaEventPublisher.java,v 1.8 2002/04/11 13:59:49 dion Exp $
  + * @version $Id: LatkaEventPublisher.java,v 1.9 2002/04/29 18:20:21 morgand Exp $
    */
   public class LatkaEventPublisher implements LatkaEventListener {
       
  @@ -114,7 +110,9 @@
               listener.requestError((RequestEvent) event);
           } else if (event instanceof SuiteCompletedEvent) {
               listener.suiteCompleted((SuiteEvent) event);
  -        }    
  +        } else if (event instanceof ReportMessageEvent) {
  +            listener.reportMessage((ReportMessageEvent) event);
  +        }
       }
   
       /**
  @@ -149,6 +147,10 @@
           broadcastEvent(event);
       }
   
  +    public void reportMessage(ReportMessageEvent event) {
  +        broadcastEvent(event);
  +    }
  +
       /**
        * send the supplied event to all listeners
        * @param event an event to be broadcast
  @@ -156,4 +158,5 @@
       public void suiteCompleted(SuiteEvent event) {
           broadcastEvent(event);
       }
  +
   }
  
  
  
  1.1                  jakarta-commons/latka/src/java/org/apache/commons/latka/event/ReportMessageEvent.java
  
  Index: ReportMessageEvent.java
  ===================================================================
  /*
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  package org.apache.commons.latka.event;
  
  public class ReportMessageEvent implements LatkaEvent {
  
      private String _message = null;
  
      public ReportMessageEvent(String message) {
          _message = message;
      }
  
      public String getMessage() {
          return _message;
      }
  
  }
  
  
  
  1.7       +12 -5     jakarta-commons/latka/src/java/org/apache/commons/latka/junit/JUnitEventReporter.java
  
  Index: JUnitEventReporter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/junit/JUnitEventReporter.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- JUnitEventReporter.java	11 Apr 2002 13:41:58 -0000	1.6
  +++ JUnitEventReporter.java	29 Apr 2002 18:20:21 -0000	1.7
  @@ -1,8 +1,4 @@
   /*
  - *
  - *
  - *
  - *
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
  @@ -63,6 +59,7 @@
   
   import org.apache.commons.latka.AbstractReporter;
   import org.apache.commons.latka.ValidationException;
  +import org.apache.commons.latka.event.ReportMessageEvent;
   import org.apache.commons.latka.event.RequestErrorEvent;
   import org.apache.commons.latka.event.RequestEvent;
   import org.apache.commons.latka.event.RequestFailedEvent;
  @@ -83,7 +80,7 @@
    *
    * @author Chuck Burdick
    * @author dIon Gillard
  - * @version $Id: JUnitEventReporter.java,v 1.6 2002/04/11 13:41:58 dion Exp $
  + * @version $Id: JUnitEventReporter.java,v 1.7 2002/04/29 18:20:21 morgand Exp $
    */
   public class JUnitEventReporter extends AbstractReporter {
       private static final Category _log = Category.getInstance(JUnitEventReporter.class);
  @@ -214,6 +211,16 @@
           super.requestSucceeded(event);
           Test test = new EventTestAdapter();
           test.run(_testResult);
  +    }
  +
  +    /**
  +     * This method is currently ignored by the JUnitEventReporter.
  +     * It may be implemented later.
  +     * 
  +     * @param event  reportMessage (ignored)
  +     */
  +    public void reportMessage(ReportMessageEvent event) {
  +
       }
   
       /**
  
  
  
  1.12      +2 -6      jakarta-commons/latka/src/java/org/apache/commons/latka/junit/JUnitTestAdapter.java
  
  Index: JUnitTestAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/junit/JUnitTestAdapter.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- JUnitTestAdapter.java	11 Apr 2002 13:41:58 -0000	1.11
  +++ JUnitTestAdapter.java	29 Apr 2002 18:20:21 -0000	1.12
  @@ -1,8 +1,4 @@
   /*
  - *
  - *
  - *
  - *
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
  @@ -93,7 +89,7 @@
    *
    * @author Chuck Burdick
    * @author dIon Gillard
  - * @version $Id: JUnitTestAdapter.java,v 1.11 2002/04/11 13:41:58 dion Exp $
  + * @version $Id: JUnitTestAdapter.java,v 1.12 2002/04/29 18:20:21 morgand Exp $
    */
   public class JUnitTestAdapter implements Test {
       /** log4j category that output is logged to */
  @@ -231,7 +227,7 @@
        *
        * @author Chuck Burdick
        * @author dIon Gillard
  -     * @version $Id: JUnitTestAdapter.java,v 1.11 2002/04/11 13:41:58 dion Exp $
  +     * @version $Id: JUnitTestAdapter.java,v 1.12 2002/04/29 18:20:21 morgand Exp $
        */
       private static class TestCounter extends DefaultHandler {
           /** number of requests (ie junit tests) */
  
  
  
  1.14      +6 -1      jakarta-commons/latka/src/java/org/apache/commons/latka/xml/SessionHandler.java
  
  Index: SessionHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/xml/SessionHandler.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- SessionHandler.java	11 Apr 2002 13:51:14 -0000	1.13
  +++ SessionHandler.java	29 Apr 2002 18:20:21 -0000	1.14
  @@ -64,6 +64,7 @@
   import java.util.Map;
   
   import org.apache.commons.latka.event.LatkaEventInfo;
  +import org.apache.commons.latka.event.ReportMessageEvent;
   import org.apache.commons.latka.http.SessionImpl;
   
   import org.apache.log4j.Category;
  @@ -77,7 +78,7 @@
    *
    * @author Morgan Delagrange
    * @author dIon Gillard
  - * @version $Id: SessionHandler.java,v 1.13 2002/04/11 13:51:14 dion Exp $
  + * @version $Id: SessionHandler.java,v 1.14 2002/04/29 18:20:21 morgand Exp $
    */
   public class SessionHandler extends LatkaHandler {
       /** listener to receive events as they occurr*/
  @@ -117,6 +118,10 @@
                   handler = new RequestHandler(_reader, _session, _listener);
               }
               handler.delegate(uri, localName, qName, atts);
  +        } else if (localName.equals("reportMessage")) {
  +            
  +            _listener.reportMessage(new ReportMessageEvent(atts.getValue("message")));
  +
           }
       }
       
  
  
  
  1.24      +6 -5      jakarta-commons/latka/src/java/org/apache/commons/latka/xml/SuiteHandler.java
  
  Index: SuiteHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/xml/SuiteHandler.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- SuiteHandler.java	11 Apr 2002 13:51:14 -0000	1.23
  +++ SuiteHandler.java	29 Apr 2002 18:20:21 -0000	1.24
  @@ -1,8 +1,4 @@
   /*
  - *
  - *
  - *
  - *
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
  @@ -67,6 +63,7 @@
   
   import org.apache.commons.latka.LatkaProperties;
   import org.apache.commons.latka.event.LatkaEventInfo;
  +import org.apache.commons.latka.event.ReportMessageEvent;
   import org.apache.commons.latka.event.SuiteCompletedEvent;
   import org.apache.commons.latka.http.SessionImpl;
   
  @@ -81,7 +78,7 @@
    *
    * @author Morgan Delagrange
    * @author dIon Gillard
  - * @version $Id: SuiteHandler.java,v 1.23 2002/04/11 13:51:14 dion Exp $
  + * @version $Id: SuiteHandler.java,v 1.24 2002/04/29 18:20:21 morgand Exp $
    */
   public class SuiteHandler extends LatkaHandler {
   
  @@ -140,6 +137,10 @@
               } else {
                   props.remove("latka.defaultPort");
               }
  +
  +        } else if (localName.equals("reportMessage")) {
  +            
  +            _listener.reportMessage(new ReportMessageEvent(atts.getValue("message")));
   
           } else if (localName.equals("session")) {
   
  
  
  
  1.2       +9 -3      jakarta-commons/latka/src/resources/org.apache.commons.latka.report.xsl
  
  Index: org.apache.commons.latka.report.xsl
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/latka/src/resources/org.apache.commons.latka.report.xsl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- org.apache.commons.latka.report.xsl	22 Apr 2002 15:49:41 -0000	1.1
  +++ org.apache.commons.latka.report.xsl	29 Apr 2002 18:20:21 -0000	1.2
  @@ -5,6 +5,7 @@
      <xsl:strip-space elements="*"/>
   
      <xsl:template match="/">
  +     <xsl:text>&#x0A;</xsl:text>
        <xsl:apply-templates/>
        <xsl:text>&#x0A;</xsl:text>
        Thank you very much.
  @@ -13,8 +14,9 @@
   
      <xsl:template match="report">
         <xsl:text>&#x0A;</xsl:text>
  -      <xsl:apply-templates select="//request[not(requestSuccess)]"/>
  +      <xsl:apply-templates select="//request[not(requestSuccess)] | reportMessage"/>
         <!-- <xsl:apply-templates select="//request"/> -->
  +      <xsl:text>&#x0A;</xsl:text>
         <xsl:call-template name="summary"/>
         <xsl:text>&#x0A;</xsl:text>
      </xsl:template>
  @@ -35,6 +37,11 @@
         <xsl:text>&#x0A;</xsl:text>
         <xsl:value-of select="count(//request/requestError)"/><xsl:text> errors.</xsl:text>
      </xsl:template>
  +   
  +   <xsl:template match="reportMessage">
  +      <xsl:text>[message] </xsl:text><xsl:value-of select="@message"/>
  +      <xsl:text>&#x0A;&#x0A;</xsl:text>
  +   </xsl:template>
   
      <xsl:template match="request">
         <xsl:value-of select="@url"/> <xsl:call-template name="label"/>
  @@ -44,8 +51,7 @@
            <xsl:text>(</xsl:text><xsl:value-of select="@requestTime"/><xsl:text>
millis)</xsl:text>
           </xsl:with-param>
         </xsl:apply-templates>
  -      <xsl:text>&#x0A;</xsl:text>
  -      <xsl:text>&#x0A;</xsl:text>
  +      <xsl:text>&#x0A;&#x0A;</xsl:text>
      </xsl:template>
   
      <xsl:template match="requestSuccess">
  
  
  

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