You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2006/12/04 05:51:55 UTC
svn commit: r482069 [2/2] - in /ant/core/trunk/src:
main/org/apache/tools/ant/ main/org/apache/tools/ant/filters/
main/org/apache/tools/ant/taskdefs/
main/org/apache/tools/ant/taskdefs/condition/
main/org/apache/tools/ant/taskdefs/optional/extension/ m...
Modified: ant/core/trunk/src/tests/antunit/taskdefs/war-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/war-test.xml?view=diff&rev=482069&r1=482068&r2=482069
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/war-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/taskdefs/war-test.xml Sun Dec 3 20:51:50 2006
@@ -1,161 +1,161 @@
-<?xml version="1.0"?>
-
-<project name="war-test" basedir="." default="all"
- xmlns:au="antlib:org.apache.ant.antunit">
- <property name="working.dir" value="working"/>
-
- <target name="all">
- <au:antunit>
- <fileset file="${ant.file}"/>
- <au:plainlistener/>
- </au:antunit>
- </target>
-
-
- <target name="init">
- <delete dir="${working.dir}"/>
- <mkdir dir="${working.dir}"/>
- <property name="warfile" location="${working.dir}/test.war"/>
- <property name="web.xml" location="web.xml"/>
- <property name="webxml.generated" location="${working.dir}/WEB-INF/web.xml"/>
-
- <!--failing on duplicates is half our testing-->
- <presetdef name="mkwar">
- <war destfile="${warfile}" duplicate="fail"/>
- </presetdef>
- <presetdef name="expandwar">
- <unzip src="${working.dir}/test.war" dest="${working.dir}"/>
- </presetdef>
- </target>
-
- <target name="tearDown">
- <delete dir="${working.dir}"/>
- </target>
-
- <!--test that you can patch a fileset reference into a lib element-->
- <target name="testlibrefs" depends="init">
- <mkwar webxml="${web.xml}">
- <fileset id="test" dir="." includes="web.xml"/>
- <lib refid="test"/>
- </mkwar>
- <expandwar/>
- <au:assertFileExists file="${webxml.generated}" />
- </target>
-
- <!--
- This checks that as of Java EE 5, the web.xml attr is optional.
- Here there is a web.xml, in the webinf fileset, rather than a fileset
- -->
- <target name="testWebXmlInWebinf" depends="init">
- <mkwar>
- <webinf dir="." includes="web.xml"/>
- </mkwar>
- <expandwar/>
- <au:assertFileExists file="${webxml.generated}" />
- </target>
-
- <target name="testWebXmlMissingFromUpdate" depends="init">
- <mkwar webxml="${web.xml}" />
- <!-- there is no web.xml file, but that is ok, as
- we are updating -->
- <mkwar update="true">
- <classes dir="." includes="web.xml"/>
- </mkwar>
- <expandwar/>
- <au:assertFileExists file="${webxml.generated}" />
- </target>
-
- <target name="testWebXmlInImplicitUpdate" depends="init">
- <mkwar webxml="${web.xml}" />
- <!-- when we are implicitly updating, the web.xml file does not get
- pulled in, but the command still succeeds.-->
- <mkwar webxml="${web.xml}" >
- <classes dir="." includes="web.xml"/>
- </mkwar>
- <expandwar/>
- <au:assertFileExists file="${webxml.generated}" />
- </target>
-
- <target name="NotestWebXmlFilesetInImplicitUpdate" depends="init">
- <mkwar webxml="${web.xml}" />
- <!-- when we are implicitly updating, the web.xml file does not get
- pulled in, but the command still succeeds.-->
- <mkwar >
- <webinf dir="." includes="web.xml"/>
- </mkwar>
- <expandwar/>
- <au:assertFileExists file="${webxml.generated}" />
- </target>
-
-
- <target name="testDuplicateWebXml" depends="init">
- <mkwar webxml="${web.xml}" >
- <webinf dir="." includes="web.xml"/>
- <webinf file="${web.xml}"/>
- <zipfileset file="${web.xml}" prefix="WEB-INF"/>
- </mkwar>
- <expandwar/>
- <au:assertFileExists file="${webxml.generated}" />
- </target>
-
- <target name="testDifferentDuplicateWebXml" depends="init">
- <copy file="${web.xml}" todir="${working.dir}" />
- <mkwar webxml="${web.xml}" >
- <webinf dir="${working.dir}" includes="web.xml"/>
- <webinf file="${web.xml}"/>
- <zipfileset file="${web.xml}" prefix="WEB-INF"/>
- </mkwar>
- <expandwar/>
- <au:assertFileExists file="${webxml.generated}" />
- <au:assertLogContains text="The duplicate entry is"/>
- </target>
-
-
- <!--
- this target does not have a web.xml file.
- Instead it pulls in
- -->
- <target name="testWebXmlOptional" depends="init">
- <mkwar needxmlfile="false">
- <classes dir="." includes="web.xml"/>
- </mkwar>
- <expandwar/>
- <au:assertFileExists file="${working.dir}/WEB-INF/classes/web.xml" />
- <au:assertFalse>
- <available file="${webxml.generated}" />
- </au:assertFalse>
- </target>
-
- <target name="testWebXmlOptionalFailure" depends="init">
- <au:expectfailure>
- <mkwar >
- <classes dir="." includes="web.xml"/>
- </mkwar>
- </au:expectfailure>
- </target>
-
- <target name="testWebXmlOptionalFailure2" depends="init">
- <au:expectfailure>
- <mkwar needxmlfile="true">
- <classes dir="." includes="web.xml"/>
- </mkwar>
- </au:expectfailure>
- </target>
-
- <target name="testClassesElement" depends="init">
- <mkwar needxmlfile="false">
- <classes dir="." includes="web.xml"/>
- </mkwar>
- <expandwar/>
- <au:assertFileExists file="${working.dir}/WEB-INF/classes/web.xml" />
- </target>
-
- <target name="testLibElement" depends="init">
- <mkwar needxmlfile="false">
- <lib dir="." includes="web.xml"/>
- </mkwar>
- <expandwar/>
- <au:assertFileExists file="${working.dir}/WEB-INF/lib/web.xml" />
- </target>
-
-</project>
+<?xml version="1.0"?>
+
+<project name="war-test" basedir="." default="all"
+ xmlns:au="antlib:org.apache.ant.antunit">
+ <property name="working.dir" value="working"/>
+
+ <target name="all">
+ <au:antunit>
+ <fileset file="${ant.file}"/>
+ <au:plainlistener/>
+ </au:antunit>
+ </target>
+
+
+ <target name="init">
+ <delete dir="${working.dir}"/>
+ <mkdir dir="${working.dir}"/>
+ <property name="warfile" location="${working.dir}/test.war"/>
+ <property name="web.xml" location="web.xml"/>
+ <property name="webxml.generated" location="${working.dir}/WEB-INF/web.xml"/>
+
+ <!--failing on duplicates is half our testing-->
+ <presetdef name="mkwar">
+ <war destfile="${warfile}" duplicate="fail"/>
+ </presetdef>
+ <presetdef name="expandwar">
+ <unzip src="${working.dir}/test.war" dest="${working.dir}"/>
+ </presetdef>
+ </target>
+
+ <target name="tearDown">
+ <delete dir="${working.dir}"/>
+ </target>
+
+ <!--test that you can patch a fileset reference into a lib element-->
+ <target name="testlibrefs" depends="init">
+ <mkwar webxml="${web.xml}">
+ <fileset id="test" dir="." includes="web.xml"/>
+ <lib refid="test"/>
+ </mkwar>
+ <expandwar/>
+ <au:assertFileExists file="${webxml.generated}" />
+ </target>
+
+ <!--
+ This checks that as of Java EE 5, the web.xml attr is optional.
+ Here there is a web.xml, in the webinf fileset, rather than a fileset
+ -->
+ <target name="testWebXmlInWebinf" depends="init">
+ <mkwar>
+ <webinf dir="." includes="web.xml"/>
+ </mkwar>
+ <expandwar/>
+ <au:assertFileExists file="${webxml.generated}" />
+ </target>
+
+ <target name="testWebXmlMissingFromUpdate" depends="init">
+ <mkwar webxml="${web.xml}" />
+ <!-- there is no web.xml file, but that is ok, as
+ we are updating -->
+ <mkwar update="true">
+ <classes dir="." includes="web.xml"/>
+ </mkwar>
+ <expandwar/>
+ <au:assertFileExists file="${webxml.generated}" />
+ </target>
+
+ <target name="testWebXmlInImplicitUpdate" depends="init">
+ <mkwar webxml="${web.xml}" />
+ <!-- when we are implicitly updating, the web.xml file does not get
+ pulled in, but the command still succeeds.-->
+ <mkwar webxml="${web.xml}" >
+ <classes dir="." includes="web.xml"/>
+ </mkwar>
+ <expandwar/>
+ <au:assertFileExists file="${webxml.generated}" />
+ </target>
+
+ <target name="NotestWebXmlFilesetInImplicitUpdate" depends="init">
+ <mkwar webxml="${web.xml}" />
+ <!-- when we are implicitly updating, the web.xml file does not get
+ pulled in, but the command still succeeds.-->
+ <mkwar >
+ <webinf dir="." includes="web.xml"/>
+ </mkwar>
+ <expandwar/>
+ <au:assertFileExists file="${webxml.generated}" />
+ </target>
+
+
+ <target name="testDuplicateWebXml" depends="init">
+ <mkwar webxml="${web.xml}" >
+ <webinf dir="." includes="web.xml"/>
+ <webinf file="${web.xml}"/>
+ <zipfileset file="${web.xml}" prefix="WEB-INF"/>
+ </mkwar>
+ <expandwar/>
+ <au:assertFileExists file="${webxml.generated}" />
+ </target>
+
+ <target name="testDifferentDuplicateWebXml" depends="init">
+ <copy file="${web.xml}" todir="${working.dir}" />
+ <mkwar webxml="${web.xml}" >
+ <webinf dir="${working.dir}" includes="web.xml"/>
+ <webinf file="${web.xml}"/>
+ <zipfileset file="${web.xml}" prefix="WEB-INF"/>
+ </mkwar>
+ <expandwar/>
+ <au:assertFileExists file="${webxml.generated}" />
+ <au:assertLogContains text="The duplicate entry is"/>
+ </target>
+
+
+ <!--
+ this target does not have a web.xml file.
+ Instead it pulls in
+ -->
+ <target name="testWebXmlOptional" depends="init">
+ <mkwar needxmlfile="false">
+ <classes dir="." includes="web.xml"/>
+ </mkwar>
+ <expandwar/>
+ <au:assertFileExists file="${working.dir}/WEB-INF/classes/web.xml" />
+ <au:assertFalse>
+ <available file="${webxml.generated}" />
+ </au:assertFalse>
+ </target>
+
+ <target name="testWebXmlOptionalFailure" depends="init">
+ <au:expectfailure>
+ <mkwar >
+ <classes dir="." includes="web.xml"/>
+ </mkwar>
+ </au:expectfailure>
+ </target>
+
+ <target name="testWebXmlOptionalFailure2" depends="init">
+ <au:expectfailure>
+ <mkwar needxmlfile="true">
+ <classes dir="." includes="web.xml"/>
+ </mkwar>
+ </au:expectfailure>
+ </target>
+
+ <target name="testClassesElement" depends="init">
+ <mkwar needxmlfile="false">
+ <classes dir="." includes="web.xml"/>
+ </mkwar>
+ <expandwar/>
+ <au:assertFileExists file="${working.dir}/WEB-INF/classes/web.xml" />
+ </target>
+
+ <target name="testLibElement" depends="init">
+ <mkwar needxmlfile="false">
+ <lib dir="." includes="web.xml"/>
+ </mkwar>
+ <expandwar/>
+ <au:assertFileExists file="${working.dir}/WEB-INF/lib/web.xml" />
+ </target>
+
+</project>
Propchange: ant/core/trunk/src/tests/antunit/taskdefs/war-test.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/core/trunk/src/tests/antunit/taskdefs/web.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/web.xml?view=diff&rev=482069&r1=482068&r2=482069
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/web.xml (original)
+++ ant/core/trunk/src/tests/antunit/taskdefs/web.xml Sun Dec 3 20:51:50 2006
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<web-app xmlns="http://java.sun.com/xml/ns/javaee"
- version="2.5" metadata-complete="true">
-
-</web-app>
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+ version="2.5" metadata-complete="true">
+
+</web-app>
Propchange: ant/core/trunk/src/tests/antunit/taskdefs/web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/core/trunk/src/tests/antunit/types/fileset-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/types/fileset-test.xml?view=diff&rev=482069&r1=482068&r2=482069
==============================================================================
--- ant/core/trunk/src/tests/antunit/types/fileset-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/types/fileset-test.xml Sun Dec 3 20:51:50 2006
@@ -1,32 +1,32 @@
-<project xmlns:au="antlib:org.apache.ant.antunit" default="all">
-
- <target name="test-fileset-with-if">
- <fileset id="this.xml" dir=".">
- <include if="trigger.include" name="fileset-test.xml"/>
- </fileset>
- <pathconvert refid="this.xml" property="this.xml.prop" pathsep="${line.separator}" setonempty="false"/>
- <au:assertTrue message="fileset this.xml should not contain anything but contains ${this.xml.prop}">
- <not>
- <isset property="this.xml.prop"/>
- </not>
- </au:assertTrue>
- </target>
-
- <target name="test-fileset-with-if-property-set">
- <property name="trigger.include" value="true"/>
- <fileset id="this.xml" dir=".">
- <include if="trigger.include" name="fileset-test.xml"/>
- </fileset>
- <pathconvert refid="this.xml" property="this.xml.prop" pathsep="${line.separator}" setonempty="false"/>
- <au:assertPropertySet name="this.xml.prop" message="fileset should contain one file"/>
- <echo>${this.xml.prop}</echo>
- <au:assertLogContains text="fileset-test.xml"/>
- </target>
-
- <target name="all">
- <au:antunit>
- <fileset dir="${basedir}" includes="fileset-test.xml"/>
- <au:plainlistener/>
- </au:antunit>
- </target>
-</project>
+<project xmlns:au="antlib:org.apache.ant.antunit" default="all">
+
+ <target name="test-fileset-with-if">
+ <fileset id="this.xml" dir=".">
+ <include if="trigger.include" name="fileset-test.xml"/>
+ </fileset>
+ <pathconvert refid="this.xml" property="this.xml.prop" pathsep="${line.separator}" setonempty="false"/>
+ <au:assertTrue message="fileset this.xml should not contain anything but contains ${this.xml.prop}">
+ <not>
+ <isset property="this.xml.prop"/>
+ </not>
+ </au:assertTrue>
+ </target>
+
+ <target name="test-fileset-with-if-property-set">
+ <property name="trigger.include" value="true"/>
+ <fileset id="this.xml" dir=".">
+ <include if="trigger.include" name="fileset-test.xml"/>
+ </fileset>
+ <pathconvert refid="this.xml" property="this.xml.prop" pathsep="${line.separator}" setonempty="false"/>
+ <au:assertPropertySet name="this.xml.prop" message="fileset should contain one file"/>
+ <echo>${this.xml.prop}</echo>
+ <au:assertLogContains text="fileset-test.xml"/>
+ </target>
+
+ <target name="all">
+ <au:antunit>
+ <fileset dir="${basedir}" includes="fileset-test.xml"/>
+ <au:plainlistener/>
+ </au:antunit>
+ </target>
+</project>
Propchange: ant/core/trunk/src/tests/antunit/types/fileset-test.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestClassPathTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestClassPathTest.java?view=diff&rev=482069&r1=482068&r2=482069
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestClassPathTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestClassPathTest.java Sun Dec 3 20:51:50 2006
@@ -1,161 +1,161 @@
-/*
- * 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.tools.ant.taskdefs;
-
-
-import org.apache.tools.ant.taskdefs.condition.Os;
-import org.apache.tools.ant.util.JavaEnvUtils;
-import org.apache.tools.ant.BuildFileTest;
-
-/**
- * Tests <bm:manifestclasspath>.
- */
-public class ManifestClassPathTest
- extends BuildFileTest {
-
- public void setUp() {
- configureProject("src/etc/testcases/taskdefs/manifestclasspath.xml");
- }
-
- public void testBadDirectory() {
- expectBuildExceptionContaining("test-bad-directory", "bad-jar-dir",
- "Jar's directory not found:");
- assertPropertyUnset("jar.classpath");
- }
-
- public void testBadNoProperty() {
- expectBuildExceptionContaining("test-bad-no-property", "no-property",
- "Missing 'property' attribute!");
- assertPropertyUnset("jar.classpath");
- }
-
- public void testBadPropertyExists() {
- expectBuildExceptionContaining("test-bad-property-exists",
- "property-exits", "Property 'jar.classpath' already set!");
- assertPropertyEquals("jar.classpath", "exists");
- }
-
- public void testBadNoJarfile() {
- expectBuildExceptionContaining("test-bad-no-jarfile", "no-jarfile",
- "Missing 'jarfile' attribute!");
- assertPropertyUnset("jar.classpath");
- }
-
- public void testBadNoClassPath() {
- expectBuildExceptionContaining("test-bad-no-classpath", "no-classpath",
- "Missing nested <classpath>!");
- assertPropertyUnset("jar.classpath");
- }
-
- public void testParentLevel1() {
- executeTarget("test-parent-level1");
-
- assertPropertyEquals("jar.classpath", "dsp-core/ " +
- "dsp-pres/ " +
- "dsp-void/ " +
- "../generated/dsp-core/ " +
- "../generated/dsp-pres/ " +
- "../generated/dsp-void/ " +
- "../resources/dsp-core/ " +
- "../resources/dsp-pres/ " +
- "../resources/dsp-void/");
- }
-
- public void testParentLevel2() {
- executeTarget("test-parent-level2");
-
- assertPropertyEquals("jar.classpath", "../dsp-core/ " +
- "../dsp-pres/ " +
- "../dsp-void/ " +
- "../../generated/dsp-core/ " +
- "../../generated/dsp-pres/ " +
- "../../generated/dsp-void/ " +
- "../../resources/dsp-core/ " +
- "../../resources/dsp-pres/ " +
- "../../resources/dsp-void/");
- }
-
- public void testParentLevel2TooDeep() {
- expectBuildExceptionContaining("test-parent-level2-too-deep", "nopath",
- "No suitable relative path from ");
- assertPropertyUnset("jar.classpath");
- }
-
- public void testPseudoTahoeRefid() {
- executeTarget("test-pseudo-tahoe-refid");
-
- assertPropertyEquals("jar.classpath", "classes/dsp-core/ " +
- "classes/dsp-pres/ " +
- "classes/dsp-void/ " +
- "generated/dsp-core/ " +
- "resources/dsp-core/ " +
- "resources/dsp-pres/");
- }
-
- public void testPseudoTahoeNested() {
- executeTarget("test-pseudo-tahoe-nested");
-
- assertPropertyEquals("jar.classpath", "classes/dsp-core/ " +
- "classes/dsp-pres/ " +
- "classes/dsp-void/ " +
- "generated/dsp-core/ " +
- "resources/dsp-core/ " +
- "resources/dsp-pres/");
- }
-
- public void testParentLevel2WithJars() {
- executeTarget("test-parent-level2-with-jars");
-
- assertPropertyEquals("jar.classpath", "../../lib/acme-core.jar " +
- "../../lib/acme-pres.jar " +
- "../dsp-core/ " +
- "../dsp-pres/ " +
- "../dsp-void/ " +
- "../../generated/dsp-core/ " +
- "../../generated/dsp-pres/ " +
- "../../generated/dsp-void/ " +
- "../../resources/dsp-core/ " +
- "../../resources/dsp-pres/ " +
- "../../resources/dsp-void/");
- }
- public void testInternationalGerman() {
- if (!JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_1_4))
- {
- System.out.println("Test with international characters skipped under pre 1.4 jvm.");
- return;
- }
- executeTarget("international-german");
- expectLogContaining("run-two-jars", "beta alpha");
-
- }
- public void testInternationalHebrew() {
- if (!JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_1_4)) {
- System.out.println("Test with international characters skipped under pre 1.4 jvm.");
- return;
- }
- if (!Os.isFamily("windows")) {
- executeTarget("international-hebrew");
- expectLogContaining("run-two-jars", "beta alpha");
- } else {
- System.out.println("Test with hebrew path not attempted under Windows");
- }
-
- }
-
-} // END class ManifestClassPathTest
-
+/*
+ * 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.tools.ant.taskdefs;
+
+
+import org.apache.tools.ant.taskdefs.condition.Os;
+import org.apache.tools.ant.util.JavaEnvUtils;
+import org.apache.tools.ant.BuildFileTest;
+
+/**
+ * Tests <bm:manifestclasspath>.
+ */
+public class ManifestClassPathTest
+ extends BuildFileTest {
+
+ public void setUp() {
+ configureProject("src/etc/testcases/taskdefs/manifestclasspath.xml");
+ }
+
+ public void testBadDirectory() {
+ expectBuildExceptionContaining("test-bad-directory", "bad-jar-dir",
+ "Jar's directory not found:");
+ assertPropertyUnset("jar.classpath");
+ }
+
+ public void testBadNoProperty() {
+ expectBuildExceptionContaining("test-bad-no-property", "no-property",
+ "Missing 'property' attribute!");
+ assertPropertyUnset("jar.classpath");
+ }
+
+ public void testBadPropertyExists() {
+ expectBuildExceptionContaining("test-bad-property-exists",
+ "property-exits", "Property 'jar.classpath' already set!");
+ assertPropertyEquals("jar.classpath", "exists");
+ }
+
+ public void testBadNoJarfile() {
+ expectBuildExceptionContaining("test-bad-no-jarfile", "no-jarfile",
+ "Missing 'jarfile' attribute!");
+ assertPropertyUnset("jar.classpath");
+ }
+
+ public void testBadNoClassPath() {
+ expectBuildExceptionContaining("test-bad-no-classpath", "no-classpath",
+ "Missing nested <classpath>!");
+ assertPropertyUnset("jar.classpath");
+ }
+
+ public void testParentLevel1() {
+ executeTarget("test-parent-level1");
+
+ assertPropertyEquals("jar.classpath", "dsp-core/ " +
+ "dsp-pres/ " +
+ "dsp-void/ " +
+ "../generated/dsp-core/ " +
+ "../generated/dsp-pres/ " +
+ "../generated/dsp-void/ " +
+ "../resources/dsp-core/ " +
+ "../resources/dsp-pres/ " +
+ "../resources/dsp-void/");
+ }
+
+ public void testParentLevel2() {
+ executeTarget("test-parent-level2");
+
+ assertPropertyEquals("jar.classpath", "../dsp-core/ " +
+ "../dsp-pres/ " +
+ "../dsp-void/ " +
+ "../../generated/dsp-core/ " +
+ "../../generated/dsp-pres/ " +
+ "../../generated/dsp-void/ " +
+ "../../resources/dsp-core/ " +
+ "../../resources/dsp-pres/ " +
+ "../../resources/dsp-void/");
+ }
+
+ public void testParentLevel2TooDeep() {
+ expectBuildExceptionContaining("test-parent-level2-too-deep", "nopath",
+ "No suitable relative path from ");
+ assertPropertyUnset("jar.classpath");
+ }
+
+ public void testPseudoTahoeRefid() {
+ executeTarget("test-pseudo-tahoe-refid");
+
+ assertPropertyEquals("jar.classpath", "classes/dsp-core/ " +
+ "classes/dsp-pres/ " +
+ "classes/dsp-void/ " +
+ "generated/dsp-core/ " +
+ "resources/dsp-core/ " +
+ "resources/dsp-pres/");
+ }
+
+ public void testPseudoTahoeNested() {
+ executeTarget("test-pseudo-tahoe-nested");
+
+ assertPropertyEquals("jar.classpath", "classes/dsp-core/ " +
+ "classes/dsp-pres/ " +
+ "classes/dsp-void/ " +
+ "generated/dsp-core/ " +
+ "resources/dsp-core/ " +
+ "resources/dsp-pres/");
+ }
+
+ public void testParentLevel2WithJars() {
+ executeTarget("test-parent-level2-with-jars");
+
+ assertPropertyEquals("jar.classpath", "../../lib/acme-core.jar " +
+ "../../lib/acme-pres.jar " +
+ "../dsp-core/ " +
+ "../dsp-pres/ " +
+ "../dsp-void/ " +
+ "../../generated/dsp-core/ " +
+ "../../generated/dsp-pres/ " +
+ "../../generated/dsp-void/ " +
+ "../../resources/dsp-core/ " +
+ "../../resources/dsp-pres/ " +
+ "../../resources/dsp-void/");
+ }
+ public void testInternationalGerman() {
+ if (!JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_1_4))
+ {
+ System.out.println("Test with international characters skipped under pre 1.4 jvm.");
+ return;
+ }
+ executeTarget("international-german");
+ expectLogContaining("run-two-jars", "beta alpha");
+
+ }
+ public void testInternationalHebrew() {
+ if (!JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_1_4)) {
+ System.out.println("Test with international characters skipped under pre 1.4 jvm.");
+ return;
+ }
+ if (!Os.isFamily("windows")) {
+ executeTarget("international-hebrew");
+ expectLogContaining("run-two-jars", "beta alpha");
+ } else {
+ System.out.println("Test with hebrew path not attempted under Windows");
+ }
+
+ }
+
+} // END class ManifestClassPathTest
+
Propchange: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestClassPathTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/StyleTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/StyleTest.java?view=diff&rev=482069&r1=482068&r2=482069
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/StyleTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/StyleTest.java Sun Dec 3 20:51:50 2006
@@ -211,4 +211,4 @@
content.indexOf(contains) > -1);
}
-}
\ No newline at end of file
+}
Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/SubAntTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/SubAntTest.java?view=diff&rev=482069&r1=482068&r2=482069
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/SubAntTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/SubAntTest.java Sun Dec 3 20:51:50 2006
@@ -141,4 +141,4 @@
}
-}
\ No newline at end of file
+}
Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/SyncTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/SyncTest.java?view=diff&rev=482069&r1=482068&r2=482069
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/SyncTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/SyncTest.java Sun Dec 3 20:51:50 2006
@@ -133,4 +133,4 @@
assertTrue("Didn't expect file " + f,
!getProject().resolveFile(f).exists());
}
-}
\ No newline at end of file
+}
Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/condition/AntVersionTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/condition/AntVersionTest.java?view=diff&rev=482069&r1=482068&r2=482069
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/condition/AntVersionTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/condition/AntVersionTest.java Sun Dec 3 20:51:50 2006
@@ -1,43 +1,43 @@
-/*
- * 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.tools.ant.taskdefs.condition;
-
-import org.apache.tools.ant.BuildFileTest;
-
-/**
- * Testcases for the <antversion> condition.
- *
- */
-public class AntVersionTest extends BuildFileTest {
-
- public AntVersionTest(String name) {
- super(name);
- }
-
- public void setUp() throws Exception {
- configureProject("src/etc/testcases/taskdefs/conditions/antversion.xml");
- }
-
- public void testAtLeast() {
- executeTarget("testatleast");
- }
-
- public void testExactly() {
- executeTarget("testexactly");
- }
-}
+/*
+ * 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.tools.ant.taskdefs.condition;
+
+import org.apache.tools.ant.BuildFileTest;
+
+/**
+ * Testcases for the <antversion> condition.
+ *
+ */
+public class AntVersionTest extends BuildFileTest {
+
+ public AntVersionTest(String name) {
+ super(name);
+ }
+
+ public void setUp() throws Exception {
+ configureProject("src/etc/testcases/taskdefs/conditions/antversion.xml");
+ }
+
+ public void testAtLeast() {
+ executeTarget("testatleast");
+ }
+
+ public void testExactly() {
+ executeTarget("testexactly");
+ }
+}
Propchange: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/condition/AntVersionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/optional/JavahTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/optional/JavahTest.java?view=diff&rev=482069&r1=482068&r2=482069
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/optional/JavahTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/optional/JavahTest.java Sun Dec 3 20:51:50 2006
@@ -42,4 +42,4 @@
.exists());
}
-}
\ No newline at end of file
+}
Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/optional/RpmTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/optional/RpmTest.java?view=diff&rev=482069&r1=482068&r2=482069
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/optional/RpmTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/optional/RpmTest.java Sun Dec 3 20:51:50 2006
@@ -63,4 +63,4 @@
}
}
-}
\ No newline at end of file
+}
Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/DOMUtilTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/DOMUtilTest.java?view=diff&rev=482069&r1=482068&r2=482069
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/DOMUtilTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/DOMUtilTest.java Sun Dec 3 20:51:50 2006
@@ -1,49 +1,49 @@
-/*
- * 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.tools.ant.taskdefs.optional.junit;
-
-import junit.framework.TestCase;
-
-import javax.xml.parsers.DocumentBuilder;
-
-import org.apache.tools.ant.util.JAXPUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Node;
-import org.xml.sax.SAXException;
-
-import java.io.InputStream;
-import java.io.IOException;
-
-public class DOMUtilTest extends TestCase {
- public void testListChildNodes() throws SAXException, IOException {
- DocumentBuilder db = JAXPUtils.getDocumentBuilder();
- InputStream is = this.getClass().getClassLoader().getResourceAsStream("taskdefs/optional/junit/matches.xml");
- Document doc = db.parse(is);
- NodeList nl = DOMUtil.listChildNodes(doc.getFirstChild(), new FooNodeFilter(), true);
- assertEquals(nl.getLength(), 3);
- }
- public class FooNodeFilter implements DOMUtil.NodeFilter {
- public boolean accept(Node node) {
- if (node.getNodeName().equals("foo")) {
- return true;
- }
- return false; //To change body of implemented methods use File | Settings | File Templates.
- }
- }
-}
+/*
+ * 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.tools.ant.taskdefs.optional.junit;
+
+import junit.framework.TestCase;
+
+import javax.xml.parsers.DocumentBuilder;
+
+import org.apache.tools.ant.util.JAXPUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+
+import java.io.InputStream;
+import java.io.IOException;
+
+public class DOMUtilTest extends TestCase {
+ public void testListChildNodes() throws SAXException, IOException {
+ DocumentBuilder db = JAXPUtils.getDocumentBuilder();
+ InputStream is = this.getClass().getClassLoader().getResourceAsStream("taskdefs/optional/junit/matches.xml");
+ Document doc = db.parse(is);
+ NodeList nl = DOMUtil.listChildNodes(doc.getFirstChild(), new FooNodeFilter(), true);
+ assertEquals(nl.getLength(), 3);
+ }
+ public class FooNodeFilter implements DOMUtil.NodeFilter {
+ public boolean accept(Node node) {
+ if (node.getNodeName().equals("foo")) {
+ return true;
+ }
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+ }
+}
Propchange: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/DOMUtilTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/SuiteMethodTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/SuiteMethodTest.java?view=diff&rev=482069&r1=482068&r2=482069
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/SuiteMethodTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/SuiteMethodTest.java Sun Dec 3 20:51:50 2006
@@ -39,4 +39,4 @@
assertTrue(true);
}
}
-}
\ No newline at end of file
+}
Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/types/resources/JavaResourceTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/types/resources/JavaResourceTest.java?view=diff&rev=482069&r1=482068&r2=482069
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/types/resources/JavaResourceTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/types/resources/JavaResourceTest.java Sun Dec 3 20:51:50 2006
@@ -38,4 +38,4 @@
assertTrue(getProject().getProperty("manifest")
.startsWith("Manifest-Version:"));
}
-}
\ No newline at end of file
+}
Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/types/resources/TarResourceTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/types/resources/TarResourceTest.java?view=diff&rev=482069&r1=482068&r2=482069
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/types/resources/TarResourceTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/types/resources/TarResourceTest.java Sun Dec 3 20:51:50 2006
@@ -41,4 +41,4 @@
assertTrue(FU.contentEquals(project.resolveFile("../../asf-logo.gif"),
project.resolveFile("testout/asf-logo.gif")));
}
-}
\ No newline at end of file
+}
Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/types/selectors/MockAlgorithm.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/types/selectors/MockAlgorithm.java?view=diff&rev=482069&r1=482068&r2=482069
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/types/selectors/MockAlgorithm.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/types/selectors/MockAlgorithm.java Sun Dec 3 20:51:50 2006
@@ -34,4 +34,4 @@
public String toString() {
return "MockAlgorithm@" + hashCode();
}
-}
\ No newline at end of file
+}
Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/types/selectors/MockCache.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/types/selectors/MockCache.java?view=diff&rev=482069&r1=482068&r2=482069
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/types/selectors/MockCache.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/types/selectors/MockCache.java Sun Dec 3 20:51:50 2006
@@ -65,4 +65,4 @@
private void log(String msg) {
if (debug) System.out.println(this+msg);
}
-}//class-MockCache
\ No newline at end of file
+}//class-MockCache
Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/types/selectors/MockComparator.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/types/selectors/MockComparator.java?view=diff&rev=482069&r1=482068&r2=482069
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/types/selectors/MockComparator.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/types/selectors/MockComparator.java Sun Dec 3 20:51:50 2006
@@ -29,4 +29,4 @@
public String toString() {
return "MockComparator";
}
-}//class-MockCache
\ No newline at end of file
+}//class-MockCache
Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java?view=diff&rev=482069&r1=482068&r2=482069
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java Sun Dec 3 20:51:50 2006
@@ -1014,4 +1014,4 @@
}//class-MockProject
-}//class-ModifiedSelectorTest
\ No newline at end of file
+}//class-ModifiedSelectorTest
Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java?view=diff&rev=482069&r1=482068&r2=482069
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java Sun Dec 3 20:51:50 2006
@@ -1,96 +1,96 @@
-/*
- * 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.tools.ant.util;
-
-import java.io.*;
-
-import junit.framework.TestCase;
-
-/**
- * Test for ReaderInputStream
- */
-public class ReaderInputStreamTest extends TestCase {
- public ReaderInputStreamTest(String s) {
- super(s);
- }
-
- public void testSimple() throws Exception {
- compareBytes("abc", "utf-8");
- }
-
- public void testSimple16() throws Exception {
- compareBytes("a", "utf-16");
- }
-
- public void testSimpleAbc16() throws Exception {
- // THIS WILL FAIL.
- //compareBytes("abc", "utf-16");
- byte[] bytes = new byte[40];
- int pos = 0;
- ReaderInputStream r = new ReaderInputStream(
- new StringReader("abc"), "utf-16");
- for (int i = 0; true; ++i) {
- int res = r.read();
- if (res == -1) {
- break;
- }
- bytes[pos++] = (byte) res;
- }
- bytes = "abc".getBytes("utf-16");
- // String n = new String(bytes, 0, pos, "utf-16");
- String n = new String(bytes, 0, bytes.length, "utf-16");
- System.out.println(n);
- }
-
- public void testReadZero() throws Exception {
- ReaderInputStream r = new ReaderInputStream(
- new StringReader("abc"));
- byte[] bytes = new byte[30];
- // First read in zero bytes
- r.read(bytes, 0, 0);
- // Now read in the string
- int readin = r.read(bytes, 0, 10);
- // Make sure that the counts are the same
- assertEquals("abc".getBytes().length, readin);
- }
-
- public void testPreample() throws Exception {
- byte[] bytes = "".getBytes("utf-16");
- System.out.println("Preample len is " + bytes.length);
- }
-
- private void compareBytes(String s, String encoding) throws Exception {
- byte[] expected = s.getBytes(encoding);
-
- ReaderInputStream r = new ReaderInputStream(
- new StringReader(s), encoding);
- for (int i = 0; i < expected.length; ++i) {
- int expect = expected[i] & 0xFF;
- int read = r.read();
- if (expect != read) {
- fail("Mismatch in ReaderInputStream at index " + i
- + " expecting " + expect + " got " + read + " for string "
- + s + " with encoding " + encoding);
- }
- }
- if (r.read() != -1) {
- fail("Mismatch in ReaderInputStream - EOF not seen for string "
- + s + " with encoding " + encoding);
- }
- }
-}
+/*
+ * 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.tools.ant.util;
+
+import java.io.*;
+
+import junit.framework.TestCase;
+
+/**
+ * Test for ReaderInputStream
+ */
+public class ReaderInputStreamTest extends TestCase {
+ public ReaderInputStreamTest(String s) {
+ super(s);
+ }
+
+ public void testSimple() throws Exception {
+ compareBytes("abc", "utf-8");
+ }
+
+ public void testSimple16() throws Exception {
+ compareBytes("a", "utf-16");
+ }
+
+ public void testSimpleAbc16() throws Exception {
+ // THIS WILL FAIL.
+ //compareBytes("abc", "utf-16");
+ byte[] bytes = new byte[40];
+ int pos = 0;
+ ReaderInputStream r = new ReaderInputStream(
+ new StringReader("abc"), "utf-16");
+ for (int i = 0; true; ++i) {
+ int res = r.read();
+ if (res == -1) {
+ break;
+ }
+ bytes[pos++] = (byte) res;
+ }
+ bytes = "abc".getBytes("utf-16");
+ // String n = new String(bytes, 0, pos, "utf-16");
+ String n = new String(bytes, 0, bytes.length, "utf-16");
+ System.out.println(n);
+ }
+
+ public void testReadZero() throws Exception {
+ ReaderInputStream r = new ReaderInputStream(
+ new StringReader("abc"));
+ byte[] bytes = new byte[30];
+ // First read in zero bytes
+ r.read(bytes, 0, 0);
+ // Now read in the string
+ int readin = r.read(bytes, 0, 10);
+ // Make sure that the counts are the same
+ assertEquals("abc".getBytes().length, readin);
+ }
+
+ public void testPreample() throws Exception {
+ byte[] bytes = "".getBytes("utf-16");
+ System.out.println("Preample len is " + bytes.length);
+ }
+
+ private void compareBytes(String s, String encoding) throws Exception {
+ byte[] expected = s.getBytes(encoding);
+
+ ReaderInputStream r = new ReaderInputStream(
+ new StringReader(s), encoding);
+ for (int i = 0; i < expected.length; ++i) {
+ int expect = expected[i] & 0xFF;
+ int read = r.read();
+ if (expect != read) {
+ fail("Mismatch in ReaderInputStream at index " + i
+ + " expecting " + expect + " got " + read + " for string "
+ + s + " with encoding " + encoding);
+ }
+ }
+ if (r.read() != -1) {
+ fail("Mismatch in ReaderInputStream - EOF not seen for string "
+ + s + " with encoding " + encoding);
+ }
+ }
+}
Propchange: ant/core/trunk/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/core/trunk/src/tests/junit/org/example/tasks/antlib.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/example/tasks/antlib.xml?view=diff&rev=482069&r1=482068&r2=482069
==============================================================================
--- ant/core/trunk/src/tests/junit/org/example/tasks/antlib.xml (original)
+++ ant/core/trunk/src/tests/junit/org/example/tasks/antlib.xml Sun Dec 3 20:51:50 2006
@@ -1,10 +1,10 @@
-<?xml version="1.0"?>
-<antlib>
-<macrodef name="simple">
- <element name="some-tasks" optional="yes" implicit="yes"/>
- <sequential>
- <some-tasks/>
- </sequential>
-</macrodef>
-</antlib>
-
\ No newline at end of file
+<?xml version="1.0"?>
+<antlib>
+<macrodef name="simple">
+ <element name="some-tasks" optional="yes" implicit="yes"/>
+ <sequential>
+ <some-tasks/>
+ </sequential>
+</macrodef>
+</antlib>
+
Propchange: ant/core/trunk/src/tests/junit/org/example/tasks/antlib.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: ant/core/trunk/src/tests/junit/org/example/tasks/antlib2.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/example/tasks/antlib2.xml?view=diff&rev=482069&r1=482068&r2=482069
==============================================================================
--- ant/core/trunk/src/tests/junit/org/example/tasks/antlib2.xml (original)
+++ ant/core/trunk/src/tests/junit/org/example/tasks/antlib2.xml Sun Dec 3 20:51:50 2006
@@ -1,10 +1,10 @@
-<?xml version="1.0"?>
-<antlib>
-<macrodef name="simple">
- <element name="some-tasks" optional="yes" implicit="yes"/>
- <sequential>
- <some-tasks/>
- </sequential>
-</macrodef>
-</antlib>
-
\ No newline at end of file
+<?xml version="1.0"?>
+<antlib>
+<macrodef name="simple">
+ <element name="some-tasks" optional="yes" implicit="yes"/>
+ <sequential>
+ <some-tasks/>
+ </sequential>
+</macrodef>
+</antlib>
+
Propchange: ant/core/trunk/src/tests/junit/org/example/tasks/antlib2.xml
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org