harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r549769 - in /harmony/enhanced/buildtest/branches/2.0: adaptors/JettyScenario/adaptor.xml adaptors/JettyScenario/parameters.xml tests/JettyScenario/src/JettyScenario.java tests/JettyScenario/src/JettyTestCase.java
Date Fri, 22 Jun 2007 10:32:07 GMT
Author: smishura
Date: Fri Jun 22 03:32:06 2007
New Revision: 549769

URL: http://svn.apache.org/viewvc?view=rev&rev=549769
Log:
Apply patch with fixes for JettyScenario from HARMONY-3530:
([testing] Contribution of the automated scenario for Jetty)

Modified:
    harmony/enhanced/buildtest/branches/2.0/adaptors/JettyScenario/adaptor.xml
    harmony/enhanced/buildtest/branches/2.0/adaptors/JettyScenario/parameters.xml
    harmony/enhanced/buildtest/branches/2.0/tests/JettyScenario/src/JettyScenario.java
    harmony/enhanced/buildtest/branches/2.0/tests/JettyScenario/src/JettyTestCase.java

Modified: harmony/enhanced/buildtest/branches/2.0/adaptors/JettyScenario/adaptor.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/adaptors/JettyScenario/adaptor.xml?view=diff&rev=549769&r1=549768&r2=549769
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/adaptors/JettyScenario/adaptor.xml (original)
+++ harmony/enhanced/buildtest/branches/2.0/adaptors/JettyScenario/adaptor.xml Fri Jun 22
03:32:06 2007
@@ -25,6 +25,10 @@
     <property name="scenario.bin.dir" location="${scenario.dir}/classes"/>
     <property name="scenario.results.dir" location="${results.dir}/${suite.name}"/>
 
+    <condition property="test.fw.vm.opts" value="${JettyScenario.parameters.optional.tested.vm.options}"
else="">
+        <equals arg1="${jetty.server.jvm}" arg2="${scenario.framework.jvm}"/>
+    </condition>
+
     <target name="setup">
         <echo level="info" message="============= Adaptor for ${suite.name}: Set Up .."/>
         <echo level="info" message=""/>
@@ -77,6 +81,7 @@
         <!--
             Performing scenario run in the following order:
 
+            0. Check that specified java executable exists
             1. Create directory for scenario results
             2. Remove previous Jetty server log, if any
             3. Start Jetty server and wait until it is started
@@ -85,6 +90,20 @@
             6. Collect logs and results in results directory
         -->
 
+        <condition property="server.vm.not.exist">
+            <not>
+                <available file="${jetty.server.jvm}"/>
+            </not>
+        </condition>
+        <fail message="Path to JVM does not exist: ${jetty.server.jvm}" if="server.vm.not.exist"/>
+
+        <condition property="fw.vm.not.exist">
+            <not>
+                <available file="${scenario.framework.jvm}"/>
+            </not>
+        </condition>
+        <fail message="Path to JVM does not exist: ${scenario.framework.jvm}" if="fw.vm.not.exist"/>
+
         <mkdir dir="${scenario.results.dir}"/>
         <delete file="${scenario.results.dir}/jetty.log"/>
 
@@ -100,7 +119,7 @@
                     <sysproperty key="jetty.port" value="${JettyScenario.parameters.optional.jetty.server.port}"/>
                     <sysproperty key="STOP.PORT"  value="${JettyScenario.parameters.optional.jetty.server.stop.port}"/>
                     <sysproperty key="STOP.KEY"   value="kill"/>
-                    <jvmarg value="-jar"/>
+                    <jvmarg line="${JettyScenario.parameters.optional.tested.vm.options}
-jar"/>
                 </java>
             </sequential>
 
@@ -124,6 +143,7 @@
                        haltonfailure="false"
                        printsummary="on"
                        failureproperty="scenario.failed">
+                    <jvmarg line="${test.fw.vm.opts}"/>
                     <sysproperty key="jetty.scenario.resources.path"  value="${scenario.src.dir}/resources"/>
                     <sysproperty key="jetty.scenario.results.path"    value="${scenario.results.dir}"/>
                     <sysproperty key="jetty.scenario.savepages"       value="${JettyScenario.parameters.optional.do.save.pages}"/>
@@ -139,16 +159,18 @@
                     </classpath>
                     <formatter type="plain"/>
                     <formatter type="xml"/>
-                    <test name="JettyScenario" todir="${scenario.results.dir}"/>
+                    <test name="org.apache.harmony.test.jetty.JettyScenario" todir="${scenario.results.dir}"/>
                 </junit>
 
                 <junitreport todir="${scenario.results.dir}">
                     <fileset dir="${scenario.results.dir}">
-                        <include name="TEST*-*.xml"/>
+                        <include name="TEST-*.xml"/>
                     </fileset>
                     <report format="frames" todir="${scenario.results.dir}/html"/>
                 </junitreport>
 
