Author: jsong
Date: Thu Aug 19 18:12:16 2004
New Revision: 36642

Added:
   incubator/beehive/trunk/external/beehive-antext/
   incubator/beehive/trunk/external/beehive-antext/README.txt
   incubator/beehive/trunk/external/beehive-antext/beehive-antext.jar   
(contents, props changed)
   incubator/beehive/trunk/external/beehive-antext/build.xml
   incubator/beehive/trunk/external/beehive-antext/src/
   incubator/beehive/trunk/external/beehive-antext/src/org/
   incubator/beehive/trunk/external/beehive-antext/src/org/apache/
   incubator/beehive/trunk/external/beehive-antext/src/org/apache/beehive/
   incubator/beehive/trunk/external/beehive-antext/src/org/apache/beehive/test/
   
incubator/beehive/trunk/external/beehive-antext/src/org/apache/beehive/test/tools/
   
incubator/beehive/trunk/external/beehive-antext/src/org/apache/beehive/test/tools/antext/
   
incubator/beehive/trunk/external/beehive-antext/src/org/apache/beehive/test/tools/antext/GetHostName.java
Modified:
   incubator/beehive/trunk/controls/test/build.xml
   incubator/beehive/trunk/controls/test/common/path.properties
   incubator/beehive/trunk/controls/test/infra/milton/milton.jar
   
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/junit/HtmlReportTestCase.java
   incubator/beehive/trunk/controls/test/webapps/build.xml
Log:
Submitting change proposed by Zach Smith ([EMAIL PROTECTED])

   1. Creating $BEEHIVE_HOME/external/beehive-antext directory for custom
   Ant tasks which may prove useful to other groups.
                                                                                
  
   2. Adding GetHostName task to beehive-antext and a build.xml file to
   support creating
   $BEEHIVE_HOME/external/beehive-antext/beehive-antext.jar
                                                                                
  
   3. Adding the first beehive-antext.jar which contains task listed in #2
                                                                                
  
   4. Adding support to HttpReportTestCase class in Milton to search for
   multiple HOSTNAME variables.  This is mostly for Windows which does not
   have a HOSTNAME variable available.  One could use the GetHostName task
   in an Ant script to set TEST_HOSTNAME or HOSTNAME automatically.  If
   HOSTNAME and TEST_HOSTNAME are null it will default to "localhost".  (It
   looks for TEST_HOSTNAME and then HOSTNAME and then defaults to
   "localhost")
                                                                                
  
   5. Fixing a few hard-coded paths and build/run class paths in build
   scripts
                                                                                
  
   Getting a bit closer to running the controls pageflow tests
   automagically



Modified: incubator/beehive/trunk/controls/test/build.xml
==============================================================================
--- incubator/beehive/trunk/controls/test/build.xml     (original)
+++ incubator/beehive/trunk/controls/test/build.xml     Thu Aug 19 18:12:16 2004
@@ -8,6 +8,8 @@
 
     <property name="dev.root" value="${os.DEV_ROOT}"/>
 
+    <taskdef name="gethostname" 
classname="org.apache.beehive.test.tools.antext.GetHostName" 
+            classpath="${beehive-antext.jar}" />
     <taskdef name="apt" 
classname="org.apache.beehive.controls.runtime.generator.AptTask" 
              classpath="../build/jars/controls.jar" onerror="report" />
 
@@ -24,6 +26,7 @@
     <property name="build.beansrc" location="${build.dir}/beansrc"/>
     <property name="build.jars" location="${build.dir}/jars"/>
     <property name="test.logs" location="${basedir}/logs"/>
+
     <condition property="test.os" value="windows" >
        <os family="windows" />
     </condition>
@@ -31,7 +34,6 @@
        <os family="unix" />
     </condition>
 
-
     <path id="tch.run.classpath">
        <pathelement location="${tch.jar}"/>
        <pathelement location="${tch.schema.jar}"/>
@@ -52,6 +54,9 @@
        <pathelement location="${build.tests}" />
 
        <pathelement location="${jakarta.jar}"/>
+       <pathelement location="${httpunit.jar}"/>
+       <pathelement location="${httpunit-xerces.jar}"/>
+       <pathelement location="${nekohtml.jar}"/>
     </path>
 
     
@@ -180,22 +185,27 @@
     <echo message="milton.jar: ${milton.jar}"/>
     
     <target name="run">
