logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject cvs commit: logging-log4j/tests/webapps/Tata/src/WEB-INF web.xml
Date Fri, 11 Jun 2004 19:43:03 GMT
ceki        2004/06/11 12:43:03

  Modified:    tests    build.properties.sample
  Added:       tests/webapps/Tata build.properties.sample .cvsignore
                        build.xml
               tests/webapps/Titi build.xml .cvsignore
                        build.properties.sample titi.war
               tests/webapps/Titi/src/java/wombat InitServlet.java
                        XServlet.java
               tests/webapps/Util build.properties.sample .cvsignore
                        build.xml util.jar
               tests/webapps/Titi/src/html index.html
               tests/webapps/Util/src/java/wombat Util.java
               tests/webapps/Tata/src/java/wombat InitServlet.java
                        XServlet.java
               tests    servlet.xml
               tests/webapps/Tata/src/html index.html
               tests/webapps/Titi/src/WEB-INF web.xml
               tests/webapps/Tata/src/WEB-INF web.xml
  Log:
  Jetty based unit tests.
  
  At this time we are only testing JNDI behaviour in different web-apps
  
  Revision  Changes    Path
  1.1                  logging-log4j/tests/webapps/Tata/build.properties.sample
  
  Index: build.properties.sample
  ===================================================================
  # Sample build.properties file
  
  # We need servlet to compile the various servlets.
  servlet.jar=../../lib/javax.servlet.jar
  
  
  
  
  
  1.1                  logging-log4j/tests/webapps/Tata/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  classes
  build.properties
  tata.war
  
  
  1.1                  logging-log4j/tests/webapps/Tata/build.xml
  
  Index: build.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8" ?>
  
  <project name="Webapp Build Script" default="compile" basedir=".">
  
    <property environment="env"/>
  
    <!-- The build.properties file defines variables dependent of the host machine -->
    <property file="build.properties"/>
    
    <property name="log4j.home" value="${basedir}/../../.."/>
    <property name="src.dir" value="${basedir}/src/java/"/>
    <property name="javac.dest" value="${basedir}/classes"/>
  
    <property name="webapp-name" value="tata"/>
  
    <path id="compile.classpath">
      <pathelement location="${build.home}/classes"/>
      <pathelement location="${servlet.jar}"/>
    </path>
   
    <target name="clean" depends="">
      <delete dir="${javac.dest}/" />
      <delete dir="./${webapp-name}.war" />
    </target>
  
    <target name="compile">
      <mkdir dir="${javac.dest}"/>
      <javac srcdir="${src.dir}" destdir="${javac.dest}">
        <classpath refid="compile.classpath"/>
        <include name="wombat/*.java" />
      </javac>
    </target>
  
    <target name="war" depends="compile">
      <war warfile="${webapp-name}.war" webxml="src/WEB-INF/web.xml">
        <classes dir="classes"/>
        <zipfileset dir="src/html" prefix=""/>
      </war>
    </target>
  
  
  </project>
  
  
  1.1                  logging-log4j/tests/webapps/Titi/build.xml
  
  Index: build.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8" ?>
  
  <project name="Webapp Build Script" default="compile" basedir=".">
  
    <property environment="env"/>
  
    <!-- The build.properties file defines variables dependent of the host machine -->
    <property file="build.properties"/>
    
    <property name="log4j.home" value="${basedir}/../../.."/>
    <property name="src.dir" value="${basedir}/src/java/"/>
    <property name="javac.dest" value="${basedir}/classes"/>
  
    <property name="webapp-name" value="titi"/>
  
    <path id="compile.classpath">
      <pathelement location="${build.home}/classes"/>
      <pathelement location="${servlet.jar}"/>
    </path>
   
    <target name="clean" depends="">
      <delete dir="${javac.dest}/" />
      <delete dir="./${webapp-name}.war" />
    </target>
  
    <target name="compile">
      <mkdir dir="${javac.dest}"/>
      <javac srcdir="${src.dir}" destdir="${javac.dest}">
        <classpath refid="compile.classpath"/>
        <include name="wombat/*.java" />
      </javac>
    </target>
  
    <target name="war" depends="compile">
      <war warfile="${webapp-name}.war" webxml="src/WEB-INF/web.xml">
        <classes dir="classes"/>
        <zipfileset dir="src/html" prefix=""/>
      </war>
    </target>
  
  
  </project>
  
  
  1.1                  logging-log4j/tests/webapps/Titi/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  classes
  build.properties
  tata.war
  
  
  1.1                  logging-log4j/tests/webapps/Titi/build.properties.sample
  
  Index: build.properties.sample
  ===================================================================
  # Sample build.properties file
  
  # We need servlet to compile the various servlets.
  servlet.jar=../../lib/javax.servlet.jar
  
  
  
  
  
  1.1                  logging-log4j/tests/webapps/Titi/titi.war
  
  	<<Binary file>>
  
  
  1.1                  logging-log4j/tests/webapps/Titi/src/java/wombat/InitServlet.java
  
  Index: InitServlet.java
  ===================================================================
  package wombat;
  
  import javax.servlet.http.*;
  import javax.servlet.*;
  
  public class InitServlet extends HttpServlet {
    
    public void init() { 
      //System.out.println("TATA wombat.InitServlet.init() called.");
    }
  
    public void doGet(HttpServletRequest req, HttpServletResponse res) {
      // nothing to do
    }
  }
  
  
  
  
  1.1                  logging-log4j/tests/webapps/Titi/src/java/wombat/XServlet.java
  
  Index: XServlet.java
  ===================================================================
  
  package wombat;
  
  import java.io.*;
  import javax.servlet.*;
  import javax.servlet.http.*;
  import wombat.Util;
  
  public class XServlet extends HttpServlet {
  
    static final String MY_ENTRY = "java:comp/env/my-entry";
  
    public void init() throws ServletException {
      ServletContext context = getServletConfig().getServletContext();
    }
  
  
    public void service(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
  
      response.setContentType("text/html");
      PrintWriter out = response.getWriter();
      
      String result = Util.foo(MY_ENTRY);
  
      out.println(result);
      out.close();    
    }
  }
  
  
  
  1.1                  logging-log4j/tests/webapps/Util/build.properties.sample
  
  Index: build.properties.sample
  ===================================================================
  # Sample build.properties file
  
  # The path to the web-server home
  webserver.home=/java/tomcat/
  
  # The deployment target directory on the web server
  target.webapp.dir=${webserver.home}/webapps
  
  # We need servlet to compile the various servlets.
  servlet.jar=/java/servlet.jar
  
  
  
  
  1.1                  logging-log4j/tests/webapps/Util/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  classes
  build.properties
  tata.war
  
  
  1.1                  logging-log4j/tests/webapps/Util/build.xml
  
  Index: build.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8" ?>
  
  <project name="A very simple utility script" default="compile" basedir=".">
  
    <property environment="env"/>
  
    <!-- The build.properties file defines variables dependent of the host machine -->
    <property file="build.properties"/>
    
    <property name="src.dir" value="${basedir}/src/java/"/>
    <property name="javac.dest" value="${basedir}/classes"/>
  
    <path id="compile.classpath">
      <pathelement location="${build.home}/classes"/>
    </path>
   
    <target name="clean" depends="">
      <delete dir="${javac.dest}/" />
      <delete dir="./util.jar" />
    </target>
  
    <target name="compile">
      <mkdir dir="${javac.dest}"/>
      <javac srcdir="${src.dir}" destdir="${javac.dest}">
        <classpath refid="compile.classpath"/>
        <include name="wombat/*.java" />
      </javac>
    </target>
  
  
    <target name="jar" depends="compile">
      <jar jarfile="util.jar" basedir="${javac.dest}" includes="**/*.class"/>
    </target>
  
  
  </project>
  
  
  1.1                  logging-log4j/tests/webapps/Util/util.jar
  
  	<<Binary file>>
  
  
  1.1                  logging-log4j/tests/webapps/Titi/src/html/index.html
  
  Index: index.html
  ===================================================================
  
  <HTML>
  <BODY>
  
  <FORM METHOD="POST" ACTION="/tata/TataServlet">
  This will call Tata.
  <INPUT TYPE="submit">
  </FORM>
  
  </BODY>
  </HTML>
  
  
  1.1                  logging-log4j/tests/webapps/Util/src/java/wombat/Util.java
  
  Index: Util.java
  ===================================================================
  
  package wombat;
  
  import javax.naming.Context;
  import javax.naming.InitialContext;
  import javax.naming.NamingException;
  
  public class Util {
  
   static public String foo(String name) {
     System.out.println("Util.foo() called");
  
     Context ctx = null;
  
      try {
        Initial ictx = new InitialContext();
        System.out.println("ctx type is "+ctx);
        return (String) lookup(ctx, name);      
      } catch (NamingException ne) {
        ne.printStackTrace();
        return null;
      }
  
   }
  
  
    static public String lookup(Context ctx, String name) {
      if(ctx == null) {
        return null;
      }
      try {
        return (String) ctx.lookup(name);
      } catch (NamingException ne) {
        System.out.println("Could not find ["+name+"]");
        ne.printStackTrace();
        return null;
      }
    }
  }
  
  
  
  1.1                  logging-log4j/tests/webapps/Tata/src/java/wombat/InitServlet.java
  
  Index: InitServlet.java
  ===================================================================
  package wombat;
  
  import javax.servlet.http.*;
  import javax.servlet.*;
  
  public class InitServlet extends HttpServlet {
    
    public void init() { 
      //System.out.println("TATA wombat.InitServlet.init() called.");
    }
  
    public void doGet(HttpServletRequest req, HttpServletResponse res) {
      // nothing to do
    }
  }
  
  
  
  
  1.1                  logging-log4j/tests/webapps/Tata/src/java/wombat/XServlet.java
  
  Index: XServlet.java
  ===================================================================
  
  package wombat;
  
  import java.io.*;
  import javax.servlet.*;
  import javax.servlet.http.*;
  import wombat.Util;
  
  public class XServlet extends HttpServlet {
  
    static final String MY_ENTRY = "java:comp/env/my-entry";
  
    public void init() throws ServletException {
      ServletContext context = getServletConfig().getServletContext();
    }
  
  
    public void service(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
  
      response.setContentType("text/html");
      PrintWriter out = response.getWriter();
      
      String result = Util.foo(MY_ENTRY);
  
      out.println(result);
      out.close();    
    }
  }
  
  
  
  1.6       +5 -1      logging-log4j/tests/build.properties.sample
  
  Index: build.properties.sample
  ===================================================================
  RCS file: /home/cvs/logging-log4j/tests/build.properties.sample,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- build.properties.sample	20 May 2004 15:38:00 -0000	1.5
  +++ build.properties.sample	11 Jun 2004 19:43:03 -0000	1.6
  @@ -2,10 +2,14 @@
   
   jakarta.oro.jar=../../jakarta-oro-2.0.5/jakarta-oro-2.0.5.jar
   
  +
   # Junit test cases
   # ================
   # junit.jar must be on the classpath or in ANT_HOME/lib. It can't  be
  -# handled as a property.
  +# handled as a property altough this might change in futute versions of ANT.
  +
  +# We use jetty for some unit tests
  +jetty.jar=/java/jetty-4.2.20/lib/org.mortbay.jetty.jar
   
   
   # Database testing
  
  
  
  1.1                  logging-log4j/tests/servlet.xml
  
  Index: servlet.xml
  ===================================================================
  
  <!-- This file is an ANT build script. ANT is a Java based build tool. -->
  <!-- It is availale from http://jakarta.apache.org/ant/                -->
  
  
  <!-- ================================================================= -->
  <!-- NOTE: all directories are relative to jakarta-log4j/tests         -->
  <!-- ================================================================= -->
  <project name="servlet-tests" default="runAll" basedir="." >
  
    <property file="build.properties"/>
  
    <!-- The base directory relative to which most targets are built -->
    <property name="base" value="."/>
   
    <!-- The directory where source files are stored. -->
    <property name="project.source.home" value="../src/java/"/>
    <property name="project.classes.home" value="../dist/classes/"/>
    <property name="examples.classes" value="../examples/classes/"/>
    
    <property name="tests.source.home" value="./src/java/"/>
    
    <!-- The stem where most log4j source code is located. -->
    <property name="stem" value="org/apache/log4j"/>
    
    <path id="tests.classpath">
      <pathelement location="${project.source.home}"/>
      <pathelement location="${project.classes.home}"/>
      <pathelement location="${examples.classes}"/>
      <pathelement location="${tests.source.home}"/>
      <pathelement location="./classes"/>
    	<pathelement location="./resources"/> 
      <pathelement location="${jakarta.oro.jar}"/>
      <fileset dir="./lib/">
        <include name="*.jar"/>
      </fileset>
    </path>
    
    
    <!-- ================================================================= -->
    <!--                        TARGETS                                    -->
    <!-- ================================================================= -->
    
   
    <target name="prepare">
      <mkdir dir="./classes" />
      <mkdir dir="./output" />
      <delete file="classes/log4j.xml"/>
      <delete file="classes/log4j.properties"/>
      <copy file="resources/jetty.jndi.properties" 
          tofile="resources/jndi.properties"/>
    </target>
    
     <!-- ================================================================= -->
     <!-- Compile test cases and related source files.                      -->
     <!-- ================================================================= -->
     <target name="build" depends="tata-war, titi-war, prepare">
  	  <javac srcdir="${tests.source.home}"
  		destdir="./classes" 
  	  	includes="org/apache/log4j/selector/*.java"
     	    excludes="org/apache/log4j/chainsaw/receivers/*.java"
  		deprecation="${deprecation}"
  		debug="on">			
  	    <classpath refid="tests.classpath"/>
  	 </javac>
    </target>
  	
    <!-- ================================================================= -->
    <!-- Build the parent project                                          -->
    <!-- ================================================================= -->  
    <target name="tata-war">
      <ant dir="./webapps/Tata" target="war" inheritRefs="true"/>
    </target>
  
    <target name="titi-war">
      <ant dir="./webapps/Titi" target="war" inheritRefs="true"/>
    </target>
  		
    <target name="cleanOutputDir">
      <delete>
  	  <fileset dir="./output/" includes="**"/>
  	 </delete>
    </target>
   
  	
    <target name="runAll" depends="PassByJNDI"/>
  	
    <target name="PassByJNDI" depends="build, cleanOutputDir">
      <junit printsummary="yes" fork="yes" haltonfailure="yes">
  	  <classpath refid="tests.classpath"/>
  	    <formatter type="plain" usefile="false"/>
  	      <test name="org.apache.log4j.selector.PassByJNDI" />
  	   </junit>
  	</target>
  	
    
  </project>
  
  
  
  
  1.1                  logging-log4j/tests/webapps/Tata/src/html/index.html
  
  Index: index.html
  ===================================================================
  
  <HTML>
  <BODY>
  
  <FORM METHOD="POST" ACTION="/tata/TataServlet">
  This will call Tata.
  <INPUT TYPE="submit">
  </FORM>
  
  </BODY>
  </HTML>
  
  
  1.1                  logging-log4j/tests/webapps/Titi/src/WEB-INF/web.xml
  
  Index: web.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
  <web-app>
  
   <servlet>
      <servlet-name>some-init-servlet</servlet-name>
      <servlet-class>wombat.InitServlet</servlet-class>
      <load-on-startup>1</load-on-startup>
    </servlet>
  
  
    <servlet>
      <servlet-name>XServlet</servlet-name>
      <servlet-class>wombat.XServlet</servlet-class>
    </servlet>
  
    <servlet-mapping>
      <servlet-name>XServlet</servlet-name>
      <url-pattern>/XServlet</url-pattern>
    </servlet-mapping>
  
    <env-entry>
     <description>A JNDI test entry</description>
     <env-entry-name>my-entry</env-entry-name>
     <env-entry-value>titi</env-entry-value>
     <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>
  
  </web-app>
  
  
  
  1.1                  logging-log4j/tests/webapps/Tata/src/WEB-INF/web.xml
  
  Index: web.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
  <web-app>
  
   <servlet>
      <servlet-name>some-init-servlet</servlet-name>
      <servlet-class>wombat.InitServlet</servlet-class>
      <load-on-startup>1</load-on-startup>
    </servlet>
  
  
    <servlet>
      <servlet-name>XServlet</servlet-name>
      <servlet-class>wombat.XServlet</servlet-class>
    </servlet>
  
    <servlet-mapping>
      <servlet-name>XServlet</servlet-name>
      <url-pattern>/XServlet</url-pattern>
    </servlet-mapping>
  
    <env-entry>
     <description>A JNDI test entry</description>
     <env-entry-name>my-entry</env-entry-name>
     <env-entry-value>tata</env-entry-value>
     <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>
  
  </web-app>
  
  
  

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


Mime
View raw message