Author: kkolinko
Date: Wed Nov 4 16:17:09 2015
New Revision: 1712582
URL: http://svn.apache.org/viewvc?rev=1712582&view=rev
Log:
For historical reference, diff file between the branch and 6.0.x/trunk @1444299.
r1444299 was the last catch-up merge and the last commit to this branch.
svn diff "^/tomcat/tc6.0.x/trunk@1444299"
"^/tomcat/tc6.0.x/branches/tomcat6-testing@1444299" >BRANCH-diff.diff
Added:
tomcat/tc6.0.x/branches/tomcat6-testing/BRANCH-diff.diff
Modified:
tomcat/tc6.0.x/branches/tomcat6-testing/BRANCH-README.txt
Modified: tomcat/tc6.0.x/branches/tomcat6-testing/BRANCH-README.txt
URL:
http://svn.apache.org/viewvc/tomcat/tc6.0.x/branches/tomcat6-testing/BRANCH-README.txt?rev=1712582&r1=1712581&r2=1712582&view=diff
==============================================================================
--- tomcat/tc6.0.x/branches/tomcat6-testing/BRANCH-README.txt (original)
+++ tomcat/tc6.0.x/branches/tomcat6-testing/BRANCH-README.txt Wed Nov 4
16:17:09 2015
@@ -9,6 +9,9 @@ Last catch-up merge: 2013-02-09, merged
Revisions in 6.0.x/trunk that are merges from this branch:
r1417826,1444292
+Diff file after the last catch-up merge:
+svn diff "^/tomcat/tc6.0.x/trunk@1444299"
"^/tomcat/tc6.0.x/branches/tomcat6-testing@1444299" >BRANCH-diff.diff
+
TODO:
Added: tomcat/tc6.0.x/branches/tomcat6-testing/BRANCH-diff.diff
URL:
http://svn.apache.org/viewvc/tomcat/tc6.0.x/branches/tomcat6-testing/BRANCH-diff.diff?rev=1712582&view=auto
==============================================================================
--- tomcat/tc6.0.x/branches/tomcat6-testing/BRANCH-diff.diff (added)
+++ tomcat/tc6.0.x/branches/tomcat6-testing/BRANCH-diff.diff Wed Nov 4
16:17:09 2015
@@ -0,0 +1,537 @@
+Index: build.xml
+===================================================================
+--- build.xml (.../trunk) (revision 1444299)
++++ build.xml (.../branches/tomcat6-testing) (revision 1444299)
+@@ -58,8 +58,9 @@
+ <property name="tomcat.classes" value="${tomcat.output}/classes"/>
+ <property name="tomcat.dist" value="${tomcat.output}/dist"/>
+ <property name="tomcat.manifests" value="${tomcat.output}/manifests"/>
+- <property name="test.failonerror" value="true"/>
+- <property name="test.runner" value="junit.textui.TestRunner"/>
++ <property name="test.classes"
value="${tomcat.output}/testclasses"/>
++ <property name="test.temp" value="${tomcat.output}/test-tmp"/>
++ <property name="test.apr.loc" value="${tomcat.build}/bin/native"/>
+
+ <!-- Can't be lower - jsp uses templates -->
+ <property name="compile.source" value="1.5"/>
+@@ -93,12 +94,28 @@
+ <available property="tomcat-dbcp.present" file="${tomcat-dbcp.jar}" />
+ <available property="jdk16.present" classname="javax.sql.StatementEvent" />
+
++ <!-- Tests To Run -->
++ <property name="test.name" value="**/Test*.java"/>
++ <property name="test.formatter"
value="-Dorg.apache.juli.formatter=java.util.logging.SimpleFormatter"/>
++
+ <!-- Classpath -->
+- <path id="tomcat.classpath">
++ <path id="compile.classpath">
+ <pathelement location="${ant.jar}"/>
+ <pathelement location="${jdt.jar}"/>
+ </path>
+
++ <path id="tomcat.classpath">
++ <pathelement location="${tomcat.classes}"/>
++ </path>
++
++ <path id="tomcat.test.classpath">
++ <pathelement location="${tomcat.build}/webapps/examples/WEB-INF/classes"/>
++ <pathelement location="${test.classes}"/>
++ <pathelement location="${junit.jar}"/>
++ <path refid="compile.classpath" />
++ <path refid="tomcat.classpath" />
++ </path>
++
+ <!-- Version info filter set -->
+ <tstamp>
+ <format property="year" pattern="yyyy" locale="en"/>
+@@ -135,7 +152,7 @@
+
+ </target>
+
+- <target name="compile">
++ <target name="compile" depends="build-prepare">
+
+ <!-- Compile internal server components -->
+ <javac srcdir="java" destdir="${tomcat.classes}"
+@@ -149,7 +166,7 @@
+ <!-- Comment this in to show unchecked warnings:
+ <compilerarg value="-Xlint:unchecked"/>
+ -->
+- <classpath refid="tomcat.classpath" />
++ <classpath refid="compile.classpath" />
+ <exclude name="org/apache/naming/factory/webservices/**" />
+ </javac>
+ <!-- Copy static resource files -->
+@@ -653,6 +670,116 @@
+
+ </target>
+
++ <!-- ========================= Testing ========================== -->
++
++ <target name="download-test-compile"
++ description="Download additional components for the tests" >
++
++ <antcall target="downloadzip">
++ <param name="sourcefile" value="${junit.loc}"/>
++ <param name="destfile" value="${junit.jar}"/>
++ <param name="destdir" value="${base.path}"/>
++ </antcall>
++
++ </target>
++
++ <target name="test-compile" depends="compile,download-test-compile" >
++ <mkdir dir="${test.classes}"/>
++ <!-- Compile -->
++ <javac srcdir="test" destdir="${test.classes}"
++ debug="${compile.debug}"
++ deprecation="${compile.deprecation}"
++ source="${compile.source}"
++ optimize="${compile.optimize}"
++ encoding="ISO-8859-1"
++ includeantruntime="false">
++ <classpath refid="tomcat.test.classpath" />
++ <include name="org/apache/**" />
++ <include name="javax/**" />
++ </javac>
++ </target>
++
++ <!-- Default JUnit log output formatter -->
++ <property name="junit.formatter.type" value="plain" />
++ <property name="junit.formatter.usefile" value="true" />
++ <property name="junit.formatter.extension" value=".txt" />
++
++ <target name="test" description="Runs the JUnit test cases"
++ depends="test-bio,test-nio,test-apr" >
++ <fail if="test.result.error" message='Some tests completed with an Error.
See ${tomcat.build}/logs for details, search for "FAILED".' />
++ <fail if="test.result.failure" message='Some tests completed with a
Failure. See ${tomcat.build}/logs for details, search for "FAILED".' />
++ </target>
++
++ <target name="test-bio" description="Runs the JUnit test cases for BIO.
Does not stop on errors."
++ depends="test-compile,deploy" if="${execute.test.bio}">
++ <runtests protocol="org.apache.coyote.http11.Http11Protocol"
++ extension=".BIO" />
++ </target>
++
++ <target name="test-nio" description="Runs the JUnit test cases for NIO.
Does not stop on errors."
++ depends="test-compile,deploy" if="${execute.test.nio}">
++ <runtests protocol="org.apache.coyote.http11.Http11NioProtocol"
++ extension=".NIO" />
++ </target>
++
++ <target name="test-apr" description="Runs the JUnit test cases for APR.
Does not stop on errors."
++ depends="test-compile,deploy,test-apr-exists"
++ if="${apr.exists}">
++ <runtests protocol="org.apache.coyote.http11.Http11AprProtocol"
++ extension=".APR" />
++ </target>
++
++ <target name="test-apr-exists" description="Checks for APR lib"
++ if="${execute.test.apr}">
++ <available file="${test.apr.loc}" property="apr.exists" />
++ </target>
++
++ <macrodef name="runtests"
++ description="Runs the unit tests using the specified connector.
++ Does not stop on errors, but sets 'test.result.error' and
'test.result.failure' properties.">
++ <attribute name="protocol"
++ description="The class name for the connector protocol"/>
++ <attribute name="extension"
++ description="The extension to use to distinguish the output"/>
++
++ <sequential>
++ <junit printsummary="yes" fork="yes" dir="." showoutput="yes"
++ errorproperty="test.result.error"
++ failureproperty="test.result.failure"
++ haltonfailure="${test.haltonfailure}" >
++
++ <jvmarg value="-Djava.library.path=${test.apr.loc}"/>
++ <jvmarg value="${test.formatter}"/>
++
++ <classpath refid="tomcat.test.classpath" />
++
++ <sysproperty key="tomcat.test.temp" value="${test.temp}" />
++ <sysproperty key="tomcat.test.tomcatbuild" value="${tomcat.build}" />
++ <sysproperty key="tomcat.test.protocol" value="@{protocol}" />
++ <sysproperty key="tomcat.test.accesslog" value="${test.accesslog}" />
++
++ <formatter type="${junit.formatter.type}"
++ usefile="${junit.formatter.usefile}"
++ extension="@{extension}${junit.formatter.extension}" />
++
++ <!-- If test.entry is defined, run a single test, otherwise run all
valid tests -->
++ <test todir="${tomcat.build}/logs" name="${test.entry}"
if="test.entry"/>
++ <batchtest todir="${tomcat.build}/logs" unless="test.entry">
++ <fileset dir="test" >
++ <!-- Include all by default -->
++ <include name="${test.name}" />
++ <!-- Exclude helper classes -->
++ <exclude name="**/Tester*.java" />
++ <!-- Exclude the tests known to fail -->
++ <exclude name="org/apache/catalina/tribes/test/**" />
++ </fileset>
++ </batchtest>
++ </junit>
++ </sequential>
++ </macrodef>
++
++ <!-- ========================= Cleaning Targets ==========================
-->
++
+ <target name="clean-depend"
+ description="Clean depend src components">
+ <delete dir="${tomcat-dbcp.home}"/>
+@@ -662,8 +789,12 @@
+ <delete dir="${tomcat.classes}" />
+ <delete dir="${tomcat.build}" />
+ <delete dir="${tomcat.manifests}" />
++ <delete dir="${test.classes}" />
++ <delete dir="${test.temp}" />
+ </target>
+
++ <!-- ================ Download and dependency building ===================
-->
++
+ <!-- Download and dependency building -->
+ <target name="proxyflags">
+ <!-- check proxy parameters. -->
+Index: BRANCH-README.txt
+===================================================================
+--- BRANCH-README.txt (.../trunk) (revision 0)
++++ BRANCH-README.txt (.../branches/tomcat6-testing) (revision 1444299)
+@@ -0,0 +1,47 @@
++This branch is created with the goal to improve JUnit tests in Tomcat 6.
++
++It is maintained as a reintegrate-able branch with regular catch-up
++merges from tc6.0.x/trunk.
++
++Created: 2012-11-12 from r1408230
++Last catch-up merge: 2013-02-09, merged up to r1444297
++
++Revisions in 6.0.x/trunk that are merges from this branch:
++r1417826,1444292
++
++
++TODO:
++
++ * Backport support for running JUnit tests to the main /build.xml
++ file from Tomcat 7. Add <target name="test">. [Done]
++
++ Notes:
++ - The < if="${execute.test.bio}"> construct requires Ant >= 1.8.0
++ http://ant.apache.org/manual/properties.html#if+unless
++
++ - Separate "test-bio", "test-nio", "test-apr" targets are there,
++ but they do not make much sense as the tests do not start Tomcat.
++
++ - "test.jvmarg.egd=-Djava.security.egd=file:/dev/./urandom"
++ property was not ported, as it is not needed for Tomcat 6.
++
++ * Drop useless test/build.xml [Not
Started]
++
++ * Review existing tests, align with Tomcat 7, convert to JUnit 4. [Not
Started]
++
++ * Update BUILDING.txt. [Not
Started]
++
++ * The results at this point can be proposed to be merged back to
++ tc6.0.x/trunk.
++
++ * Maybe it will be possible to backport the tests that start a Tomcat
++ server instance, using an idea from [1]. [Not
Started]
++
++ [1] http://tomcat.markmail.org/thread/ko7ip7obvyaftwe4
++
++ * Configure Apache Gump to run the tests. [Not
Started]
++
++
++(Regarding BRANCH-README files - see Apache Subversion Community Guide
++ http://subversion.apache.org/docs/community-guide/general.html#branch-policy
++)
+
+Property changes on: BRANCH-README.txt
+___________________________________________________________________
+Added: svn:eol-style
+## -0,0 +1 ##
++native
+\ No newline at end of property
+Added: svn:mime-type
+## -0,0 +1 ##
++text/plain
+\ No newline at end of property
+Index: build.properties.default
+===================================================================
+--- build.properties.default (.../trunk) (revision 1444299)
++++ build.properties.default (.../branches/tomcat6-testing) (revision
1444299)
+@@ -43,6 +43,19 @@
+ compile.target=1.5
+ compile.debug=true
+
++# ----- Build control flags -----
++# Note enabling validation uses Checkstyle which is LGPL licensed
++execute.validate=false
++execute.test.bio=true
++execute.test.nio=true
++# Still requires APR/native library to be present
++execute.test.apr=true
++# Stop testing if a failure occurs
++test.haltonfailure=false
++# Activate AccessLog during testing
++test.accesslog=false
++
++
+ base-apache.loc.1=http://www.apache.org/dist
+ base-apache.loc.2=http://archive.apache.org/dist
+ base-commons.loc.1=${base-apache.loc.1}/commons
+@@ -159,3 +172,9 @@
+
commons-daemon.native.src.loc.2=${base-commons.loc.2}/daemon/source/commons-daemon-${commons-daemon.version}-native-src.tar.gz
+
commons-daemon.native.win.loc.1=${base-commons.loc.1}/daemon/binaries/windows/commons-daemon-${commons-daemon.version}-bin-windows.zip
+
commons-daemon.native.win.loc.2=${base-commons.loc.2}/daemon/binaries/windows/commons-daemon-${commons-daemon.version}-bin-windows.zip
++
++# ----- JUnit Unit Test Suite, version 4.8 or later -----
++junit.home=${base.path}/junit4.8.2
++junit.lib=${junit.home}
++junit.jar=${junit.lib}/junit-4.8.2.jar
++junit.loc=http://cloud.github.com/downloads/KentBeck/junit/junit4.8.2.zip
+Index: test/org/apache/juli/TestDateFormatCache.java
+===================================================================
+--- test/org/apache/juli/TestDateFormatCache.java (.../trunk)
(revision 0)
++++ test/org/apache/juli/TestDateFormatCache.java
(.../branches/tomcat6-testing) (revision 1444299)
+@@ -0,0 +1,109 @@
++/*
++ * Licensed to the Apache Software Foundation (ASF) under one or more
++ * contributor license agreements. See the NOTICE file distributed with
++ * this work for additional information regarding copyright ownership.
++ * The ASF licenses this file to You under the Apache License, Version 2.0
++ * (the "License"); you may not use this file except in compliance with
++ * the License. You may obtain a copy of the License at
++ *
++ * http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++package org.apache.juli;
++
++import java.lang.reflect.Field;
++import java.text.SimpleDateFormat;
++import java.util.Date;
++import java.util.Locale;
++import java.util.TimeZone;
++
++import org.junit.Assert;
++import org.junit.Test;
++
++public class TestDateFormatCache {
++
++ @Test
++ public void testBug54044() throws Exception {
++
++ final String timeFormat = "dd-MMM-yyyy HH:mm:ss";
++ final int cacheSize = 10;
++
++ SimpleDateFormat sdf = new SimpleDateFormat(timeFormat, Locale.US);
++ sdf.setTimeZone(TimeZone.getDefault());
++
++ DateFormatCache dfc = new DateFormatCache(cacheSize, timeFormat,
null);
++
++ // Get dfc.cache.cache field
++ Object dfcCache;
++ Field dfcCacheArray;
++ {
++ Field dfcCacheField = dfc.getClass().getDeclaredField("cache");
++ dfcCacheField.setAccessible(true);
++ dfcCache = dfcCacheField.get(dfc);
++ dfcCacheArray = dfcCache.getClass().getDeclaredField("cache");
++ dfcCacheArray.setAccessible(true);
++ }
++
++ // Create an array to hold the expected values
++ String[] expected = new String[cacheSize];
++
++ // Fill the cache & populate the expected values
++ for (int secs = 0; secs < (cacheSize); secs++) {
++ dfc.getFormat(secs * 1000);
++ expected[secs] = generateExpected(sdf, secs);
++ }
++ Assert.assertArrayEquals(expected,
++ (String[]) dfcCacheArray.get(dfcCache));
++
++ // Cause the cache to roll-around by one and then confirm
++ dfc.getFormat(cacheSize * 1000);
++ expected[0] = generateExpected(sdf, cacheSize);
++ Assert.assertArrayEquals(expected,
++ (String[]) dfcCacheArray.get(dfcCache));
++
++ // Jump 2 ahead and then confirm (skipped value should be null)
++ dfc.getFormat((cacheSize + 2) * 1000);
++ expected[1] = null;
++ expected[2] = generateExpected(sdf, cacheSize + 2);
++ Assert.assertArrayEquals(expected,
++ (String[]) dfcCacheArray.get(dfcCache));
++
++ // Back 1 to fill in the gap
++ dfc.getFormat((cacheSize + 1) * 1000);
++ expected[1] = generateExpected(sdf, cacheSize + 1);
++ Assert.assertArrayEquals(expected,
++ (String[]) dfcCacheArray.get(dfcCache));
++
++ // Return to 1 and confirm skipped value is null
++ dfc.getFormat(1 * 1000);
++ expected[1] = generateExpected(sdf, 1);
++ expected[2] = null;
++ Assert.assertArrayEquals(expected,
++ (String[]) dfcCacheArray.get(dfcCache));
++
++ // Go back one further
++ dfc.getFormat(0);
++ expected[0] = generateExpected(sdf, 0);
++ Assert.assertArrayEquals(expected,
++ (String[]) dfcCacheArray.get(dfcCache));
++
++ // Jump ahead far enough that the entire cache will need to be cleared
++ dfc.getFormat(42 * 1000);
++ for (int i = 0; i < cacheSize; i++) {
++ expected[i] = null;
++ }
++ expected[0] = generateExpected(sdf, 42);
++ Assert.assertArrayEquals(expected,
++ (String[]) dfcCacheArray.get(dfcCache));
++ }
++
++ private String generateExpected(SimpleDateFormat sdf, long secs) {
++ return sdf.format(new Date(secs * 1000));
++ }
++
++}
+
+Property changes on: test/org/apache/juli/TestDateFormatCache.java
+___________________________________________________________________
+Added: svn:eol-style
+## -0,0 +1 ##
++native
+\ No newline at end of property
+Index: test/org/apache/tomcat/util/buf/TestB2CConverter.java
+===================================================================
+--- test/org/apache/tomcat/util/buf/TestB2CConverter.java (.../trunk)
(revision 0)
++++ test/org/apache/tomcat/util/buf/TestB2CConverter.java
(.../branches/tomcat6-testing) (revision 1444299)
+@@ -0,0 +1,61 @@
++/*
++ * Licensed to the Apache Software Foundation (ASF) under one or more
++ * contributor license agreements. See the NOTICE file distributed with
++ * this work for additional information regarding copyright ownership.
++ * The ASF licenses this file to You under the Apache License, Version 2.0
++ * (the "License"); you may not use this file except in compliance with
++ * the License. You may obtain a copy of the License at
++ *
++ * http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++package org.apache.tomcat.util.buf;
++
++import org.junit.Assert;
++import org.junit.Test;
++
++public class TestB2CConverter {
++
++ private static final byte[] UTF16_MESSAGE =
++ new byte[] {-2, -1, 0, 65, 0, 66, 0, 67};
++
++ @Test
++ public void testSingleMessage() throws Exception {
++ testMessages(1);
++ }
++
++ @Test
++ public void testTwoMessage() throws Exception {
++ testMessages(2);
++ }
++
++ @Test
++ public void testManyMessage() throws Exception {
++ testMessages(10);
++ }
++
++ private void testMessages(int msgCount) throws Exception {
++ B2CConverter conv = new B2CConverter("UTF-16");
++
++ ByteChunk bc = new ByteChunk();
++ CharChunk cc = new CharChunk();
++
++
++ for (int i = 0; i < msgCount; i++) {
++ bc.append(UTF16_MESSAGE, 0, UTF16_MESSAGE.length);
++ // Note: The limit is the number of characters to read
++ conv.convert(bc, cc, 3);
++ Assert.assertEquals("ABC", cc.toString());
++ bc.recycle();
++ cc.recycle();
++ conv.recycle();
++ }
++
++ System.out.println(cc);
++ }
++}
+
+Property changes on: test/org/apache/tomcat/util/buf/TestB2CConverter.java
+___________________________________________________________________
+Added: svn:eol-style
+## -0,0 +1 ##
++native
+\ No newline at end of property
+Index: java/org/apache/juli/DateFormatCache.java
+===================================================================
+--- java/org/apache/juli/DateFormatCache.java (.../trunk) (revision
1444299)
++++ java/org/apache/juli/DateFormatCache.java (.../branches/tomcat6-testing)
(revision 1444299)
+@@ -101,14 +101,14 @@
+ private class Cache {
+
+ /* Second formatted in most recent invocation */
+- private long previousSeconds = 0L;
++ private long previousSeconds = Long.MIN_VALUE;
+ /* Formatted timestamp generated in most recent invocation */
+ private String previousFormat = "";
+
+ /* First second contained in cache */
+- private long first = 0L;
++ private long first = Long.MIN_VALUE;
+ /* Last second contained in cache */
+- private long last = 0L;
++ private long last = Long.MIN_VALUE;
+ /* Index of "first" in the cyclic cache */
+ private int offset = 0;
+ /* Helper object to be able to call SimpleDateFormat.format(). */
+@@ -165,14 +165,16 @@
+ for (int i = 1; i < seconds - last; i++) {
+ cache[(index + cacheSize - i) % cacheSize] = null;
+ }
+- first = seconds - cacheSize;
++ first = seconds - (cacheSize - 1);
+ last = seconds;
++ offset = (index + 1) % cacheSize;
+ } else if (seconds < first) {
+ for (int i = 1; i < first - seconds; i++) {
+ cache[(index + i) % cacheSize] = null;
+ }
+ first = seconds;
+- last = seconds + cacheSize;
++ last = seconds + (cacheSize - 1);
++ offset = index;
+ }
+
+ /* Last step: format new timestamp either using
+Index: .
+===================================================================
+--- . (.../trunk) (revision 1444299)
++++ . (.../branches/tomcat6-testing) (revision 1444299)
+
+Property changes on: .
+___________________________________________________________________
+Modified: svn:mergeinfo
+ Reverse-merged /tomcat/tc6.0.x/branches/tomcat6-testing:r1408376,1444289
+ Reverse-merged /tomcat/tc6.0.x/trunk:r1224802
+ Merged /tomcat/tc6.0.x/trunk:r1408231-1444297
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]