+
+        <gethostname/> <!-- set ${hostname} -->
+
+        <property name="test.hostname" value="${hostname}" />
+        <property name="test.hostname.port" value="8080" /> <!-- tomcat 
default port -->
+
         <property name="test-suite" value="${junit.src.dir}/root.xml"/>
        <property name="tch.base-logfile-name" value="tch"/>
 
-
        <tch tchHome="${tch.home}"
             testfile="${test-suite}"
             fork="true"
             classpathref="tch.run.classpath"
             failureproperty="run.failed">
 
-
-
             <arg value="-emacs"/>
             <property name="tch.replication.entry-point" value="ant -f 
${controls.test.dir}/build.xml run"/>
-        </tch>
+           <sysproperty key="TEST_HOSTNAME" value="${test.hostname}" />
+           <sysproperty key="TEST_HOSTNAME_PORT" value="${test.hostname.port}" 
/>
 
+        </tch>
        
        <ant antfile="${controls.test.infra.dir}/tch/runtime/build.xml" 
target="generate-html-log" dir="${basedir}">
                <property name="gtlf.file" 
value="${basedir}/${tch.base-logfile-name}.xml"/>
@@ -245,5 +255,5 @@
                aptcommand="${os.JAVA_HOME}/bin/apt"
     />
   </target>
-    
+ 
 </project>

Modified: incubator/beehive/trunk/controls/test/common/path.properties
==============================================================================
--- incubator/beehive/trunk/controls/test/common/path.properties        
(original)
+++ incubator/beehive/trunk/controls/test/common/path.properties        Thu Aug 
19 18:12:16 2004
@@ -24,7 +24,10 @@
 xerces.jar=${external.dir}/xerces/xerces-1.4.4.jar
 xbean.jar=${external.dir}/xmlbeans/apache-xbeans.jar
 httpunit.jar=${external.dir}/httpunit/httpunit.jar
+httpunit-xerces.jar=${external.dir}/httpunit/xercesImpl.jar
+nekohtml.jar=${external.dir}/httpunit/nekohtml.jar
 junit.jar=${external.dir}/junit/junit.jar
+beehive-antext.jar=${external.dir}/beehive-antext/beehive-antext.jar
 
 #properties for mantis
 mantis.home=${controls.test.infra.dir}/mantis
@@ -32,4 +35,4 @@
 tchschema.jar=${mantis.home}/tchschema.jar
 mantis.tools.jar=${os.JAVA_HOME}/lib/tools.jar
 mantis.xbean.jar=${mantis.home}/xbean-1.0.2.jar
-mantis.config=${mantis.home}/mantis.properties
\ No newline at end of file
+mantis.config=${mantis.home}/mantis.properties

Modified: incubator/beehive/trunk/controls/test/infra/milton/milton.jar
==============================================================================
Binary files. No diff available.

Modified: 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/junit/HtmlReportTestCase.java
==============================================================================
--- 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/junit/HtmlReportTestCase.java
   (original)
+++ 
incubator/beehive/trunk/controls/test/tools/milton/src/org/apache/beehive/test/tools/milton/junit/HtmlReportTestCase.java
   Thu Aug 19 18:12:16 2004
@@ -25,7 +25,20 @@
     public HtmlReportTestCase(String name)
     {
         super(name);
-        this.urlPrefix = HTTP_PREFIX + TestContext.getProperty("HOSTNAME");
+
+        String hostName = TestContext.getProperty("TEST_HOSTNAME");
+        String hostNamePort = TestContext.getProperty("TEST_HOSTNAME_PORT");
+
+        if (null == hostName || hostName.equals("")) {
+            hostName = TestContext.getProperty("HOSTNAME");
+            if (null == hostName || hostName.equals(""))
+                hostName = "localhost";
+        }
+
+        if (null != hostNamePort)
+            hostName += ":" + hostNamePort;
+
+        this.urlPrefix = HTTP_PREFIX + hostName;
     }
 
     public String getUrlPrefix()

Modified: incubator/beehive/trunk/controls/test/webapps/build.xml
==============================================================================
--- incubator/beehive/trunk/controls/test/webapps/build.xml     (original)
+++ incubator/beehive/trunk/controls/test/webapps/build.xml     Thu Aug 19 
18:12:16 2004
@@ -57,7 +57,7 @@
         <!--property name="webapp.dir" 