+                <antcall target="-compose-notification"/>
+
                 <echo level="info" message="Stopping Jetty server"/>
                 <java jvm="${JettyScenario.parameters.required.jetty.server.jvm}"
                       dir="${ext.jetty-6.1.2rc1.location}"
@@ -158,7 +180,7 @@
                     <sysproperty key="jetty.port" value="${JettyScenario.parameters.optional.jetty.server.port}"/>
                     <sysproperty key="STOP.PORT" value="${JettyScenario.parameters.optional.jetty.server.stop.port}"/>
                     <sysproperty key="STOP.KEY" value="kill"/>
-                    <jvmarg value="-jar"/>
+                    <jvmarg line="${JettyScenario.parameters.optional.tested.vm.options}
-jar"/>
                     <arg value="--stop"/>
                 </java>
                 <fail message="Jetty scenario failed" if="scenario.failed"/>
@@ -171,33 +193,14 @@
         <echo level="info" message="============= Adaptor for ${suite.name}: Clean .."/>
         <echo level="info" message="Removing all from working directory"/>
         <delete dir="${scenario.dir}"/>
+        <echo level="info" message="Removing all from results directory"/>
+        <delete dir="${scenario.results.dir}"/>
     </target>
 
     <!--
-        Jetty scenario publisher
+        Compose Jetty scenario summary
     -->
 
-    <condition property="subject"
-        value="${framework.parameters.usemail.subject.prefix} BUILD PASSED ${os.name} ${os.arch}:
Jetty scenario"
-        else="${framework.parameters.usemail.subject.prefix} BUILD FAILED ${os.name} ${os.arch}:
Jetty scenario">
-            <istrue value="${thisbuildsuccessful}"/>
-    </condition>
-
-    <condition property="do.send">
-        <and>
-            <isset property="framework.parameters.usemail"/>
-            <or>
-                <equals arg1="${framework.parameters.usemail.always}"
-                        arg2="true"/>
-                <not>
-                    <equals arg1="${thisbuildsuccessful}"
-                            arg2="${lastbuildsuccessful}"/>
-                </not>
-            </or>
-        </and>
-    </condition>
-
-    <property name="scenario.results.dir" location="${results.dir}/${suite.name}"/>
     <property name="ls" value="${line.separator}"/>
 
     <target name="-compose-notification">
@@ -221,7 +224,7 @@
               message="${ls}================================================================================${ls}Scenario
results:${ls}${ls}"/>
 
         <concat destfile="${scenario.results.dir}/notification.txt" append="true">
-            <filelist dir="${scenario.results.dir}" files="TEST-JettyScenario.txt"/>
+            <fileset dir="${scenario.results.dir}" includes="TEST-*.txt"/>
         </concat>
 
         <echo file="${scenario.results.dir}/notification.txt" append="true"
@@ -231,33 +234,8 @@
             <filelist dir="${scenario.results.dir}" files="jetty.log"/>
         </concat>
 
-        <xslt basedir="${scripts.dir}/xslt"
-              in="${logdir}/${logfile}"
-              style="${scripts.dir}/xslt/br.xsl"
-              out="${scenario.results.dir}/buildresults.txt"
-              classpath="${ext.xalan.location}:${ext.cc.location}/lib/serializer-2.7.0.jar">
-        </xslt>
-
         <echo file="${scenario.results.dir}/notification.txt" append="true"
               message="${ls}================================================================================${ls}"/>
-
-        <concat destfile="${scenario.results.dir}/notification.txt" append="true">
-            <filelist dir="${scenario.results.dir}" files="buildresults.txt"/>
-        </concat>
-
-        <delete file="${scenario.results.dir}/buildresults.txt"/>
     </target>
     
-    <target name="publish" if="do.send" depends="-compose-notification">
-        <echo>Sending notification</echo>
-        <mail from="${framework.parameters.usemail.from}" 
-              tolist="${framework.parameters.usemail.to}"
-              messagefile="${scenario.results.dir}/notification.txt"
-              failonerror="true"
-              mailhost="${framework.parameters.usemail}"
-              subject="${subject}"
-              encoding="plain"
-              messagemimetype="text/plain"/>
-    </target>
-
 </project>

Modified: harmony/enhanced/buildtest/branches/2.0/adaptors/JettyScenario/parameters.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/adaptors/JettyScenario/parameters.xml?view=diff&rev=549769&r1=549768&r2=549769
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/adaptors/JettyScenario/parameters.xml (original)
+++ harmony/enhanced/buildtest/branches/2.0/adaptors/JettyScenario/parameters.xml Fri Jun
22 03:32:06 2007
@@ -28,6 +28,9 @@
 
     <!-- Optional parameters -->
     <optional>
+        <tested.vm.options
+            description="JVM options for tested runtime"
+            value=""/>
         <jetty.server.port
             description="Port on which Jetty server will startup."
             value="7070"/>
@@ -66,8 +69,8 @@
         <!-- Re-run if changes in SVN -->
         <usesvn refid="trunk.dir.id"/>
         <!-- Run this script for publishing results -->
-        <publisher value="${adaptors.dir}/${suite.name}/adaptor.xml"/>
+        <summary value="${scenario.results.dir}/notification.txt"/>
         <!-- Merge results with CC log -->
-        <results value="${scenario.results.dir}"/>
+        <results value="${scenario.results.dir}' pattern='TEST-*.xml"/>
     </cc>
 </parameters>

Modified: harmony/enhanced/buildtest/branches/2.0/tests/JettyScenario/src/JettyScenario.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/JettyScenario/src/JettyScenario.java?view=diff&rev=549769&r1=549768&r2=549769
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/JettyScenario/src/JettyScenario.java (original)
+++ harmony/enhanced/buildtest/branches/2.0/tests/JettyScenario/src/JettyScenario.java Fri
Jun 22 03:32:06 2007
@@ -15,6 +15,8 @@
  *  limitations under the License.
  */
 
+package org.apache.harmony.test.jetty;
+
 import com.gargoylesoftware.htmlunit.*;
 import com.gargoylesoftware.htmlunit.html.*;
 

Modified: harmony/enhanced/buildtest/branches/2.0/tests/JettyScenario/src/JettyTestCase.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/JettyScenario/src/JettyTestCase.java?view=diff&rev=549769&r1=549768&r2=549769
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/JettyScenario/src/JettyTestCase.java (original)
+++ harmony/enhanced/buildtest/branches/2.0/tests/JettyScenario/src/JettyTestCase.java Fri
Jun 22 03:32:06 2007
@@ -15,6 +15,8 @@
  *  limitations under the License.
  */
 
+package org.apache.harmony.test.jetty;
+
 import com.gargoylesoftware.htmlunit.*;
 
 import java.io.File;
@@ -28,6 +30,8 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 
+import java.util.Vector;
+
 import junit.framework.TestCase;
 
 public class JettyTestCase extends TestCase {
@@ -101,20 +105,18 @@
 
         String cs = null;
         String fs = null;
+        Vector cv = new Vector();
+        Vector fv = new Vector();
+        Vector sv = new Vector();
         try {
             cs = creader.readLine();
             fs = freader.readLine();
             while (cs != null && fs != null) {
                 if (!compareLines(cs, fs)) {
-                    LOG_OUT.println("Lines:");
-                    LOG_OUT.println("--content-----------------------------------------------------------------------");
-                    LOG_OUT.println("(" + creader.getLineNumber() + ") " + cs);
-                    LOG_OUT.println("--etalon------------------------------------------------------------------------");
-                    LOG_OUT.println("(" + freader.getLineNumber() + ") " + fs);
-                    LOG_OUT.println("--------------------------------------------------------------------------------");
-                    LOG_OUT.println("do not match each other.");
-                    return false;
+                    cv.add(cs);
+                    sv.add(fs);
                 }
+                fv.add(fs);
                 cs = creader.readLine();
                 fs = freader.readLine();
             }
@@ -125,10 +127,17 @@
         }
 
         if (cs != null || fs != null) {
-            LOG_OUT.println("Files have different number of lines.");
+            LOG_OUT.println("Page have different number of lines than etalon.");
             return false;
         }
 
+        if (cv.size() != 0 || fv.size() != 0) {
+            if (!compareRegardlessOrder(cv, sv, fv)) {
+                LOG_OUT.println("Page differs from etalon (even if lines order is not checked).");
+                return false;
+            }
+        }
+
         try {
             creader.close();
             freader.close();
@@ -138,6 +147,34 @@
             return false;
         }
         LOG_OUT.println("Page is equal to etalon.");
+        return true;
+    }
+
+    protected boolean compareRegardlessOrder(Vector first, Vector second, Vector third) {
+        for (int i = 0; i < first.size(); i++) {
+            boolean ok = false;
+            for (int j = 0; j < third.size(); j++) {
+                if (compareLines((String)first.elementAt(i), (String)third.elementAt(j)))
{
+                    ok = true;
+                }
+            }
+            if (!ok) {
+                LOG_OUT.println("Lines:");
+                int linesCount = (first.size() > 20) ? 20 : first.size();
+                for (int j = 0; j < linesCount; j++) {
+                    LOG_OUT.println("--content-----------------------------------------------------------------------");
+                    LOG_OUT.println((String)first.elementAt(j));
+                    LOG_OUT.println("--etalon------------------------------------------------------------------------");
+                    LOG_OUT.println((String)second.elementAt(j));
+                }
+                LOG_OUT.println("--------------------------------------------------------------------------------");
+                if (first.size() > 20) {
+                    LOG_OUT.println("and " + (first.size() - 20) + " lines more");
+                }
+                LOG_OUT.println("do not match each other.");
+                return false;
+            }
+        }
         return true;
     }
 



Mime
View raw message