location="C:/beehive/work_dir/controls/test/webapps/${webapp.name}"/-->
         <property name="webapp.dir" location="./${webapp.name}"/>
 
-       <ant antfile="${buildWebapp.ant}" target="deploy.netui" 
inheritAll="false">
+       <ant antfile="${deployNetui.ant}" target="deploy.netui" 
inheritAll="false">
                <property name="webapp.dir" value="${webapp.dir}" />
        </ant>
 
@@ -86,10 +86,10 @@
         <echo message="|     Controls controlsWeb clean starting    |"/>
         <echo message="----------------------------------------------"/>
 
-        <ant antfile="${buildWebapp.ant}" target="undeploy.netui" 
inheritAll="false">
+        <ant antfile="${deployNetui.ant}" target="undeploy.netui" 
inheritAll="false">
             <property name="webapp.dir" location="./${webapp.name}"/>
         </ant>
-        <ant antfile="${buildWebapp.ant}" target="clean.webapp" 
inheritAll="false">
+        <ant antfile="${deployNetui.ant}" target="clean.webapp" 
inheritAll="false">
             <property name="webapp.dir" location="./${webapp.name}"/>
         </ant>
 
@@ -163,7 +163,7 @@
     <target name="deploy" description="Deploy webapp">
         <ant antfile="${runTomcat.ant}" target="deploy" inheritAll="false">
             <property name="context.path" value="${webapp.name}"/>
-            <property name="webapp.root" 
value="C:/beehive/work_dir/controls/test/webapps/${webapp.name}"/>
+            <property name="webapp.root" value="${basedir}/${webapp.name}"/>
         </ant>
     </target>
 

Added: incubator/beehive/trunk/external/beehive-antext/README.txt
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/external/beehive-antext/README.txt  Thu Aug 19 
18:12:16 2004
@@ -0,0 +1,2 @@
+These are local tasks used for Beehive which may be useful to others.
+If you wish to add a Task make sure to add the src and update the jar.

Added: incubator/beehive/trunk/external/beehive-antext/beehive-antext.jar
==============================================================================
Binary file. No diff available.

Added: incubator/beehive/trunk/external/beehive-antext/build.xml
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/external/beehive-antext/build.xml   Thu Aug 19 
18:12:16 2004
@@ -0,0 +1,29 @@
+<project name="beehive-antext" default="build">
+
+  <property environment="env"/>
+  <property name="build.dir" value="${basedir}/build"/>
+  <property name="src.dir" value="${basedir}/src"/>
+  <property name="beehive-antext.jar" value="${build.dir}/beehive-antext.jar"/>
+
+  <path id="build.classpath">
+     <pathelement location="${env.ANT_HOME}/lib/ant.jar"/>
+  </path>
+     
+  <target name="build">
+    <mkdir dir="${build.dir}"/>
+    <javac srcdir="${src.dir}"
+            destdir="${build.dir}"
+            failonerror="true"
+            verbose="false"
+            deprecation="true"
+            classpathref="build.classpath" />
+     <jar basedir="${build.dir}" destfile="${beehive-antext.jar}"/>
+   </target>
+
+   <target name="clean">
+      <delete dir="${build.dir}"/>
+   </target>
+
+   <target name="rebuild" depends="clean,build"/>
+
+</project>

Added: 
incubator/beehive/trunk/external/beehive-antext/src/org/apache/beehive/test/tools/antext/GetHostName.java
==============================================================================
--- (empty file)
+++ 
incubator/beehive/trunk/external/beehive-antext/src/org/apache/beehive/test/tools/antext/GetHostName.java
   Thu Aug 19 18:12:16 2004
@@ -0,0 +1,27 @@
+package org.apache.beehive.test.tools.antext;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.Target;
+
+import java.net.InetAddress;
+
+public class GetHostName extends Task
+{
+    public void execute() throws BuildException
+    {
+        try
+        {   
+            Target t = this.getOwningTarget();
+            InetAddress inetAddr = InetAddress.getLocalHost();
+            t.getProject().setProperty( "hostname", inetAddr.getHostName() );
+            t.getProject().setProperty( "hostname.domain", 
inetAddr.getCanonicalHostName() );
+        }
+        catch ( Exception e )
+        {
+            throw new BuildException( "Error: " + e, e );
+        }
+
+    } // execute()
+
+} // GetHostName

Reply via email to