You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by gi...@apache.org on 2017/11/29 16:18:05 UTC

[01/21] ant git commit: Normalise tabulation and line breaks

Repository: ant
Updated Branches:
  refs/heads/master 2c39081a0 -> 4422804db


http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/zip/ZipLongTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/zip/ZipLongTest.java b/src/tests/junit/org/apache/tools/zip/ZipLongTest.java
index 8ec8019..a7ece04 100644
--- a/src/tests/junit/org/apache/tools/zip/ZipLongTest.java
+++ b/src/tests/junit/org/apache/tools/zip/ZipLongTest.java
@@ -1,94 +1,94 @@
-/*
- *  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.zip;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertTrue;
-
-/**
- * JUnit testcases for org.apache.tools.zip.ZipLong.
- *
- */
-public class ZipLongTest {
-
-    /**
-     * Test conversion to bytes.
-     */
-    @Test
-    public void testToBytes() {
-        ZipLong zl = new ZipLong(0x12345678);
-        byte[] result = zl.getBytes();
-        assertEquals("length getBytes", 4, result.length);
-        assertEquals("first byte getBytes", 0x78, result[0]);
-        assertEquals("second byte getBytes", 0x56, result[1]);
-        assertEquals("third byte getBytes", 0x34, result[2]);
-        assertEquals("fourth byte getBytes", 0x12, result[3]);
-    }
-
-    /**
-     * Test conversion from bytes.
-     */
-    @Test
-    public void testFromBytes() {
-        byte[] val = new byte[] {0x78, 0x56, 0x34, 0x12};
-        ZipLong zl = new ZipLong(val);
-        assertEquals("value from bytes", 0x12345678, zl.getValue());
-    }
-
-    /**
-     * Test the contract of the equals method.
-     */
-    @Test
-    public void testEquals() {
-        ZipLong zl = new ZipLong(0x12345678);
-        ZipLong zl2 = new ZipLong(0x12345678);
-        ZipLong zl3 = new ZipLong(0x87654321);
-
-        assertTrue("reflexive", zl.equals(zl));
-
-        assertTrue("works", zl.equals(zl2));
-        assertTrue("works, part two", !zl.equals(zl3));
-
-        assertTrue("symmetric", zl2.equals(zl));
-
-        assertTrue("null handling", !zl.equals(null));
-        assertTrue("non ZipLong handling", !zl.equals(new Integer(0x1234)));
-    }
-
-    /**
-     * Test sign handling.
-     */
-    @Test
-    public void testSign() {
-        ZipLong zl = new ZipLong(new byte[] {(byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF});
-        assertEquals(0x00000000FFFFFFFFl, zl.getValue());
-    }
-
-    @Test
-    public void testClone() {
-        ZipLong s1 = new ZipLong(42);
-        ZipLong s2 = (ZipLong) s1.clone();
-        assertNotSame(s1, s2);
-        assertEquals(s1, s2);
-        assertEquals(s1.getValue(), s2.getValue());
-    }
-}
+/*
+ *  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.zip;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * JUnit testcases for org.apache.tools.zip.ZipLong.
+ *
+ */
+public class ZipLongTest {
+
+    /**
+     * Test conversion to bytes.
+     */
+    @Test
+    public void testToBytes() {
+        ZipLong zl = new ZipLong(0x12345678);
+        byte[] result = zl.getBytes();
+        assertEquals("length getBytes", 4, result.length);
+        assertEquals("first byte getBytes", 0x78, result[0]);
+        assertEquals("second byte getBytes", 0x56, result[1]);
+        assertEquals("third byte getBytes", 0x34, result[2]);
+        assertEquals("fourth byte getBytes", 0x12, result[3]);
+    }
+
+    /**
+     * Test conversion from bytes.
+     */
+    @Test
+    public void testFromBytes() {
+        byte[] val = new byte[] {0x78, 0x56, 0x34, 0x12};
+        ZipLong zl = new ZipLong(val);
+        assertEquals("value from bytes", 0x12345678, zl.getValue());
+    }
+
+    /**
+     * Test the contract of the equals method.
+     */
+    @Test
+    public void testEquals() {
+        ZipLong zl = new ZipLong(0x12345678);
+        ZipLong zl2 = new ZipLong(0x12345678);
+        ZipLong zl3 = new ZipLong(0x87654321);
+
+        assertTrue("reflexive", zl.equals(zl));
+
+        assertTrue("works", zl.equals(zl2));
+        assertTrue("works, part two", !zl.equals(zl3));
+
+        assertTrue("symmetric", zl2.equals(zl));
+
+        assertTrue("null handling", !zl.equals(null));
+        assertTrue("non ZipLong handling", !zl.equals(new Integer(0x1234)));
+    }
+
+    /**
+     * Test sign handling.
+     */
+    @Test
+    public void testSign() {
+        ZipLong zl = new ZipLong(new byte[] {(byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF});
+        assertEquals(0x00000000FFFFFFFFl, zl.getValue());
+    }
+
+    @Test
+    public void testClone() {
+        ZipLong s1 = new ZipLong(42);
+        ZipLong s2 = (ZipLong) s1.clone();
+        assertNotSame(s1, s2);
+        assertEquals(s1, s2);
+        assertEquals(s1.getValue(), s2.getValue());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/zip/ZipOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/zip/ZipOutputStreamTest.java b/src/tests/junit/org/apache/tools/zip/ZipOutputStreamTest.java
index 7040782..f41b246 100644
--- a/src/tests/junit/org/apache/tools/zip/ZipOutputStreamTest.java
+++ b/src/tests/junit/org/apache/tools/zip/ZipOutputStreamTest.java
@@ -1,73 +1,73 @@
-/*
- *  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.zip;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.Calendar;
-import java.util.Date;
-
-import static org.junit.Assert.assertEquals;
-
-public class ZipOutputStreamTest {
-    
-    private Date time;
-    private ZipLong zl;
-
-	@Before
-    public void setUp() throws Exception {
-        time = new Date();
-        Calendar cal = Calendar.getInstance();
-        cal.setTime(time);
-        int year = cal.get(Calendar.YEAR);
-        int month = cal.get(Calendar.MONTH) + 1;
-        long value =  ((year - 1980) << 25)
-            |         (month << 21)
-            |	      (cal.get(Calendar.DAY_OF_MONTH) << 16)
-            |         (cal.get(Calendar.HOUR_OF_DAY) << 11)
-            |         (cal.get(Calendar.MINUTE) << 5)
-            |         (cal.get(Calendar.SECOND) >> 1);
-
-        byte[] result = new byte[4];
-        result[0] = (byte) ((value & 0xFF));
-        result[1] = (byte) ((value & 0xFF00) >> 8);
-        result[2] = (byte) ((value & 0xFF0000) >> 16);
-        result[3] = (byte) ((value & 0xFF000000L) >> 24);
-        zl = new ZipLong(result);
-    }
-
-
-    @Test
-    public void testZipLong() throws Exception {
-        ZipLong test = ZipOutputStream.toDosTime(time);
-        assertEquals(test.getValue(), zl.getValue());
-    }
-
-    @Test
-    public void testAdjustToLong() {
-        assertEquals((long) Integer.MAX_VALUE,
-                     ZipOutputStream.adjustToLong(Integer.MAX_VALUE));
-        assertEquals(((long) Integer.MAX_VALUE) + 1,
-                     ZipOutputStream.adjustToLong(Integer.MAX_VALUE + 1));
-        assertEquals(2 * ((long) Integer.MAX_VALUE),
-                     ZipOutputStream.adjustToLong(2 * Integer.MAX_VALUE));
-    }
-
-}
+/*
+ *  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.zip;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.Calendar;
+import java.util.Date;
+
+import static org.junit.Assert.assertEquals;
+
+public class ZipOutputStreamTest {
+
+    private Date time;
+    private ZipLong zl;
+
+    @Before
+    public void setUp() throws Exception {
+        time = new Date();
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(time);
+        int year = cal.get(Calendar.YEAR);
+        int month = cal.get(Calendar.MONTH) + 1;
+        long value =  ((year - 1980) << 25)
+            |         (month << 21)
+            |         (cal.get(Calendar.DAY_OF_MONTH) << 16)
+            |         (cal.get(Calendar.HOUR_OF_DAY) << 11)
+            |         (cal.get(Calendar.MINUTE) << 5)
+            |         (cal.get(Calendar.SECOND) >> 1);
+
+        byte[] result = new byte[4];
+        result[0] = (byte) ((value & 0xFF));
+        result[1] = (byte) ((value & 0xFF00) >> 8);
+        result[2] = (byte) ((value & 0xFF0000) >> 16);
+        result[3] = (byte) ((value & 0xFF000000L) >> 24);
+        zl = new ZipLong(result);
+    }
+
+
+    @Test
+    public void testZipLong() throws Exception {
+        ZipLong test = ZipOutputStream.toDosTime(time);
+        assertEquals(test.getValue(), zl.getValue());
+    }
+
+    @Test
+    public void testAdjustToLong() {
+        assertEquals((long) Integer.MAX_VALUE,
+                     ZipOutputStream.adjustToLong(Integer.MAX_VALUE));
+        assertEquals(((long) Integer.MAX_VALUE) + 1,
+                     ZipOutputStream.adjustToLong(Integer.MAX_VALUE + 1));
+        assertEquals(2 * ((long) Integer.MAX_VALUE),
+                     ZipOutputStream.adjustToLong(2 * Integer.MAX_VALUE));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/zip/ZipShortTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/zip/ZipShortTest.java b/src/tests/junit/org/apache/tools/zip/ZipShortTest.java
index 4b97471..a6aa3e7 100644
--- a/src/tests/junit/org/apache/tools/zip/ZipShortTest.java
+++ b/src/tests/junit/org/apache/tools/zip/ZipShortTest.java
@@ -1,92 +1,92 @@
-/*
- *  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.zip;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertTrue;
-
-/**
- * JUnit 3 testcases for org.apache.tools.zip.ZipShort.
- *
- */
-public class ZipShortTest {
-
-    /**
-     * Test conversion to bytes.
-     */
-    @Test
-    public void testToBytes() {
-        ZipShort zs = new ZipShort(0x1234);
-        byte[] result = zs.getBytes();
-        assertEquals("length getBytes", 2, result.length);
-        assertEquals("first byte getBytes", 0x34, result[0]);
-        assertEquals("second byte getBytes", 0x12, result[1]);
-    }
-
-    /**
-     * Test conversion from bytes.
-     */
-    @Test
-    public void testFromBytes() {
-        byte[] val = new byte[] {0x34, 0x12};
-        ZipShort zs = new ZipShort(val);
-        assertEquals("value from bytes", 0x1234, zs.getValue());
-    }
-
-    /**
-     * Test the contract of the equals method.
-     */
-    @Test
-    public void testEquals() {
-        ZipShort zs = new ZipShort(0x1234);
-        ZipShort zs2 = new ZipShort(0x1234);
-        ZipShort zs3 = new ZipShort(0x5678);
-
-        assertTrue("reflexive", zs.equals(zs));
-
-        assertTrue("works", zs.equals(zs2));
-        assertTrue("works, part two", !zs.equals(zs3));
-
-        assertTrue("symmetric", zs2.equals(zs));
-
-        assertTrue("null handling", !zs.equals(null));
-        assertTrue("non ZipShort handling", !zs.equals(new Integer(0x1234)));
-    }
-
-    /**
-     * Test sign handling.
-     */
-    @Test
-    public void testSign() {
-        ZipShort zs = new ZipShort(new byte[] {(byte)0xFF, (byte)0xFF});
-        assertEquals(0x0000FFFF, zs.getValue());
-    }
-
-    @Test
-    public void testClone() {
-        ZipShort s1 = new ZipShort(42);
-        ZipShort s2 = (ZipShort) s1.clone();
-        assertNotSame(s1, s2);
-        assertEquals(s1, s2);
-        assertEquals(s1.getValue(), s2.getValue());
-    }
-}
+/*
+ *  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.zip;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * JUnit 3 testcases for org.apache.tools.zip.ZipShort.
+ *
+ */
+public class ZipShortTest {
+
+    /**
+     * Test conversion to bytes.
+     */
+    @Test
+    public void testToBytes() {
+        ZipShort zs = new ZipShort(0x1234);
+        byte[] result = zs.getBytes();
+        assertEquals("length getBytes", 2, result.length);
+        assertEquals("first byte getBytes", 0x34, result[0]);
+        assertEquals("second byte getBytes", 0x12, result[1]);
+    }
+
+    /**
+     * Test conversion from bytes.
+     */
+    @Test
+    public void testFromBytes() {
+        byte[] val = new byte[] {0x34, 0x12};
+        ZipShort zs = new ZipShort(val);
+        assertEquals("value from bytes", 0x1234, zs.getValue());
+    }
+
+    /**
+     * Test the contract of the equals method.
+     */
+    @Test
+    public void testEquals() {
+        ZipShort zs = new ZipShort(0x1234);
+        ZipShort zs2 = new ZipShort(0x1234);
+        ZipShort zs3 = new ZipShort(0x5678);
+
+        assertTrue("reflexive", zs.equals(zs));
+
+        assertTrue("works", zs.equals(zs2));
+        assertTrue("works, part two", !zs.equals(zs3));
+
+        assertTrue("symmetric", zs2.equals(zs));
+
+        assertTrue("null handling", !zs.equals(null));
+        assertTrue("non ZipShort handling", !zs.equals(new Integer(0x1234)));
+    }
+
+    /**
+     * Test sign handling.
+     */
+    @Test
+    public void testSign() {
+        ZipShort zs = new ZipShort(new byte[] {(byte)0xFF, (byte)0xFF});
+        assertEquals(0x0000FFFF, zs.getValue());
+    }
+
+    @Test
+    public void testClone() {
+        ZipShort s1 = new ZipShort(42);
+        ZipShort s2 = (ZipShort) s1.clone();
+        assertNotSame(s1, s2);
+        assertEquals(s1, s2);
+        assertEquals(s1.getValue(), s2.getValue());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/example/junit/AbstractJUnit3TestMissed.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/example/junit/AbstractJUnit3TestMissed.java b/src/tests/junit/org/example/junit/AbstractJUnit3TestMissed.java
index e2bb73a..fd261f5 100644
--- a/src/tests/junit/org/example/junit/AbstractJUnit3TestMissed.java
+++ b/src/tests/junit/org/example/junit/AbstractJUnit3TestMissed.java
@@ -1,27 +1,27 @@
-/*
- *  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.example.junit;
-
-import junit.framework.TestCase;
-
-public abstract class AbstractJUnit3TestMissed extends TestCase {
-
-    public void testNothing() {
-    }
-
-}
+/*
+ *  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.example.junit;
+
+import junit.framework.TestCase;
+
+public abstract class AbstractJUnit3TestMissed extends TestCase {
+
+    public void testNothing() {
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/example/junit/AbstractJUnit3TestNotMissed.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/example/junit/AbstractJUnit3TestNotMissed.java b/src/tests/junit/org/example/junit/AbstractJUnit3TestNotMissed.java
index 40f2b4a..e1d1c0b 100644
--- a/src/tests/junit/org/example/junit/AbstractJUnit3TestNotMissed.java
+++ b/src/tests/junit/org/example/junit/AbstractJUnit3TestNotMissed.java
@@ -1,31 +1,31 @@
-/*
- *  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.example.junit;
-
-import junit.framework.TestCase;
-
-public abstract class AbstractJUnit3TestNotMissed extends TestCase {
-
-    public void testNothing() {
-    }
-
-    public static class InnerAbstractTestNotMissed extends AbstractJUnit3TestNotMissed {
-
-    }
-
-}
+/*
+ *  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.example.junit;
+
+import junit.framework.TestCase;
+
+public abstract class AbstractJUnit3TestNotMissed extends TestCase {
+
+    public void testNothing() {
+    }
+
+    public static class InnerAbstractTestNotMissed extends AbstractJUnit3TestNotMissed {
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/example/junit/AbstractTestMissed.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/example/junit/AbstractTestMissed.java b/src/tests/junit/org/example/junit/AbstractTestMissed.java
index 8df6adf..6724d5b 100644
--- a/src/tests/junit/org/example/junit/AbstractTestMissed.java
+++ b/src/tests/junit/org/example/junit/AbstractTestMissed.java
@@ -1,29 +1,29 @@
-/*
- *  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.example.junit;
-
-import org.junit.Test;
-
-
-public abstract class AbstractTestMissed {
-
-    @Test
-    public void testNothing() {
-    }
-
-}
+/*
+ *  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.example.junit;
+
+import org.junit.Test;
+
+
+public abstract class AbstractTestMissed {
+
+    @Test
+    public void testNothing() {
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/example/junit/AbstractTestNotMissed.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/example/junit/AbstractTestNotMissed.java b/src/tests/junit/org/example/junit/AbstractTestNotMissed.java
index 79b925e..9a77d1b 100644
--- a/src/tests/junit/org/example/junit/AbstractTestNotMissed.java
+++ b/src/tests/junit/org/example/junit/AbstractTestNotMissed.java
@@ -1,32 +1,32 @@
-/*
- *  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.example.junit;
-
-import org.junit.Test;
-
-public abstract class AbstractTestNotMissed {
-
-    @Test
-    public void testNothing() {
-    }
-
-    public static class InnerAbstractTestNotMissed extends AbstractTestNotMissed {
-
-    }
-
-}
+/*
+ *  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.example.junit;
+
+import org.junit.Test;
+
+public abstract class AbstractTestNotMissed {
+
+    @Test
+    public void testNothing() {
+    }
+
+    public static class InnerAbstractTestNotMissed extends AbstractTestNotMissed {
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/example/junit/JUnit3NonTestMissed.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/example/junit/JUnit3NonTestMissed.java b/src/tests/junit/org/example/junit/JUnit3NonTestMissed.java
index 7a4a00f..76cead6 100644
--- a/src/tests/junit/org/example/junit/JUnit3NonTestMissed.java
+++ b/src/tests/junit/org/example/junit/JUnit3NonTestMissed.java
@@ -1,27 +1,27 @@
-/*
- *  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.example.junit;
-
-import junit.framework.TestCase;
-
-public class JUnit3NonTestMissed extends TestCase {
-
-    public void notATest() {
-        //this isn't a test but shouldn't case an error
-    }
-}
+/*
+ *  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.example.junit;
+
+import junit.framework.TestCase;
+
+public class JUnit3NonTestMissed extends TestCase {
+
+    public void notATest() {
+        //this isn't a test but shouldn't case an error
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/example/junit/JUnit3TestNotMissed.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/example/junit/JUnit3TestNotMissed.java b/src/tests/junit/org/example/junit/JUnit3TestNotMissed.java
index 338012d..1e5ac2d 100644
--- a/src/tests/junit/org/example/junit/JUnit3TestNotMissed.java
+++ b/src/tests/junit/org/example/junit/JUnit3TestNotMissed.java
@@ -1,28 +1,28 @@
-/*
- *  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.example.junit;
-
-import junit.framework.TestCase;
-
-public class JUnit3TestNotMissed extends TestCase {
-
-    public void testNothing() {
-        // don't fail
-    }
-
-}
+/*
+ *  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.example.junit;
+
+import junit.framework.TestCase;
+
+public class JUnit3TestNotMissed extends TestCase {
+
+    public void testNothing() {
+        // don't fail
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/example/junit/JUnit4Skippable.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/example/junit/JUnit4Skippable.java b/src/tests/junit/org/example/junit/JUnit4Skippable.java
index e71345c..aa89ab7 100644
--- a/src/tests/junit/org/example/junit/JUnit4Skippable.java
+++ b/src/tests/junit/org/example/junit/JUnit4Skippable.java
@@ -1,74 +1,74 @@
-/*
- *  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.example.junit;
-
-import org.junit.Assume;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-public class JUnit4Skippable {
-
-    @Test
-    public void passingTest() {
-        assertTrue("This test passed", true);
-    }
-
-    @Ignore("Please don't ignore me!")
-    @Test
-    public void explicitIgnoreTest() {
-        fail("This test should be skipped");
-    }
-
-    @Test
-    public void implicitlyIgnoreTest() {
-        Assume.assumeFalse("This test will be ignored", true);
-        fail("I told you, this test should have been ignored!");
-    }
-
-    @Test
-    @Ignore
-    public void explicitlyIgnoreTestNoMessage() {
-        fail("This test should be skipped");
-    }
-
-    @Test
-    public void implicitlyIgnoreTestNoMessage() {
-        Assume.assumeFalse(true);
-        fail("I told you, this test should have been ignored!");
-    }
-
-    @Test
-    public void failingTest() {
-        fail("I told you this test was going to fail");
-    }
-
-    @Test
-    public void failingTestNoMessage() {
-        fail();
-    }
-
-    @Test
-    public void errorTest() {
-        throw new RuntimeException("Whoops, this test went wrong");
-    }
-
-}
+/*
+ *  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.example.junit;
+
+import org.junit.Assume;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+public class JUnit4Skippable {
+
+    @Test
+    public void passingTest() {
+        assertTrue("This test passed", true);
+    }
+
+    @Ignore("Please don't ignore me!")
+    @Test
+    public void explicitIgnoreTest() {
+        fail("This test should be skipped");
+    }
+
+    @Test
+    public void implicitlyIgnoreTest() {
+        Assume.assumeFalse("This test will be ignored", true);
+        fail("I told you, this test should have been ignored!");
+    }
+
+    @Test
+    @Ignore
+    public void explicitlyIgnoreTestNoMessage() {
+        fail("This test should be skipped");
+    }
+
+    @Test
+    public void implicitlyIgnoreTestNoMessage() {
+        Assume.assumeFalse(true);
+        fail("I told you, this test should have been ignored!");
+    }
+
+    @Test
+    public void failingTest() {
+        fail("I told you this test was going to fail");
+    }
+
+    @Test
+    public void failingTestNoMessage() {
+        fail();
+    }
+
+    @Test
+    public void errorTest() {
+        throw new RuntimeException("Whoops, this test went wrong");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/example/junit/MultilineAsserts.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/example/junit/MultilineAsserts.java b/src/tests/junit/org/example/junit/MultilineAsserts.java
index 1b0cc59..06e1039 100644
--- a/src/tests/junit/org/example/junit/MultilineAsserts.java
+++ b/src/tests/junit/org/example/junit/MultilineAsserts.java
@@ -1,27 +1,27 @@
-/*
- *  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.example.junit;
-
-import junit.framework.TestCase;
-
-public class MultilineAsserts extends TestCase {
-    public void testFoo() { assertTrue("testFoo \nmessed up", false); }
-    public void testBar() { assertTrue("testBar \ndidn't work", true); }
-    public void testFee() { assertTrue("testFee \ncrashed", false); }
-    public void testFie() { assertTrue("testFie \nbroke", true); }
-}
+/*
+ *  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.example.junit;
+
+import junit.framework.TestCase;
+
+public class MultilineAsserts extends TestCase {
+    public void testFoo() { assertTrue("testFoo \nmessed up", false); }
+    public void testBar() { assertTrue("testBar \ndidn't work", true); }
+    public void testFee() { assertTrue("testFee \ncrashed", false); }
+    public void testFie() { assertTrue("testFie \nbroke", true); }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/example/junit/NonTestMissed.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/example/junit/NonTestMissed.java b/src/tests/junit/org/example/junit/NonTestMissed.java
index 5a76d17..0a020ec 100644
--- a/src/tests/junit/org/example/junit/NonTestMissed.java
+++ b/src/tests/junit/org/example/junit/NonTestMissed.java
@@ -1,25 +1,25 @@
-/*
- *  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.example.junit;
-
-public class NonTestMissed {
-
-    public void notATest() {
-        //this isn't a test but shouldn't case an error
-    }
-}
+/*
+ *  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.example.junit;
+
+public class NonTestMissed {
+
+    public void notATest() {
+        //this isn't a test but shouldn't case an error
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/example/junit/Output.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/example/junit/Output.java b/src/tests/junit/org/example/junit/Output.java
index a536a47..a7135f7 100644
--- a/src/tests/junit/org/example/junit/Output.java
+++ b/src/tests/junit/org/example/junit/Output.java
@@ -1,37 +1,37 @@
-/*
- *  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.example.junit;
-
-import junit.framework.TestCase;
-
-/**
- * Not really a test of Ant but a test that is run by the test of the
- * junit task.  Confused?
- *
- * @since Ant 1.5
- */
-public class Output extends TestCase {
-
-    public Output(String s) {
-        super(s);
-    }
-
-    public void testOutput() {
-        System.out.println("foo");
-    }
-}
+/*
+ *  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.example.junit;
+
+import junit.framework.TestCase;
+
+/**
+ * Not really a test of Ant but a test that is run by the test of the
+ * junit task.  Confused?
+ *
+ * @since Ant 1.5
+ */
+public class Output extends TestCase {
+
+    public Output(String s) {
+        super(s);
+    }
+
+    public void testOutput() {
+        System.out.println("foo");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/example/junit/TestNotMissed.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/example/junit/TestNotMissed.java b/src/tests/junit/org/example/junit/TestNotMissed.java
index 1c967e0..6d3babe 100644
--- a/src/tests/junit/org/example/junit/TestNotMissed.java
+++ b/src/tests/junit/org/example/junit/TestNotMissed.java
@@ -1,29 +1,29 @@
-/*
- *  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.example.junit;
-
-
-import org.junit.Test;
-
-public class TestNotMissed {
-
-    @Test
-    public void testNothing() {
-        // don't fail
-    }
-}
+/*
+ *  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.example.junit;
+
+
+import org.junit.Test;
+
+public class TestNotMissed {
+
+    @Test
+    public void testNothing() {
+        // don't fail
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/example/junit/TestWithSuiteNotMissed.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/example/junit/TestWithSuiteNotMissed.java b/src/tests/junit/org/example/junit/TestWithSuiteNotMissed.java
index e5cdf93..80b722c 100644
--- a/src/tests/junit/org/example/junit/TestWithSuiteNotMissed.java
+++ b/src/tests/junit/org/example/junit/TestWithSuiteNotMissed.java
@@ -1,32 +1,32 @@
-/*
- *  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.example.junit;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class TestWithSuiteNotMissed {
-
-    public static Test suite() {
-        TestSuite test = new TestSuite("meh");
-        JUnit3TestNotMissed testCase = new JUnit3TestNotMissed();
-        testCase.setName("testNothing");
-        test.addTest(testCase);
-        return test;
-    }
-}
+/*
+ *  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.example.junit;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class TestWithSuiteNotMissed {
+
+    public static Test suite() {
+        TestSuite test = new TestSuite("meh");
+        JUnit3TestNotMissed testCase = new JUnit3TestNotMissed();
+        testCase.setName("testNothing");
+        test.addTest(testCase);
+        return test;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/example/junit/ThreadedOutput.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/example/junit/ThreadedOutput.java b/src/tests/junit/org/example/junit/ThreadedOutput.java
index f5ee38d..91f462a 100644
--- a/src/tests/junit/org/example/junit/ThreadedOutput.java
+++ b/src/tests/junit/org/example/junit/ThreadedOutput.java
@@ -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.example.junit;
-
-import junit.framework.TestCase;
-
-/**
- * Not really a test of Ant but a test that is run by the test of the
- * junit task.  Confused?
- *
- * @since Ant 1.5
- */
-public class ThreadedOutput extends TestCase {
-
-    public ThreadedOutput(String s) {
-        super(s);
-    }
-
-    public void testOutput() throws InterruptedException {
-        Thread t = new Thread(new Runnable() {
-                public void run() {
-                    System.out.println("foo");
-                }
-            });
-        t.start();
-        t.join();
-    }
-}
+/*
+ *  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.example.junit;
+
+import junit.framework.TestCase;
+
+/**
+ * Not really a test of Ant but a test that is run by the test of the
+ * junit task.  Confused?
+ *
+ * @since Ant 1.5
+ */
+public class ThreadedOutput extends TestCase {
+
+    public ThreadedOutput(String s) {
+        super(s);
+    }
+
+    public void testOutput() throws InterruptedException {
+        Thread t = new Thread(new Runnable() {
+                public void run() {
+                    System.out.println("foo");
+                }
+            });
+        t.start();
+        t.join();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/example/junit/Timeout.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/example/junit/Timeout.java b/src/tests/junit/org/example/junit/Timeout.java
index 54cb4e7..6a42ee7 100644
--- a/src/tests/junit/org/example/junit/Timeout.java
+++ b/src/tests/junit/org/example/junit/Timeout.java
@@ -1,32 +1,32 @@
-/*
- *  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.example.junit;
-
-import org.junit.After;
-import org.junit.Test;
-
-public class Timeout {
-    @Test
-    public void testTimeout() throws InterruptedException {
-        Thread.sleep(5000);
-    }
-    @After
-    public void tearDown() {
-        System.out.println("tearDown called on Timeout");
-    }
-}
+/*
+ *  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.example.junit;
+
+import org.junit.After;
+import org.junit.Test;
+
+public class Timeout {
+    @Test
+    public void testTimeout() throws InterruptedException {
+        Thread.sleep(5000);
+    }
+    @After
+    public void tearDown() {
+        System.out.println("tearDown called on Timeout");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/example/junit/XmlParserTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/example/junit/XmlParserTest.java b/src/tests/junit/org/example/junit/XmlParserTest.java
index 57d74f0..e5fae55 100644
--- a/src/tests/junit/org/example/junit/XmlParserTest.java
+++ b/src/tests/junit/org/example/junit/XmlParserTest.java
@@ -1,58 +1,58 @@
-/*
- *  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.example.junit;
-
-import org.junit.Test;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-import static org.junit.Assert.assertNotNull;
-
-/**
- * created Aug 12, 2004 1:39:59 PM
- */
-
-public class XmlParserTest {
-
-
-    @Test
-    public void testXercesIsPresent() throws SAXException {
-        XMLReader xerces;
-        xerces = XMLReaderFactory.createXMLReader(
-                        "org.apache.xerces.parsers.SAXParser");
-        assertNotNull(xerces);
-    }
-
-    @Test
-    public void testXercesHandlesSchema() throws SAXException {
-        XMLReader xerces;
-        xerces = XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
-        xerces.setFeature("http://apache.org/xml/features/validation/schema",
-                true);
-    }
-
-    @Test
-    public void testParserHandlesSchema() throws SAXException {
-        XMLReader xerces;
-        xerces = XMLReaderFactory.createXMLReader();
-        xerces.setFeature("http://apache.org/xml/features/validation/schema",
-                true);
-    }
-
-}
+/*
+ *  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.example.junit;
+
+import org.junit.Test;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * created Aug 12, 2004 1:39:59 PM
+ */
+
+public class XmlParserTest {
+
+
+    @Test
+    public void testXercesIsPresent() throws SAXException {
+        XMLReader xerces;
+        xerces = XMLReaderFactory.createXMLReader(
+                        "org.apache.xerces.parsers.SAXParser");
+        assertNotNull(xerces);
+    }
+
+    @Test
+    public void testXercesHandlesSchema() throws SAXException {
+        XMLReader xerces;
+        xerces = XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
+        xerces.setFeature("http://apache.org/xml/features/validation/schema",
+                true);
+    }
+
+    @Test
+    public void testParserHandlesSchema() throws SAXException {
+        XMLReader xerces;
+        xerces = XMLReaderFactory.createXMLReader();
+        xerces.setFeature("http://apache.org/xml/features/validation/schema",
+                true);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/example/tasks/TaskdefTestContainerTask.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/example/tasks/TaskdefTestContainerTask.java b/src/tests/junit/org/example/tasks/TaskdefTestContainerTask.java
index 0e0a599..a566d5c 100644
--- a/src/tests/junit/org/example/tasks/TaskdefTestContainerTask.java
+++ b/src/tests/junit/org/example/tasks/TaskdefTestContainerTask.java
@@ -1,25 +1,25 @@
-/*
- *  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.example.tasks;
-
-import org.apache.tools.ant.taskdefs.Sequential;
-
-public class TaskdefTestContainerTask extends Sequential {
-    public TaskdefTestContainerTask() {}
-}
+/*
+ *  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.example.tasks;
+
+import org.apache.tools.ant.taskdefs.Sequential;
+
+public class TaskdefTestContainerTask extends Sequential {
+    public TaskdefTestContainerTask() {}
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/example/tasks/TaskdefTestSimpleTask.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/example/tasks/TaskdefTestSimpleTask.java b/src/tests/junit/org/example/tasks/TaskdefTestSimpleTask.java
index 4c0bc69..fdb48b0 100644
--- a/src/tests/junit/org/example/tasks/TaskdefTestSimpleTask.java
+++ b/src/tests/junit/org/example/tasks/TaskdefTestSimpleTask.java
@@ -1,45 +1,44 @@
-/*
- *  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.example.tasks;
-
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-
-public class TaskdefTestSimpleTask extends Task {
-
-    public class Echo {
-        Echo() {}
-        private String message = null;
-        public void setMessage(String s) {message = s;}
-    }
-
-    public TaskdefTestSimpleTask() {}
-
-    private Echo echo;
-    public Echo createEcho() {
-        echo = new Echo();
-        return echo;
-    }
-
-    public void execute() {
-        log("simpletask: "+echo.message, Project.MSG_INFO);
-    }
-
-}
-
+/*
+ *  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.example.tasks;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+
+public class TaskdefTestSimpleTask extends Task {
+
+    public class Echo {
+        Echo() {}
+        private String message = null;
+        public void setMessage(String s) {message = s;}
+    }
+
+    public TaskdefTestSimpleTask() {}
+
+    private Echo echo;
+    public Echo createEcho() {
+        echo = new Echo();
+        return echo;
+    }
+
+    public void execute() {
+        log("simpletask: "+echo.message, Project.MSG_INFO);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/example/types/TypedefTestType.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/example/types/TypedefTestType.java b/src/tests/junit/org/example/types/TypedefTestType.java
index 80eef22..c031422 100644
--- a/src/tests/junit/org/example/types/TypedefTestType.java
+++ b/src/tests/junit/org/example/types/TypedefTestType.java
@@ -1,25 +1,24 @@
-/*
- *  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.example.types;
-
-import org.apache.tools.ant.ProjectComponent;
-
-public class TypedefTestType extends ProjectComponent {
-}
-
+/*
+ *  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.example.types;
+
+import org.apache.tools.ant.ProjectComponent;
+
+public class TypedefTestType extends ProjectComponent {
+}


[09/21] ant git commit: Normalise tabulation and line breaks

Posted by gi...@apache.org.
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/resources/TarResourceTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/resources/TarResourceTest.java b/src/tests/junit/org/apache/tools/ant/types/resources/TarResourceTest.java
index d0a0fe3..a9593f0 100644
--- a/src/tests/junit/org/apache/tools/ant/types/resources/TarResourceTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/resources/TarResourceTest.java
@@ -1,54 +1,54 @@
-/*
- *  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.types.resources;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import java.io.File;
-
-import static org.apache.tools.ant.FileUtilities.getFileContents;
-import static org.junit.Assert.assertEquals;
-
-
-public class TarResourceTest {
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() throws Exception {
-        buildRule.configureProject("src/etc/testcases/types/resources/tarentry.xml");
-    }
-
-
-    @After
-    public void tearDown() throws Exception {
-        buildRule.executeTarget("tearDown");
-    }
-
-    @Test
-    public void testUncompressSource() throws java.io.IOException {
-        buildRule.executeTarget("uncompressSource");
-        assertEquals(getFileContents(buildRule.getProject().resolveFile("../../asf-logo.gif")),
-                getFileContents(new File(buildRule.getProject().getProperty("output"), "asf-logo.gif")));
-    }
-}
+/*
+ *  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.types.resources;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import java.io.File;
+
+import static org.apache.tools.ant.FileUtilities.getFileContents;
+import static org.junit.Assert.assertEquals;
+
+
+public class TarResourceTest {
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() throws Exception {
+        buildRule.configureProject("src/etc/testcases/types/resources/tarentry.xml");
+    }
+
+
+    @After
+    public void tearDown() throws Exception {
+        buildRule.executeTarget("tearDown");
+    }
+
+    @Test
+    public void testUncompressSource() throws java.io.IOException {
+        buildRule.executeTarget("uncompressSource");
+        assertEquals(getFileContents(buildRule.getProject().resolveFile("../../asf-logo.gif")),
+                getFileContents(new File(buildRule.getProject().getProperty("output"), "asf-logo.gif")));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorRule.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorRule.java b/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorRule.java
index 8862cb1..d5613b2 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorRule.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorRule.java
@@ -1,125 +1,125 @@
-/*
- *  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.types.selectors;
-
-import java.io.File;
-
-
-import org.apache.tools.ant.BuildFileRule;
-
-
-/**
- * Base test case for Selectors. Provides a shared test as well as
- * a test bed for selecting on, and a helper method for determining
- * whether selections are correct.
- *
- */
-public class BaseSelectorRule extends BuildFileRule {
-
-    private File beddir;
-    private File mirrordir;
-    private final String[] filenames = {".","asf-logo.gif.md5","asf-logo.gif.bz2",
-            "asf-logo.gif.gz","copy.filterset.filtered","zip/asf-logo.gif.zip",
-            "tar/asf-logo.gif.tar","tar/asf-logo-huge.tar.gz",
-            "tar/gz/asf-logo.gif.tar.gz","tar/bz2/asf-logo.gif.tar.bz2",
-            "tar/bz2/asf-logo-huge.tar.bz2","tar/bz2"};
-    private File[] files = new File[filenames.length];
-    private File[] mirrorfiles = new File[filenames.length];
-
-    @Override
-    public void before() throws Throwable {
-        super.before();
-        configureProject("src/etc/testcases/types/selectors.xml");
-        executeTarget("setUp");
-
-        executeTarget("setupfiles");
-        executeTarget("mirrorfiles");
-
-        beddir = new File(super.getProject().getProperty("test.dir"));
-        mirrordir = new File(super.getProject().getProperty("mirror.dir"));
-
-        for (int x = 0; x < files.length; x++) {
-            files[x] = new File(beddir,filenames[x]);
-            mirrorfiles[x] = new File(mirrordir,filenames[x]);
-        }
-    }
-
-    @Override
-    public void after() {
-        super.after();
-        executeTarget("tearDown");
-    }
-
-    public File getBeddir() {
-        return beddir;
-    }
-
-    public File[] getMirrorFiles() {
-        return mirrorfiles;
-    }
-
-    public File[] getFiles() {
-        return files;
-    }
-
-    public String[] getFilenames() {
-        return filenames;
-    }
-
-
-    /**
-     * This is a helper method that takes a selector and calls its
-     * isSelected() method on each file in the testbed. It returns
-     * a string of "T"s amd "F"s
-     */
-    public String selectionString(FileSelector selector) {
-        return selectionString(beddir,files,selector);
-    }
-
-    /**
-     * This is a helper method that takes a selector and calls its
-     * isSelected() method on each file in the mirror testbed. This
-     * variation is used for dependency checks and to get around the
-     * limitations in the touch task when running JDK 1.1. It returns
-     * a string of "T"s amd "F"s.
-     */
-    public String mirrorSelectionString(FileSelector selector) {
-        return selectionString(mirrordir,mirrorfiles,selector);
-    }
-
-    /**
-     * Worker method for the two convenience methods above. Applies a
-     * selector on a set of files passed in and returns a string of
-     * "T"s amd "F"s from applying the selector to each file.
-     */
-    public String selectionString(File basedir, File[] files, FileSelector selector) {
-        StringBuilder buf = new StringBuilder();
-        for (int x = 0; x < files.length; x++) {
-            if (selector.isSelected(basedir,filenames[x],files[x])) {
-                buf.append('T');
-            }
-            else {
-                buf.append('F');
-            }
-        }
-        return buf.toString();
-    }
-
-
-}
+/*
+ *  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.types.selectors;
+
+import java.io.File;
+
+
+import org.apache.tools.ant.BuildFileRule;
+
+
+/**
+ * Base test case for Selectors. Provides a shared test as well as
+ * a test bed for selecting on, and a helper method for determining
+ * whether selections are correct.
+ *
+ */
+public class BaseSelectorRule extends BuildFileRule {
+
+    private File beddir;
+    private File mirrordir;
+    private final String[] filenames = {".","asf-logo.gif.md5","asf-logo.gif.bz2",
+            "asf-logo.gif.gz","copy.filterset.filtered","zip/asf-logo.gif.zip",
+            "tar/asf-logo.gif.tar","tar/asf-logo-huge.tar.gz",
+            "tar/gz/asf-logo.gif.tar.gz","tar/bz2/asf-logo.gif.tar.bz2",
+            "tar/bz2/asf-logo-huge.tar.bz2","tar/bz2"};
+    private File[] files = new File[filenames.length];
+    private File[] mirrorfiles = new File[filenames.length];
+
+    @Override
+    public void before() throws Throwable {
+        super.before();
+        configureProject("src/etc/testcases/types/selectors.xml");
+        executeTarget("setUp");
+
+        executeTarget("setupfiles");
+        executeTarget("mirrorfiles");
+
+        beddir = new File(super.getProject().getProperty("test.dir"));
+        mirrordir = new File(super.getProject().getProperty("mirror.dir"));
+
+        for (int x = 0; x < files.length; x++) {
+            files[x] = new File(beddir,filenames[x]);
+            mirrorfiles[x] = new File(mirrordir,filenames[x]);
+        }
+    }
+
+    @Override
+    public void after() {
+        super.after();
+        executeTarget("tearDown");
+    }
+
+    public File getBeddir() {
+        return beddir;
+    }
+
+    public File[] getMirrorFiles() {
+        return mirrorfiles;
+    }
+
+    public File[] getFiles() {
+        return files;
+    }
+
+    public String[] getFilenames() {
+        return filenames;
+    }
+
+
+    /**
+     * This is a helper method that takes a selector and calls its
+     * isSelected() method on each file in the testbed. It returns
+     * a string of "T"s amd "F"s
+     */
+    public String selectionString(FileSelector selector) {
+        return selectionString(beddir,files,selector);
+    }
+
+    /**
+     * This is a helper method that takes a selector and calls its
+     * isSelected() method on each file in the mirror testbed. This
+     * variation is used for dependency checks and to get around the
+     * limitations in the touch task when running JDK 1.1. It returns
+     * a string of "T"s amd "F"s.
+     */
+    public String mirrorSelectionString(FileSelector selector) {
+        return selectionString(mirrordir,mirrorfiles,selector);
+    }
+
+    /**
+     * Worker method for the two convenience methods above. Applies a
+     * selector on a set of files passed in and returns a string of
+     * "T"s amd "F"s from applying the selector to each file.
+     */
+    public String selectionString(File basedir, File[] files, FileSelector selector) {
+        StringBuilder buf = new StringBuilder();
+        for (int x = 0; x < files.length; x++) {
+            if (selector.isSelected(basedir,filenames[x],files[x])) {
+                buf.append('T');
+            }
+            else {
+                buf.append('F');
+            }
+        }
+        return buf.toString();
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorTest.java
index 1cc38d4..2332778 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorTest.java
@@ -1,295 +1,295 @@
-/*
- *  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.types.selectors;
-
-import java.io.File;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.BuildFileTest;
-import org.apache.tools.ant.Project;
-
-/**
- * Base test case for Selectors. Provides a shared test as well as
- * a test bed for selecting on, and a helper method for determining
- * whether selections are correct.
- *
- * @deprecated as of 1.9.4. Use {@link org.apache.tools.ant.types.selectors.BaseSelectorRule} instead.
- */
-@Deprecated
-public abstract class BaseSelectorTest extends BuildFileTest {
-
-    private Project project;
-    private TaskdefForMakingBed tbed = null;
-    protected File basedir;
-    protected File beddir;
-    protected File mirrordir;
-    protected String[] filenames = {".","asf-logo.gif.md5","asf-logo.gif.bz2",
-            "asf-logo.gif.gz","copy.filterset.filtered","zip/asf-logo.gif.zip",
-            "tar/asf-logo.gif.tar","tar/asf-logo-huge.tar.gz",
-            "tar/gz/asf-logo.gif.tar.gz","tar/bz2/asf-logo.gif.tar.bz2",
-            "tar/bz2/asf-logo-huge.tar.bz2","tar/bz2"};
-    protected File[] files = new File[filenames.length];
-    protected File[] mirrorfiles = new File[filenames.length];
-
-    public BaseSelectorTest(String name) {
-        super(name);
-    }
-
-    public void setUp() {
-        configureProject("src/etc/testcases/types/selectors.xml");
-        executeTarget("setUp");
-        beddir = new File(super.getProject().getProperty("test.dir"));
-        mirrordir = new File(super.getProject().getProperty("mirror.dir"));
-        basedir = getProjectDir();
-        project = new Project();
-        project.init();
-        project.setBaseDir(basedir);
-        for (int x = 0; x < files.length; x++) {
-            files[x] = new File(beddir,filenames[x]);
-            mirrorfiles[x] = new File(mirrordir,filenames[x]);
-        }
-    }
-
-    /**
-     * Override this in child classes to return a specific Selector
-     */
-    public abstract BaseSelector getInstance();
-
-
-    /**
-     * Return a preconfigured selector (with a set reference to
-     * project instance).
-     * @return the selector
-     */
-    public BaseSelector getSelector() {
-        BaseSelector selector = getInstance();
-        selector.setProject( getProject() );
-        return selector;
-    }
-
-
-    public Project getProject() {
-        return project;
-    }
-
-    /**
-     * This is a test that all Selectors derived from BaseSelector can
-     * use. It calls the setError() method and checks to ensure that a
-     * BuildException is thrown as a result.
-     */
-    public void testRespondsToError() {
-        BaseSelector s = getInstance();
-        if (s == null) {
-            return;
-        }
-        s.setError("test error");
-        try {
-            s.isSelected(beddir,filenames[0],files[0]);
-            fail("Cannot cause BuildException when setError() is called");
-        } catch (BuildException be) {
-            assertEquals("test error",
-                         be.getMessage());
-        }
-    }
-
-
-    /**
-     * This is a helper method that takes a selector and calls its
-     * isSelected() method on each file in the testbed. It returns
-     * a string of "T"s amd "F"s
-     */
-    public String selectionString(FileSelector selector) {
-        return selectionString(beddir,files,selector);
-    }
-
-    /**
-     * This is a helper method that takes a selector and calls its
-     * isSelected() method on each file in the mirror testbed. This
-     * variation is used for dependency checks and to get around the
-     * limitations in the touch task when running JDK 1.1. It returns
-     * a string of "T"s amd "F"s.
-     */
-    public String mirrorSelectionString(FileSelector selector) {
-        return selectionString(mirrordir,mirrorfiles,selector);
-    }
-
-    /**
-     * Worker method for the two convenience methods above. Applies a
-     * selector on a set of files passed in and returns a string of
-     * "T"s amd "F"s from applying the selector to each file.
-     */
-    public String selectionString(File basedir, File[] files, FileSelector selector) {
-        StringBuffer buf = new StringBuffer();
-        for (int x = 0; x < files.length; x++) {
-            if (selector.isSelected(basedir,filenames[x],files[x])) {
-                buf.append('T');
-            }
-            else {
-                buf.append('F');
-            }
-        }
-        return buf.toString();
-    }
-
-    /**
-     * Does the selection test for a given selector and prints the
-     * filenames of the differing files (selected but shouldn't,
-     * not selected but should).
-     * @param selector  The selector to test
-     * @param expected  The expected result
-     */
-    public void performTests(FileSelector selector, String expected) {
-        String result = selectionString(selector);
-        String diff = diff(expected, result);
-        String resolved = resolve(diff);
-        assertEquals("Differing files: " + resolved, result, expected);
-    }
-
-    /**
-     *  Checks which files are selected and shouldn't be or which
-     *  are not selected but should.
-     *  @param expected    String containing 'F's and 'T's
-     *  @param result      String containing 'F's and 'T's
-     *  @return Difference as String containing '-' (equal) and
-     *          'X' (difference).
-     */
-    public String diff(String expected, String result) {
-        int length1 = expected.length();
-        int length2 = result.length();
-        int min = (length1 > length2) ? length2 : length1;
-        StringBuffer sb = new StringBuffer();
-        for (int i=0; i<min; i++) {
-            sb.append(
-                  (expected.charAt(i) == result.charAt(i))
-                ? "-"
-                : "X"
-            );
-        }
-        return sb.toString();
-    }
-
-
-    /**
-     * Resolves a diff-String (@see diff()) against the (inherited) filenames-
-     * and files arrays.
-     * @param filelist    Diff-String
-     * @return String containing the filenames for all differing files,
-     *         separated with semicolons ';'
-     */
-    public String resolve(String filelist) {
-        StringBuffer sb = new StringBuffer();
-        int min = (filenames.length > filelist.length())
-                ? filelist.length()
-                : filenames.length;
-        for (int i=0; i<min; i++) {
-            if ('X'==filelist.charAt(i)) {
-                sb.append(filenames[i]);
-                sb.append(";");
-            }
-        }
-        return sb.toString();
-    }
-
-
-    /**
-     * <p>Creates a testbed. We avoid the dreaded "test" word so that we
-     * don't falsely identify this as a test to be run. The actual
-     * setting up of the testbed is done in the
-     * <code>src/etc/testcases/types/selectors.xml</code> build file.</p>
-     *
-     * <p>Note that the right way to call this is within a try block,
-     * with a finally clause that calls cleanupBed(). You place tests of
-     * the isSelected() method within the try block.</p>
-     */
-    protected void makeBed() {
-        tbed = new TaskdefForMakingBed("setupfiles");
-        tbed.setUp();
-        tbed.makeTestbed();
-    }
-
-    /**
-     * Cleans up the testbed by calling a target in the
-     * <code>src/etc/testcases/types/selectors.xml</code> file.
-     */
-    protected void cleanupBed() {
-        if (tbed != null) {
-           tbed.tearDown();
-            tbed = null;
-        }
-    }
-
-
-    /**
-     * <p>Creates a mirror of the testbed for use in dependency checks.</p>
-     *
-     * <p>Note that the right way to call this is within a try block,
-     * with a finally clause that calls cleanupMirror(). You place tests of
-     * the isSelected() method within the try block.</p>
-     */
-    protected void makeMirror() {
-        tbed = new TaskdefForMakingBed("mirrorfiles");
-        tbed.setUp();
-        tbed.makeMirror();
-    }
-
-    /**
-     * Cleans up the mirror testbed by calling a target in the
-     * <code>src/etc/testcases/types/selectors.xml</code> file.
-     */
-    protected void cleanupMirror() {
-        if (tbed != null) {
-            tbed.deleteMirror();
-            tbed = null;
-        }
-    }
-
-    private class TaskdefForMakingBed extends BuildFileTest {
-
-        TaskdefForMakingBed(String name) {
-            super(name);
-        }
-
-        public void setUp() {
-            configureProject("src/etc/testcases/types/selectors.xml");
-        }
-
-        public void tearDown() {
-            try {
-                super.tearDown();
-            } catch (Exception exc) {
-                // ignore
-            }
-        }
-
-        public void makeTestbed() {
-            executeTarget("setupfiles");
-        }
-
-        public void makeMirror() {
-            executeTarget("mirrorfiles");
-        }
-
-        public void deleteMirror() {
-            executeTarget("tearDown");
-        }
-    }
-
-
-
-}
+/*
+ *  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.types.selectors;
+
+import java.io.File;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileTest;
+import org.apache.tools.ant.Project;
+
+/**
+ * Base test case for Selectors. Provides a shared test as well as
+ * a test bed for selecting on, and a helper method for determining
+ * whether selections are correct.
+ *
+ * @deprecated as of 1.9.4. Use {@link org.apache.tools.ant.types.selectors.BaseSelectorRule} instead.
+ */
+@Deprecated
+public abstract class BaseSelectorTest extends BuildFileTest {
+
+    private Project project;
+    private TaskdefForMakingBed tbed = null;
+    protected File basedir;
+    protected File beddir;
+    protected File mirrordir;
+    protected String[] filenames = {".","asf-logo.gif.md5","asf-logo.gif.bz2",
+            "asf-logo.gif.gz","copy.filterset.filtered","zip/asf-logo.gif.zip",
+            "tar/asf-logo.gif.tar","tar/asf-logo-huge.tar.gz",
+            "tar/gz/asf-logo.gif.tar.gz","tar/bz2/asf-logo.gif.tar.bz2",
+            "tar/bz2/asf-logo-huge.tar.bz2","tar/bz2"};
+    protected File[] files = new File[filenames.length];
+    protected File[] mirrorfiles = new File[filenames.length];
+
+    public BaseSelectorTest(String name) {
+        super(name);
+    }
+
+    public void setUp() {
+        configureProject("src/etc/testcases/types/selectors.xml");
+        executeTarget("setUp");
+        beddir = new File(super.getProject().getProperty("test.dir"));
+        mirrordir = new File(super.getProject().getProperty("mirror.dir"));
+        basedir = getProjectDir();
+        project = new Project();
+        project.init();
+        project.setBaseDir(basedir);
+        for (int x = 0; x < files.length; x++) {
+            files[x] = new File(beddir,filenames[x]);
+            mirrorfiles[x] = new File(mirrordir,filenames[x]);
+        }
+    }
+
+    /**
+     * Override this in child classes to return a specific Selector
+     */
+    public abstract BaseSelector getInstance();
+
+
+    /**
+     * Return a preconfigured selector (with a set reference to
+     * project instance).
+     * @return the selector
+     */
+    public BaseSelector getSelector() {
+        BaseSelector selector = getInstance();
+        selector.setProject( getProject() );
+        return selector;
+    }
+
+
+    public Project getProject() {
+        return project;
+    }
+
+    /**
+     * This is a test that all Selectors derived from BaseSelector can
+     * use. It calls the setError() method and checks to ensure that a
+     * BuildException is thrown as a result.
+     */
+    public void testRespondsToError() {
+        BaseSelector s = getInstance();
+        if (s == null) {
+            return;
+        }
+        s.setError("test error");
+        try {
+            s.isSelected(beddir,filenames[0],files[0]);
+            fail("Cannot cause BuildException when setError() is called");
+        } catch (BuildException be) {
+            assertEquals("test error",
+                         be.getMessage());
+        }
+    }
+
+
+    /**
+     * This is a helper method that takes a selector and calls its
+     * isSelected() method on each file in the testbed. It returns
+     * a string of "T"s amd "F"s
+     */
+    public String selectionString(FileSelector selector) {
+        return selectionString(beddir,files,selector);
+    }
+
+    /**
+     * This is a helper method that takes a selector and calls its
+     * isSelected() method on each file in the mirror testbed. This
+     * variation is used for dependency checks and to get around the
+     * limitations in the touch task when running JDK 1.1. It returns
+     * a string of "T"s amd "F"s.
+     */
+    public String mirrorSelectionString(FileSelector selector) {
+        return selectionString(mirrordir,mirrorfiles,selector);
+    }
+
+    /**
+     * Worker method for the two convenience methods above. Applies a
+     * selector on a set of files passed in and returns a string of
+     * "T"s amd "F"s from applying the selector to each file.
+     */
+    public String selectionString(File basedir, File[] files, FileSelector selector) {
+        StringBuffer buf = new StringBuffer();
+        for (int x = 0; x < files.length; x++) {
+            if (selector.isSelected(basedir,filenames[x],files[x])) {
+                buf.append('T');
+            }
+            else {
+                buf.append('F');
+            }
+        }
+        return buf.toString();
+    }
+
+    /**
+     * Does the selection test for a given selector and prints the
+     * filenames of the differing files (selected but shouldn't,
+     * not selected but should).
+     * @param selector  The selector to test
+     * @param expected  The expected result
+     */
+    public void performTests(FileSelector selector, String expected) {
+        String result = selectionString(selector);
+        String diff = diff(expected, result);
+        String resolved = resolve(diff);
+        assertEquals("Differing files: " + resolved, result, expected);
+    }
+
+    /**
+     *  Checks which files are selected and shouldn't be or which
+     *  are not selected but should.
+     *  @param expected    String containing 'F's and 'T's
+     *  @param result      String containing 'F's and 'T's
+     *  @return Difference as String containing '-' (equal) and
+     *          'X' (difference).
+     */
+    public String diff(String expected, String result) {
+        int length1 = expected.length();
+        int length2 = result.length();
+        int min = (length1 > length2) ? length2 : length1;
+        StringBuffer sb = new StringBuffer();
+        for (int i=0; i<min; i++) {
+            sb.append(
+                  (expected.charAt(i) == result.charAt(i))
+                ? "-"
+                : "X"
+            );
+        }
+        return sb.toString();
+    }
+
+
+    /**
+     * Resolves a diff-String (@see diff()) against the (inherited) filenames-
+     * and files arrays.
+     * @param filelist    Diff-String
+     * @return String containing the filenames for all differing files,
+     *         separated with semicolons ';'
+     */
+    public String resolve(String filelist) {
+        StringBuffer sb = new StringBuffer();
+        int min = (filenames.length > filelist.length())
+                ? filelist.length()
+                : filenames.length;
+        for (int i=0; i<min; i++) {
+            if ('X'==filelist.charAt(i)) {
+                sb.append(filenames[i]);
+                sb.append(";");
+            }
+        }
+        return sb.toString();
+    }
+
+
+    /**
+     * <p>Creates a testbed. We avoid the dreaded "test" word so that we
+     * don't falsely identify this as a test to be run. The actual
+     * setting up of the testbed is done in the
+     * <code>src/etc/testcases/types/selectors.xml</code> build file.</p>
+     *
+     * <p>Note that the right way to call this is within a try block,
+     * with a finally clause that calls cleanupBed(). You place tests of
+     * the isSelected() method within the try block.</p>
+     */
+    protected void makeBed() {
+        tbed = new TaskdefForMakingBed("setupfiles");
+        tbed.setUp();
+        tbed.makeTestbed();
+    }
+
+    /**
+     * Cleans up the testbed by calling a target in the
+     * <code>src/etc/testcases/types/selectors.xml</code> file.
+     */
+    protected void cleanupBed() {
+        if (tbed != null) {
+           tbed.tearDown();
+            tbed = null;
+        }
+    }
+
+
+    /**
+     * <p>Creates a mirror of the testbed for use in dependency checks.</p>
+     *
+     * <p>Note that the right way to call this is within a try block,
+     * with a finally clause that calls cleanupMirror(). You place tests of
+     * the isSelected() method within the try block.</p>
+     */
+    protected void makeMirror() {
+        tbed = new TaskdefForMakingBed("mirrorfiles");
+        tbed.setUp();
+        tbed.makeMirror();
+    }
+
+    /**
+     * Cleans up the mirror testbed by calling a target in the
+     * <code>src/etc/testcases/types/selectors.xml</code> file.
+     */
+    protected void cleanupMirror() {
+        if (tbed != null) {
+            tbed.deleteMirror();
+            tbed = null;
+        }
+    }
+
+    private class TaskdefForMakingBed extends BuildFileTest {
+
+        TaskdefForMakingBed(String name) {
+            super(name);
+        }
+
+        public void setUp() {
+            configureProject("src/etc/testcases/types/selectors.xml");
+        }
+
+        public void tearDown() {
+            try {
+                super.tearDown();
+            } catch (Exception exc) {
+                // ignore
+            }
+        }
+
+        public void makeTestbed() {
+            executeTarget("setupfiles");
+        }
+
+        public void makeMirror() {
+            executeTarget("mirrorfiles");
+        }
+
+        public void deleteMirror() {
+            executeTarget("tearDown");
+        }
+    }
+
+
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/selectors/ContainsRegexpTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/ContainsRegexpTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/ContainsRegexpTest.java
index 6dc8d72..4928e76 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/ContainsRegexpTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/ContainsRegexpTest.java
@@ -1,56 +1,55 @@
-/*
- *  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.types.selectors;
-
-import java.io.File;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-
-public class ContainsRegexpTest {
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject("src/etc/testcases/types/selectors.xml");
-    }
-
-    @Test
-    public void testContainsRegexp() {
-        buildRule.executeTarget("containsregexp");
-        File dir = new File(buildRule.getOutputDir(), "regexpseltestdest");
-        File[] files = dir.listFiles();
-        int filecount = files.length;
-
-        if (filecount != 1)  {
-            assertEquals("ContainsRegexp test should have copied 1 file",
-                         1, files.length);
-
-        }
-    }
-
-}
-
+/*
+ *  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.types.selectors;
+
+import java.io.File;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+
+public class ContainsRegexpTest {
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject("src/etc/testcases/types/selectors.xml");
+    }
+
+    @Test
+    public void testContainsRegexp() {
+        buildRule.executeTarget("containsregexp");
+        File dir = new File(buildRule.getOutputDir(), "regexpseltestdest");
+        File[] files = dir.listFiles();
+        int filecount = files.length;
+
+        if (filecount != 1)  {
+            assertEquals("ContainsRegexp test should have copied 1 file",
+                         1, files.length);
+
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/selectors/ContainsSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/ContainsSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/ContainsSelectorTest.java
index 822bf3e..e964e84 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/ContainsSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/ContainsSelectorTest.java
@@ -1,114 +1,114 @@
-/*
- *  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.types.selectors;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.types.Parameter;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-/**
- * Tests Contains Selectors.
- *
- */
-public class ContainsSelectorTest {
-
-    @Rule
-    public final BaseSelectorRule selectorRule = new BaseSelectorRule();
-
-
-    /**
-     * Test the code that validates the selector.
-     */
-    @Test
-    public void testValidate() {
-        ContainsSelector s = new ContainsSelector();
-        try {
-            s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
-            fail("ContainsSelector did not check for required field 'text'");
-        } catch (BuildException be1) {
-            assertEquals("The text attribute is required", be1.getMessage());
-        }
-
-        s = new ContainsSelector();
-        Parameter param = new Parameter();
-        param.setName("garbage in");
-        param.setValue("garbage out");
-        Parameter[] params = {param};
-        s.setParameters(params);
-        try {
-            s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
-            fail("ContainsSelector did not check for valid parameter element");
-        } catch (BuildException be2) {
-            assertEquals("Invalid parameter garbage in", be2.getMessage());
-        }
-
-    }
-
-    /**
-     * Tests to make sure that the selector is selecting files correctly.
-     */
-    @Test
-    public void testSelectionBehaviour() {
-        ContainsSelector s;
-        String results;
-
-
-        s = new ContainsSelector();
-        s.setText("no such string in test files");
-        results = selectorRule.selectionString(s);
-        assertEquals("TFFFFFFFFFFT", results);
-
-        s = new ContainsSelector();
-        s.setText("Apache Ant");
-        results = selectorRule.selectionString(s);
-        assertEquals("TFFFTFFFFFFT", results);
-
-        s = new ContainsSelector();
-        s.setText("apache ant");
-        s.setCasesensitive(true);
-        results = selectorRule.selectionString(s);
-        assertEquals("TFFFFFFFFFFT", results);
-
-        s = new ContainsSelector();
-        s.setText("apache ant");
-        s.setCasesensitive(false);
-        results = selectorRule.selectionString(s);
-        assertEquals("TFFFTFFFFFFT", results);
-
-        s = new ContainsSelector();
-        s.setText("ApacheAnt");
-        s.setIgnorewhitespace(true);
-        results = selectorRule.selectionString(s);
-        assertEquals("TFFFTFFFFFFT", results);
-
-        s = new ContainsSelector();
-        s.setText("A p a c h e    A n t");
-        s.setIgnorewhitespace(true);
-        results = selectorRule.selectionString(s);
-        assertEquals("TFFFTFFFFFFT", results);
-
-        
-
-    }
-
-}
+/*
+ *  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.types.selectors;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.Parameter;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Tests Contains Selectors.
+ *
+ */
+public class ContainsSelectorTest {
+
+    @Rule
+    public final BaseSelectorRule selectorRule = new BaseSelectorRule();
+
+
+    /**
+     * Test the code that validates the selector.
+     */
+    @Test
+    public void testValidate() {
+        ContainsSelector s = new ContainsSelector();
+        try {
+            s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+            fail("ContainsSelector did not check for required field 'text'");
+        } catch (BuildException be1) {
+            assertEquals("The text attribute is required", be1.getMessage());
+        }
+
+        s = new ContainsSelector();
+        Parameter param = new Parameter();
+        param.setName("garbage in");
+        param.setValue("garbage out");
+        Parameter[] params = {param};
+        s.setParameters(params);
+        try {
+            s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+            fail("ContainsSelector did not check for valid parameter element");
+        } catch (BuildException be2) {
+            assertEquals("Invalid parameter garbage in", be2.getMessage());
+        }
+
+    }
+
+    /**
+     * Tests to make sure that the selector is selecting files correctly.
+     */
+    @Test
+    public void testSelectionBehaviour() {
+        ContainsSelector s;
+        String results;
+
+
+        s = new ContainsSelector();
+        s.setText("no such string in test files");
+        results = selectorRule.selectionString(s);
+        assertEquals("TFFFFFFFFFFT", results);
+
+        s = new ContainsSelector();
+        s.setText("Apache Ant");
+        results = selectorRule.selectionString(s);
+        assertEquals("TFFFTFFFFFFT", results);
+
+        s = new ContainsSelector();
+        s.setText("apache ant");
+        s.setCasesensitive(true);
+        results = selectorRule.selectionString(s);
+        assertEquals("TFFFFFFFFFFT", results);
+
+        s = new ContainsSelector();
+        s.setText("apache ant");
+        s.setCasesensitive(false);
+        results = selectorRule.selectionString(s);
+        assertEquals("TFFFTFFFFFFT", results);
+
+        s = new ContainsSelector();
+        s.setText("ApacheAnt");
+        s.setIgnorewhitespace(true);
+        results = selectorRule.selectionString(s);
+        assertEquals("TFFFTFFFFFFT", results);
+
+        s = new ContainsSelector();
+        s.setText("A p a c h e    A n t");
+        s.setIgnorewhitespace(true);
+        results = selectorRule.selectionString(s);
+        assertEquals("TFFFTFFFFFFT", results);
+
+
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/selectors/DependSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/DependSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/DependSelectorTest.java
index 078052f..ec95878 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/DependSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/DependSelectorTest.java
@@ -1,185 +1,185 @@
-/*
- *  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.types.selectors;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.types.Mapper;
-import org.junit.Rule;
-import org.junit.Test;
-
-import java.io.File;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-
-/**
- * Tests Depend Selectors
- *
- */
-public class DependSelectorTest {
-
-    @Rule
-    public final BaseSelectorRule selectorRule = new BaseSelectorRule();
-
-    @Test
-    public void testValidateSingleMapper() {
-        try {
-            DependSelector s = new DependSelector();
-            s.createMapper();
-            s.createMapper();
-            fail("DependSelector allowed more than one nested mapper.");
-        } catch (BuildException be1) {
-            assertEquals("Cannot define more than one mapper",
-                    be1.getMessage());
-        }
-    }
-
-
-    @Test
-     public void testValidateRequiredFields() {
-        try {
-            DependSelector s = new DependSelector();
-            s.isSelected(selectorRule.getProject().getBaseDir(), selectorRule.getFilenames()[0], selectorRule.getFiles()[0]);
-            fail("DependSelector did not check for required fields");
-        } catch (BuildException be2) {
-            assertEquals("The targetdir attribute is required.",
-                    be2.getMessage());
-        }
-
-    }
-
-    @Test
-    public void testNoMapper() {
-        DependSelector s = new DependSelector();
-        s.setTargetdir(selectorRule.getBeddir());
-
-        String results = selectorRule.selectionString(s);
-        assertEquals("FFFFFFFFFFFF", results);
-    }
-
-    @Test
-    public void testIdentityMapper() {
-        DependSelector s = new DependSelector();
-        s.setTargetdir(selectorRule.getBeddir());
-
-        Mapper.MapperType identity = new Mapper.MapperType();
-        identity.setValue("identity");
-
-        Mapper m = s.createMapper();
-        m.setType(identity);
-
-        String results = selectorRule.selectionString(s);
-        assertEquals("FFFFFFFFFFFF", results);
-    }
-
-    @Test
-    public void testMergeMapper() {
-        DependSelector s = new DependSelector();
-        s.setTargetdir(selectorRule.getBeddir());
-
-        Mapper.MapperType merge = new Mapper.MapperType();
-        merge.setValue("merge");
-
-        Mapper m = s.createMapper();
-        m.setType(merge);
-        m.setTo("asf-logo.gif.gz");
-
-        String results = selectorRule.selectionString(s);
-        assertEquals("TFFFFTTTFFF", results.substring(0,11));
-    }
-
-    @Test
-    public void testMergeMapper2() {
-        DependSelector s = new DependSelector();
-        s.setTargetdir(selectorRule.getBeddir());
-
-        Mapper.MapperType merge = new Mapper.MapperType();
-        merge.setValue("merge");
-
-        Mapper m = s.createMapper();
-        m.setType(merge);
-        m.setTo("asf-logo.gif.bz2");
-        String results = selectorRule.selectionString(s);
-        assertEquals("TTFTTTTTTTTT", results);
-    }
-
-    @Test
-    public void testGlobMapperRelativePath() {
-        DependSelector s = new DependSelector();
-        File subdir = new File("selectortest/tar/bz2");
-        s.setTargetdir(subdir);
-
-        Mapper.MapperType glob = new Mapper.MapperType();
-        glob.setValue("glob");
-
-        Mapper m = s.createMapper();
-        m.setType(glob);
-        m.setFrom("*.bz2");
-        m.setTo("*.tar.bz2");
-
-        String results = selectorRule.selectionString(s);
-        assertEquals("FFTFFFFFFTTF", results);
-    }
-
-    @Test
-    public void testRestrictedGlobMapper() {
-        DependSelector s = new DependSelector();
-        File subdir = new File(selectorRule.getBeddir(), "tar/bz2");
-        s.setTargetdir(subdir);
-
-        Mapper.MapperType glob = new Mapper.MapperType();
-        glob.setValue("glob");
-
-        Mapper m = s.createMapper();
-        m.setType(glob);
-        m.setFrom("*.bz2");
-        m.setTo("*.tar.bz2");
-        String results = selectorRule.selectionString(s);
-        assertEquals("FFFFFFFFFTTF", results);
-    }
-
-    @Test
-    public void testSelectionNoMapper() {
-        DependSelector s = new DependSelector();
-        s.setTargetdir(new File(selectorRule.getOutputDir(), "selectortest2"));
-        String results = selectorRule.selectionString(s);
-        assertEquals("FFFTTFFFFFFF", results);
-    }
-
-
-    @Test
-    public void testMirroredSelection() {
-        DependSelector s = new DependSelector();
-        s.setTargetdir(new File(selectorRule.getOutputDir(), "selectortest2/tar/bz2"));
-
-        Mapper.MapperType glob = new Mapper.MapperType();
-        glob.setValue("glob");
-
-        Mapper m = s.createMapper();
-        m.setType(glob);
-        m.setFrom("*.bz2");
-        m.setTo("*.tar.bz2");
-        String results = selectorRule.mirrorSelectionString(s);
-        assertEquals("FFFFFFFFFTTF", results);
-        results = selectorRule.selectionString(s);
-        assertEquals("FFFFFFFFFTTF", results);
-    }
-
-}
+/*
+ *  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.types.selectors;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.Mapper;
+import org.junit.Rule;
+import org.junit.Test;
+
+import java.io.File;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+
+/**
+ * Tests Depend Selectors
+ *
+ */
+public class DependSelectorTest {
+
+    @Rule
+    public final BaseSelectorRule selectorRule = new BaseSelectorRule();
+
+    @Test
+    public void testValidateSingleMapper() {
+        try {
+            DependSelector s = new DependSelector();
+            s.createMapper();
+            s.createMapper();
+            fail("DependSelector allowed more than one nested mapper.");
+        } catch (BuildException be1) {
+            assertEquals("Cannot define more than one mapper",
+                    be1.getMessage());
+        }
+    }
+
+
+    @Test
+     public void testValidateRequiredFields() {
+        try {
+            DependSelector s = new DependSelector();
+            s.isSelected(selectorRule.getProject().getBaseDir(), selectorRule.getFilenames()[0], selectorRule.getFiles()[0]);
+            fail("DependSelector did not check for required fields");
+        } catch (BuildException be2) {
+            assertEquals("The targetdir attribute is required.",
+                    be2.getMessage());
+        }
+
+    }
+
+    @Test
+    public void testNoMapper() {
+        DependSelector s = new DependSelector();
+        s.setTargetdir(selectorRule.getBeddir());
+
+        String results = selectorRule.selectionString(s);
+        assertEquals("FFFFFFFFFFFF", results);
+    }
+
+    @Test
+    public void testIdentityMapper() {
+        DependSelector s = new DependSelector();
+        s.setTargetdir(selectorRule.getBeddir());
+
+        Mapper.MapperType identity = new Mapper.MapperType();
+        identity.setValue("identity");
+
+        Mapper m = s.createMapper();
+        m.setType(identity);
+
+        String results = selectorRule.selectionString(s);
+        assertEquals("FFFFFFFFFFFF", results);
+    }
+
+    @Test
+    public void testMergeMapper() {
+        DependSelector s = new DependSelector();
+        s.setTargetdir(selectorRule.getBeddir());
+
+        Mapper.MapperType merge = new Mapper.MapperType();
+        merge.setValue("merge");
+
+        Mapper m = s.createMapper();
+        m.setType(merge);
+        m.setTo("asf-logo.gif.gz");
+
+        String results = selectorRule.selectionString(s);
+        assertEquals("TFFFFTTTFFF", results.substring(0,11));
+    }
+
+    @Test
+    public void testMergeMapper2() {
+        DependSelector s = new DependSelector();
+        s.setTargetdir(selectorRule.getBeddir());
+
+        Mapper.MapperType merge = new Mapper.MapperType();
+        merge.setValue("merge");
+
+        Mapper m = s.createMapper();
+        m.setType(merge);
+        m.setTo("asf-logo.gif.bz2");
+        String results = selectorRule.selectionString(s);
+        assertEquals("TTFTTTTTTTTT", results);
+    }
+
+    @Test
+    public void testGlobMapperRelativePath() {
+        DependSelector s = new DependSelector();
+        File subdir = new File("selectortest/tar/bz2");
+        s.setTargetdir(subdir);
+
+        Mapper.MapperType glob = new Mapper.MapperType();
+        glob.setValue("glob");
+
+        Mapper m = s.createMapper();
+        m.setType(glob);
+        m.setFrom("*.bz2");
+        m.setTo("*.tar.bz2");
+
+        String results = selectorRule.selectionString(s);
+        assertEquals("FFTFFFFFFTTF", results);
+    }
+
+    @Test
+    public void testRestrictedGlobMapper() {
+        DependSelector s = new DependSelector();
+        File subdir = new File(selectorRule.getBeddir(), "tar/bz2");
+        s.setTargetdir(subdir);
+
+        Mapper.MapperType glob = new Mapper.MapperType();
+        glob.setValue("glob");
+
+        Mapper m = s.createMapper();
+        m.setType(glob);
+        m.setFrom("*.bz2");
+        m.setTo("*.tar.bz2");
+        String results = selectorRule.selectionString(s);
+        assertEquals("FFFFFFFFFTTF", results);
+    }
+
+    @Test
+    public void testSelectionNoMapper() {
+        DependSelector s = new DependSelector();
+        s.setTargetdir(new File(selectorRule.getOutputDir(), "selectortest2"));
+        String results = selectorRule.selectionString(s);
+        assertEquals("FFFTTFFFFFFF", results);
+    }
+
+
+    @Test
+    public void testMirroredSelection() {
+        DependSelector s = new DependSelector();
+        s.setTargetdir(new File(selectorRule.getOutputDir(), "selectortest2/tar/bz2"));
+
+        Mapper.MapperType glob = new Mapper.MapperType();
+        glob.setValue("glob");
+
+        Mapper m = s.createMapper();
+        m.setType(glob);
+        m.setFrom("*.bz2");
+        m.setTo("*.tar.bz2");
+        String results = selectorRule.mirrorSelectionString(s);
+        assertEquals("FFFFFFFFFTTF", results);
+        results = selectorRule.selectionString(s);
+        assertEquals("FFFFFFFFFTTF", results);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/selectors/DepthSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/DepthSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/DepthSelectorTest.java
index 924995c..526a5bf 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/DepthSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/DepthSelectorTest.java
@@ -1,147 +1,147 @@
-/*
- *  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.types.selectors;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.types.Parameter;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-/**
- * Tests Depth Selectors
- *
- */
-public class DepthSelectorTest {
-    
-    @Rule
-    public final BaseSelectorRule selectorRule = new BaseSelectorRule();
-
-
-    /**
-     * Test the code that validates the selector.
-     */
-    @Test
-    public void testValidate() {
-        DepthSelector s = new DepthSelector();
-        try {
-            s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
-            fail("DepthSelector did not check for required fields");
-        } catch (BuildException be1) {
-            assertEquals("You must set at least one of the min or the " +
-                    "max levels.", be1.getMessage());
-        }
-
-        s = new DepthSelector();
-        s.setMin(5);
-        s.setMax(2);
-        try {
-            s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
-            fail("DepthSelector did not check for maximum being higher "
-                    + "than minimum");
-        } catch (BuildException be2) {
-            assertEquals("The maximum depth is lower than the minimum.",
-                    be2.getMessage());
-        }
-
-        s = new DepthSelector();
-        Parameter param = new Parameter();
-        param.setName("garbage in");
-        param.setValue("garbage out");
-        Parameter[] params = new Parameter[1];
-        params[0] = param;
-        s.setParameters(params);
-        try {
-            s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
-            fail("DepthSelector did not check for valid parameter element");
-        } catch (BuildException be3) {
-            assertEquals("Invalid parameter garbage in", be3.getMessage());
-        }
-
-        s = new DepthSelector();
-        param = new Parameter();
-        param.setName("min");
-        param.setValue("garbage out");
-        params[0] = param;
-        s.setParameters(params);
-        try {
-            s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
-            fail("DepthSelector accepted bad minimum as parameter");
-        } catch (BuildException be4) {
-            assertEquals("Invalid minimum value garbage out",
-                    be4.getMessage());
-        }
-
-        s = new DepthSelector();
-        param = new Parameter();
-        param.setName("max");
-        param.setValue("garbage out");
-        params[0] = param;
-        s.setParameters(params);
-        try {
-            s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
-            fail("DepthSelector accepted bad maximum as parameter");
-        } catch (BuildException be5) {
-            assertEquals("Invalid maximum value garbage out",
-                    be5.getMessage());
-        }
-
-    }
-
-    /**
-     * Tests to make sure that the selector is selecting files correctly.
-     */
-    @Test
-    public void testSelectionBehaviour() {
-        DepthSelector s;
-        String results;
-
-        s = new DepthSelector();
-        s.setMin(20);
-        s.setMax(25);
-        results = selectorRule.selectionString(s);
-        assertEquals("FFFFFFFFFFFF", results);
-
-        s = new DepthSelector();
-        s.setMin(0);
-        results = selectorRule.selectionString(s);
-        assertEquals("TTTTTTTTTTTT", results);
-
-        s = new DepthSelector();
-        s.setMin(1);
-        results = selectorRule.selectionString(s);
-        assertEquals("FFFFFTTTTTTT", results);
-
-        s = new DepthSelector();
-        s.setMax(0);
-        results = selectorRule.selectionString(s);
-        assertEquals("TTTTTFFFFFFF", results);
-
-        s = new DepthSelector();
-        s.setMin(1);
-        s.setMax(1);
-        results = selectorRule.selectionString(s);
-        assertEquals("FFFFFTTTFFFT", results);
-
-
-    }
-
-}
+/*
+ *  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.types.selectors;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.Parameter;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Tests Depth Selectors
+ *
+ */
+public class DepthSelectorTest {
+
+    @Rule
+    public final BaseSelectorRule selectorRule = new BaseSelectorRule();
+
+
+    /**
+     * Test the code that validates the selector.
+     */
+    @Test
+    public void testValidate() {
+        DepthSelector s = new DepthSelector();
+        try {
+            s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+            fail("DepthSelector did not check for required fields");
+        } catch (BuildException be1) {
+            assertEquals("You must set at least one of the min or the " +
+                    "max levels.", be1.getMessage());
+        }
+
+        s = new DepthSelector();
+        s.setMin(5);
+        s.setMax(2);
+        try {
+            s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+            fail("DepthSelector did not check for maximum being higher "
+                    + "than minimum");
+        } catch (BuildException be2) {
+            assertEquals("The maximum depth is lower than the minimum.",
+                    be2.getMessage());
+        }
+
+        s = new DepthSelector();
+        Parameter param = new Parameter();
+        param.setName("garbage in");
+        param.setValue("garbage out");
+        Parameter[] params = new Parameter[1];
+        params[0] = param;
+        s.setParameters(params);
+        try {
+            s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+            fail("DepthSelector did not check for valid parameter element");
+        } catch (BuildException be3) {
+            assertEquals("Invalid parameter garbage in", be3.getMessage());
+        }
+
+        s = new DepthSelector();
+        param = new Parameter();
+        param.setName("min");
+        param.setValue("garbage out");
+        params[0] = param;
+        s.setParameters(params);
+        try {
+            s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+            fail("DepthSelector accepted bad minimum as parameter");
+        } catch (BuildException be4) {
+            assertEquals("Invalid minimum value garbage out",
+                    be4.getMessage());
+        }
+
+        s = new DepthSelector();
+        param = new Parameter();
+        param.setName("max");
+        param.setValue("garbage out");
+        params[0] = param;
+        s.setParameters(params);
+        try {
+            s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+            fail("DepthSelector accepted bad maximum as parameter");
+        } catch (BuildException be5) {
+            assertEquals("Invalid maximum value garbage out",
+                    be5.getMessage());
+        }
+
+    }
+
+    /**
+     * Tests to make sure that the selector is selecting files correctly.
+     */
+    @Test
+    public void testSelectionBehaviour() {
+        DepthSelector s;
+        String results;
+
+        s = new DepthSelector();
+        s.setMin(20);
+        s.setMax(25);
+        results = selectorRule.selectionString(s);
+        assertEquals("FFFFFFFFFFFF", results);
+
+        s = new DepthSelector();
+        s.setMin(0);
+        results = selectorRule.selectionString(s);
+        assertEquals("TTTTTTTTTTTT", results);
+
+        s = new DepthSelector();
+        s.setMin(1);
+        results = selectorRule.selectionString(s);
+        assertEquals("FFFFFTTTTTTT", results);
+
+        s = new DepthSelector();
+        s.setMax(0);
+        results = selectorRule.selectionString(s);
+        assertEquals("TTTTTFFFFFFF", results);
+
+        s = new DepthSelector();
+        s.setMin(1);
+        s.setMax(1);
+        results = selectorRule.selectionString(s);
+        assertEquals("FFFFFTTTFFFT", results);
+
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/selectors/FilenameSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/FilenameSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/FilenameSelectorTest.java
index 121f433..357fe49 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/FilenameSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/FilenameSelectorTest.java
@@ -1,115 +1,115 @@
-/*
- *  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.types.selectors;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.types.Parameter;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-/**
- * Tests Filename Selectors
- *
- */
-public class FilenameSelectorTest {
-
-    @Rule
-    public final BaseSelectorRule selectorRule = new BaseSelectorRule();
-
-    /**
-     * Test the code that validates the selector.
-     */
-    @Test
-    public void testValidate() {
-        FilenameSelector s = new FilenameSelector();
-        try {
-            s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
-            fail("FilenameSelector did not check for required fields");
-        } catch (BuildException be1) {
-            assertEquals("The name or regex attribute is required", be1.getMessage());
-        }
-
-        s = new FilenameSelector();
-        Parameter param = new Parameter();
-        param.setName("garbage in");
-        param.setValue("garbage out");
-        Parameter[] params = {param};
-        s.setParameters(params);
-        try {
-            s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
-            fail("FilenameSelector did not check for valid parameter element");
-        } catch (BuildException be2) {
-            assertEquals("Invalid parameter garbage in", be2.getMessage());
-        }
-
-    }
-
-    /**
-     * Tests to make sure that the selector is selecting files correctly.
-     */
-    @Test
-    public void testSelectionBehaviour() {
-        FilenameSelector s;
-        String results;
-
-
-            s = new FilenameSelector();
-            s.setName("no match possible");
-            results = selectorRule.selectionString(s);
-            assertEquals("FFFFFFFFFFFF", results);
-
-            s = new FilenameSelector();
-            s.setName("*.gz");
-            results = selectorRule.selectionString(s);
-            // This is turned off temporarily. There appears to be a bug
-            // in SelectorUtils.matchPattern() where it is recursive on
-            // Windows even if no ** is in pattern.
-            //assertEquals("FFFTFFFFFFFF", results); // Unix
-            // vs
-            //assertEquals("FFFTFFFFTFFF", results); // Windows
-
-            s = new FilenameSelector();
-            s.setName("**/*.gz");
-            s.setNegate(true);
-            results = selectorRule.selectionString(s);
-            assertEquals("TTTFTTTFFTTT", results);
-
-            s = new FilenameSelector();
-            s.setName("**/*.GZ");
-            s.setCasesensitive(false);
-            results = selectorRule.selectionString(s);
-            assertEquals("FFFTFFFTTFFF", results);
-
-            s = new FilenameSelector();
-            Parameter param1 = new Parameter();
-            param1.setName("name");
-            param1.setValue("**/*.bz2");
-            Parameter[] params = {param1};
-            s.setParameters(params);
-            results = selectorRule.selectionString(s);
-            assertEquals("FFTFFFFFFTTF", results);
-
-        
-
-    }
-
-}
+/*
+ *  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.types.selectors;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.Parameter;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Tests Filename Selectors
+ *
+ */
+public class FilenameSelectorTest {
+
+    @Rule
+    public final BaseSelectorRule selectorRule = new BaseSelectorRule();
+
+    /**
+     * Test the code that validates the selector.
+     */
+    @Test
+    public void testValidate() {
+        FilenameSelector s = new FilenameSelector();
+        try {
+            s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+            fail("FilenameSelector did not check for required fields");
+        } catch (BuildException be1) {
+            assertEquals("The name or regex attribute is required", be1.getMessage());
+        }
+
+        s = new FilenameSelector();
+        Parameter param = new Parameter();
+        param.setName("garbage in");
+        param.setValue("garbage out");
+        Parameter[] params = {param};
+        s.setParameters(params);
+        try {
+            s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+            fail("FilenameSelector did not check for valid parameter element");
+        } catch (BuildException be2) {
+            assertEquals("Invalid parameter garbage in", be2.getMessage());
+        }
+
+    }
+
+    /**
+     * Tests to make sure that the selector is selecting files correctly.
+     */
+    @Test
+    public void testSelectionBehaviour() {
+        FilenameSelector s;
+        String results;
+
+
+            s = new FilenameSelector();
+            s.setName("no match possible");
+            results = selectorRule.selectionString(s);
+            assertEquals("FFFFFFFFFFFF", results);
+
+            s = new FilenameSelector();
+            s.setName("*.gz");
+            results = selectorRule.selectionString(s);
+            // This is turned off temporarily. There appears to be a bug
+            // in SelectorUtils.matchPattern() where it is recursive on
+            // Windows even if no ** is in pattern.
+            //assertEquals("FFFTFFFFFFFF", results); // Unix
+            // vs
+            //assertEquals("FFFTFFFFTFFF", results); // Windows
+
+            s = new FilenameSelector();
+            s.setName("**/*.gz");
+            s.setNegate(true);
+            results = selectorRule.selectionString(s);
+            assertEquals("TTTFTTTFFTTT", results);
+
+            s = new FilenameSelector();
+            s.setName("**/*.GZ");
+            s.setCasesensitive(false);
+            results = selectorRule.selectionString(s);
+            assertEquals("FFFTFFFTTFFF", results);
+
+            s = new FilenameSelector();
+            Parameter param1 = new Parameter();
+            param1.setName("name");
+            param1.setValue("**/*.bz2");
+            Parameter[] params = {param1};
+            s.setParameters(params);
+            results = selectorRule.selectionString(s);
+            assertEquals("FFTFFFFFFTTF", results);
+
+
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/selectors/MockAlgorithm.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/MockAlgorithm.java b/src/tests/junit/org/apache/tools/ant/types/selectors/MockAlgorithm.java
index c741952..458c83f 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/MockAlgorithm.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/MockAlgorithm.java
@@ -1,37 +1,37 @@
-/*
- *  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.types.selectors;
-
-
-import java.io.File;
-import org.apache.tools.ant.types.selectors.modifiedselector.Algorithm;
-
-public class MockAlgorithm implements Algorithm {
-    public boolean isValid() {
-        return true;
-    }
-
-    public String getValue(File file) {
-        return "TEST";
-    }
-
-    public String toString() {
-        return "MockAlgorithm@" + hashCode();
-    }
-}
+/*
+ *  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.types.selectors;
+
+
+import java.io.File;
+import org.apache.tools.ant.types.selectors.modifiedselector.Algorithm;
+
+public class MockAlgorithm implements Algorithm {
+    public boolean isValid() {
+        return true;
+    }
+
+    public String getValue(File file) {
+        return "TEST";
+    }
+
+    public String toString() {
+        return "MockAlgorithm@" + hashCode();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/selectors/MockCache.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/MockCache.java b/src/tests/junit/org/apache/tools/ant/types/selectors/MockCache.java
index 6fc87f3..359a179 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/MockCache.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/MockCache.java
@@ -1,68 +1,68 @@
-/*
- *  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.types.selectors;
-
-
-import java.util.Iterator;
-import org.apache.tools.ant.types.selectors.modifiedselector.Cache;
-
-public class MockCache implements Cache {
-
-    public boolean debug = false;
-    public boolean saved = false;
-
-
-    public MockCache() {
-        log("()");
-    }
-
-    public boolean isValid() {
-        log(".isValid()");
-        return true;
-    }
-    public void delete() {
-        log(".delete()");
-    }
-    public void load() {
-        log(".load()");
-    }
-    public void save() {
-        log(".save()");
-        saved = true;
-    }
-    public Object get(Object key) {
-        log(".get("+key+")");
-        return key;
-    }
-    public void put(Object key, Object value) {
-        log(".put("+key+", "+value+")");
-        saved = false;
-    }
-    public Iterator<String> iterator() {
-        log("iterator()");
-        return null;
-    }
-    public String toString() {
-        return "MockCache@" + hashCode();
-    }
-
-    private void log(String msg) {
-        if (debug) System.out.println(this+msg);
-    }
-}//class-MockCache
+/*
+ *  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.types.selectors;
+
+
+import java.util.Iterator;
+import org.apache.tools.ant.types.selectors.modifiedselector.Cache;
+
+public class MockCache implements Cache {
+
+    public boolean debug = false;
+    public boolean saved = false;
+
+
+    public MockCache() {
+        log("()");
+    }
+
+    public boolean isValid() {
+        log(".isValid()");
+        return true;
+    }
+    public void delete() {
+        log(".delete()");
+    }
+    public void load() {
+        log(".load()");
+    }
+    public void save() {
+        log(".save()");
+        saved = true;
+    }
+    public Object get(Object key) {
+        log(".get("+key+")");
+        return key;
+    }
+    public void put(Object key, Object value) {
+        log(".put("+key+", "+value+")");
+        saved = false;
+    }
+    public Iterator<String> iterator() {
+        log("iterator()");
+        return null;
+    }
+    public String toString() {
+        return "MockCache@" + hashCode();
+    }
+
+    private void log(String msg) {
+        if (debug) System.out.println(this+msg);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/selectors/MockComparator.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/MockComparator.java b/src/tests/junit/org/apache/tools/ant/types/selectors/MockComparator.java
index fdbb75d..180aa46 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/MockComparator.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/MockComparator.java
@@ -1,32 +1,32 @@
-/*
- *  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.types.selectors;
-
-import java.util.Comparator;
-
-public class MockComparator implements Comparator {
-
-    public int compare(Object o1, Object o2) {
-        return 0;
-    }
-
-    public String toString() {
-        return "MockComparator";
-    }
-}//class-MockCache
+/*
+ *  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.types.selectors;
+
+import java.util.Comparator;
+
+public class MockComparator implements Comparator {
+
+    public int compare(Object o1, Object o2) {
+        return 0;
+    }
+
+    public String toString() {
+        return "MockComparator";
+    }
+}


[07/21] ant git commit: Normalise tabulation and line breaks

Posted by gi...@apache.org.
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/selectors/SignedSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/SignedSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/SignedSelectorTest.java
index 29da454..1eb40dc 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/SignedSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/SignedSelectorTest.java
@@ -1,54 +1,54 @@
-/*
- *  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.types.selectors;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-/**
- * Testcase for the &lt;signedselector&gt; selector.
- *
- */
-public class SignedSelectorTest {
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject("src/etc/testcases/types/selectors/signedselector.xml");
-    }
-
-    @Test
-    public void testSelectSigned() {
-        buildRule.executeTarget("selectsigned");
-    }
-
-    @Test
-    public void testNotSelected() {
-        buildRule.executeTarget("notselected");
-    }
-
-    @Test
-    public void testName() {
-        buildRule.executeTarget("name");
-    }
-}
+/*
+ *  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.types.selectors;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+/**
+ * Testcase for the &lt;signedselector&gt; selector.
+ *
+ */
+public class SignedSelectorTest {
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject("src/etc/testcases/types/selectors/signedselector.xml");
+    }
+
+    @Test
+    public void testSelectSigned() {
+        buildRule.executeTarget("selectsigned");
+    }
+
+    @Test
+    public void testNotSelected() {
+        buildRule.executeTarget("notselected");
+    }
+
+    @Test
+    public void testName() {
+        buildRule.executeTarget("name");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/selectors/SizeSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/SizeSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/SizeSelectorTest.java
index 4cec0bd..37f41a5 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/SizeSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/SizeSelectorTest.java
@@ -1,237 +1,237 @@
-/*
- *  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.types.selectors;
-
-import java.util.Locale;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.types.Parameter;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-/**
- * Tests Size Selectors
- *
- */
-public class SizeSelectorTest {
-    
-    @Rule
-    public final BaseSelectorRule selectorRule = new BaseSelectorRule();
-
-    /**
-     * Test the code that validates the selector.
-     */
-    @Test
-    public void testValidate() {
-        SizeSelector s = new SizeSelector();
-        try {
-            s.isSelected(selectorRule.getProject().getBaseDir(), selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
-            fail("SizeSelector did not check for required fields");
-        } catch (BuildException be1) {
-            assertEquals("The value attribute is required, and must "
-                    + "be positive", be1.getMessage());
-        }
-
-        s = new SizeSelector();
-        s.setValue(-10);
-        try {
-            s.isSelected(selectorRule.getProject().getBaseDir(), selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
-            fail("SizeSelector did not check for value being in the "
-                    + "allowable range");
-        } catch (BuildException be2) {
-            assertEquals("The value attribute is required, and must "
-                    + "be positive", be2.getMessage());
-        }
-
-        s = new SizeSelector();
-        Parameter param = new Parameter();
-        param.setName("garbage in");
-        param.setValue("garbage out");
-        Parameter[] params = {param};
-        s.setParameters(params);
-        try {
-            s.isSelected(selectorRule.getProject().getBaseDir(), selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
-            fail("SizeSelector did not check for valid parameter element");
-        } catch (BuildException be3) {
-            assertEquals("Invalid parameter garbage in", be3.getMessage());
-        }
-
-        s = new SizeSelector();
-        param = new Parameter();
-        param.setName("value");
-        param.setValue("garbage out");
-        params[0] = param;
-        s.setParameters(params);
-        try {
-            s.isSelected(selectorRule.getProject().getBaseDir(), selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
-            fail("SizeSelector accepted bad value as parameter");
-        } catch (BuildException be4) {
-            assertEquals("Invalid size setting garbage out",
-                    be4.getMessage());
-        }
-
-        s = new SizeSelector();
-        Parameter param1 = new Parameter();
-        Parameter param2 = new Parameter();
-        param1.setName("value");
-        param1.setValue("5");
-        param2.setName("units");
-        param2.setValue("garbage out");
-        params = new Parameter[2];
-        params[0] = param1;
-        params[1] = param2;
-        try {
-            s.setParameters(params);
-            s.isSelected(selectorRule.getProject().getBaseDir(), selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
-            fail("SizeSelector accepted bad units as parameter");
-        } catch (BuildException be5) {
-            assertEquals("garbage out is not a legal value for this attribute",
-                    be5.getMessage());
-        }
-
-    }
-
-    /**
-     * Tests to make sure that the selector is selecting files correctly.
-     */
-    @Test
-    public void testSelectionBehaviour() {
-        SizeSelector s;
-        String results;
-
-        SizeSelector.ByteUnits kilo = new SizeSelector.ByteUnits();
-        kilo.setValue("K");
-        SizeSelector.ByteUnits kibi = new SizeSelector.ByteUnits();
-        kibi.setValue("Ki");
-        SizeSelector.ByteUnits tibi = new SizeSelector.ByteUnits();
-        tibi.setValue("Ti");
-        SizeSelector.SizeComparisons less = new SizeSelector.SizeComparisons();
-        less.setValue("less");
-        SizeSelector.SizeComparisons equal = new SizeSelector.SizeComparisons();
-        equal.setValue("equal");
-        SizeSelector.SizeComparisons more = new SizeSelector.SizeComparisons();
-        more.setValue("more");
-
-
-    
-        s = new SizeSelector();
-        s.setValue(10);
-        s.setWhen(less);
-        results = selectorRule.selectionString(s);
-        assertEquals("TFFFFFFFFFFT", results);
-
-        s = new SizeSelector();
-        s.setValue(10);
-        s.setWhen(more);
-        results = selectorRule.selectionString(s);
-        assertEquals("TTTTTTTTTTTT", results);
-
-        s = new SizeSelector();
-        s.setValue(32);
-        s.setWhen(equal);
-        results = selectorRule.selectionString(s);
-        assertEquals("TFFFTFFFFFFT", results);
-
-        s = new SizeSelector();
-        s.setValue(7);
-        s.setWhen(more);
-        s.setUnits(kilo);
-        results = selectorRule.selectionString(s);
-        assertEquals("TFTFFTTTTTTT", results);
-
-        s = new SizeSelector();
-        s.setValue(7);
-        s.setWhen(more);
-        s.setUnits(kibi);
-        results = selectorRule.selectionString(s);
-        assertEquals("TFTFFFTTFTTT", results);
-
-        s = new SizeSelector();
-        s.setValue(99999);
-        s.setWhen(more);
-        s.setUnits(tibi);
-        results = selectorRule.selectionString(s);
-        assertEquals("TFFFFFFFFFFT", results);
-
-        s = new SizeSelector();
-        Parameter param1 = new Parameter();
-        Parameter param2 = new Parameter();
-        Parameter param3 = new Parameter();
-        param1.setName("value");
-        param1.setValue("20");
-        param2.setName("units");
-        param2.setValue("Ki");
-        param3.setName("when");
-        param3.setValue("more");
-        Parameter[] params = {param1,param2,param3};
-        s.setParameters(params);
-        results = selectorRule.selectionString(s);
-        assertEquals("TFFFFFFTFFTT", results);
-    
-
-    }
-
-    @Test
-    public void testParameterParsingLowerCase() {
-        testCaseInsensitiveParameterParsing("units");
-    }
-
-    @Test
-    public void testParameterParsingUpperCase() {
-        testCaseInsensitiveParameterParsing("UNITS");
-    }
-
-    @Test
-    public void testParameterParsingLowerCaseTurkish() {
-        Locale l = Locale.getDefault();
-        try {
-            Locale.setDefault(new Locale("tr"));
-            testCaseInsensitiveParameterParsing("units");
-        } finally {
-            Locale.setDefault(l);
-        }
-    }
-
-    @Test
-    public void testParameterParsingUpperCaseTurkish() {
-        Locale l = Locale.getDefault();
-        try {
-            Locale.setDefault(new Locale("tr"));
-            testCaseInsensitiveParameterParsing("UNITS");
-        } finally {
-            Locale.setDefault(l);
-        }
-    }
-
-    private void testCaseInsensitiveParameterParsing(String name) {
-        SizeSelector s = new SizeSelector();
-        Parameter p = new Parameter();
-        p.setName(name);
-        p.setValue("foo");
-        try {
-            s.setParameters(new Parameter[] {p});
-            fail("should have caused an exception");
-        } catch (BuildException be) {
-            assertEquals("foo is not a legal value for this attribute",
-                         be.getMessage());
-        }
-    }
-}
+/*
+ *  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.types.selectors;
+
+import java.util.Locale;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.Parameter;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Tests Size Selectors
+ *
+ */
+public class SizeSelectorTest {
+
+    @Rule
+    public final BaseSelectorRule selectorRule = new BaseSelectorRule();
+
+    /**
+     * Test the code that validates the selector.
+     */
+    @Test
+    public void testValidate() {
+        SizeSelector s = new SizeSelector();
+        try {
+            s.isSelected(selectorRule.getProject().getBaseDir(), selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+            fail("SizeSelector did not check for required fields");
+        } catch (BuildException be1) {
+            assertEquals("The value attribute is required, and must "
+                    + "be positive", be1.getMessage());
+        }
+
+        s = new SizeSelector();
+        s.setValue(-10);
+        try {
+            s.isSelected(selectorRule.getProject().getBaseDir(), selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+            fail("SizeSelector did not check for value being in the "
+                    + "allowable range");
+        } catch (BuildException be2) {
+            assertEquals("The value attribute is required, and must "
+                    + "be positive", be2.getMessage());
+        }
+
+        s = new SizeSelector();
+        Parameter param = new Parameter();
+        param.setName("garbage in");
+        param.setValue("garbage out");
+        Parameter[] params = {param};
+        s.setParameters(params);
+        try {
+            s.isSelected(selectorRule.getProject().getBaseDir(), selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+            fail("SizeSelector did not check for valid parameter element");
+        } catch (BuildException be3) {
+            assertEquals("Invalid parameter garbage in", be3.getMessage());
+        }
+
+        s = new SizeSelector();
+        param = new Parameter();
+        param.setName("value");
+        param.setValue("garbage out");
+        params[0] = param;
+        s.setParameters(params);
+        try {
+            s.isSelected(selectorRule.getProject().getBaseDir(), selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+            fail("SizeSelector accepted bad value as parameter");
+        } catch (BuildException be4) {
+            assertEquals("Invalid size setting garbage out",
+                    be4.getMessage());
+        }
+
+        s = new SizeSelector();
+        Parameter param1 = new Parameter();
+        Parameter param2 = new Parameter();
+        param1.setName("value");
+        param1.setValue("5");
+        param2.setName("units");
+        param2.setValue("garbage out");
+        params = new Parameter[2];
+        params[0] = param1;
+        params[1] = param2;
+        try {
+            s.setParameters(params);
+            s.isSelected(selectorRule.getProject().getBaseDir(), selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+            fail("SizeSelector accepted bad units as parameter");
+        } catch (BuildException be5) {
+            assertEquals("garbage out is not a legal value for this attribute",
+                    be5.getMessage());
+        }
+
+    }
+
+    /**
+     * Tests to make sure that the selector is selecting files correctly.
+     */
+    @Test
+    public void testSelectionBehaviour() {
+        SizeSelector s;
+        String results;
+
+        SizeSelector.ByteUnits kilo = new SizeSelector.ByteUnits();
+        kilo.setValue("K");
+        SizeSelector.ByteUnits kibi = new SizeSelector.ByteUnits();
+        kibi.setValue("Ki");
+        SizeSelector.ByteUnits tibi = new SizeSelector.ByteUnits();
+        tibi.setValue("Ti");
+        SizeSelector.SizeComparisons less = new SizeSelector.SizeComparisons();
+        less.setValue("less");
+        SizeSelector.SizeComparisons equal = new SizeSelector.SizeComparisons();
+        equal.setValue("equal");
+        SizeSelector.SizeComparisons more = new SizeSelector.SizeComparisons();
+        more.setValue("more");
+
+
+
+        s = new SizeSelector();
+        s.setValue(10);
+        s.setWhen(less);
+        results = selectorRule.selectionString(s);
+        assertEquals("TFFFFFFFFFFT", results);
+
+        s = new SizeSelector();
+        s.setValue(10);
+        s.setWhen(more);
+        results = selectorRule.selectionString(s);
+        assertEquals("TTTTTTTTTTTT", results);
+
+        s = new SizeSelector();
+        s.setValue(32);
+        s.setWhen(equal);
+        results = selectorRule.selectionString(s);
+        assertEquals("TFFFTFFFFFFT", results);
+
+        s = new SizeSelector();
+        s.setValue(7);
+        s.setWhen(more);
+        s.setUnits(kilo);
+        results = selectorRule.selectionString(s);
+        assertEquals("TFTFFTTTTTTT", results);
+
+        s = new SizeSelector();
+        s.setValue(7);
+        s.setWhen(more);
+        s.setUnits(kibi);
+        results = selectorRule.selectionString(s);
+        assertEquals("TFTFFFTTFTTT", results);
+
+        s = new SizeSelector();
+        s.setValue(99999);
+        s.setWhen(more);
+        s.setUnits(tibi);
+        results = selectorRule.selectionString(s);
+        assertEquals("TFFFFFFFFFFT", results);
+
+        s = new SizeSelector();
+        Parameter param1 = new Parameter();
+        Parameter param2 = new Parameter();
+        Parameter param3 = new Parameter();
+        param1.setName("value");
+        param1.setValue("20");
+        param2.setName("units");
+        param2.setValue("Ki");
+        param3.setName("when");
+        param3.setValue("more");
+        Parameter[] params = {param1,param2,param3};
+        s.setParameters(params);
+        results = selectorRule.selectionString(s);
+        assertEquals("TFFFFFFTFFTT", results);
+
+
+    }
+
+    @Test
+    public void testParameterParsingLowerCase() {
+        testCaseInsensitiveParameterParsing("units");
+    }
+
+    @Test
+    public void testParameterParsingUpperCase() {
+        testCaseInsensitiveParameterParsing("UNITS");
+    }
+
+    @Test
+    public void testParameterParsingLowerCaseTurkish() {
+        Locale l = Locale.getDefault();
+        try {
+            Locale.setDefault(new Locale("tr"));
+            testCaseInsensitiveParameterParsing("units");
+        } finally {
+            Locale.setDefault(l);
+        }
+    }
+
+    @Test
+    public void testParameterParsingUpperCaseTurkish() {
+        Locale l = Locale.getDefault();
+        try {
+            Locale.setDefault(new Locale("tr"));
+            testCaseInsensitiveParameterParsing("UNITS");
+        } finally {
+            Locale.setDefault(l);
+        }
+    }
+
+    private void testCaseInsensitiveParameterParsing(String name) {
+        SizeSelector s = new SizeSelector();
+        Parameter p = new Parameter();
+        p.setName(name);
+        p.setValue("foo");
+        try {
+            s.setParameters(new Parameter[] {p});
+            fail("should have caused an exception");
+        } catch (BuildException be) {
+            assertEquals("foo is not a legal value for this attribute",
+                         be.getMessage());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/selectors/TokenizedPatternTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/TokenizedPatternTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/TokenizedPatternTest.java
index 55f7b03..4e95c2c 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/TokenizedPatternTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/TokenizedPatternTest.java
@@ -1,77 +1,77 @@
-/*
- *  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.types.selectors;
-
-import java.io.File;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-public class TokenizedPatternTest {
-    private static final String DOT_SVN_PATTERN =
-        SelectorUtils.DEEP_TREE_MATCH + File.separator + ".svn"
-        + File.separator + SelectorUtils.DEEP_TREE_MATCH;
-
-    @Test
-    public void testTokenization() {
-        TokenizedPattern pat = new TokenizedPattern(DOT_SVN_PATTERN);
-        assertEquals(3, pat.depth());
-        assertEquals(DOT_SVN_PATTERN, pat.getPattern());
-        assertTrue(pat.containsPattern(SelectorUtils.DEEP_TREE_MATCH));
-        assertTrue(pat.containsPattern(".svn"));
-    }
-
-    @Test
-    public void testEndsWith() {
-        assertTrue(new TokenizedPattern(DOT_SVN_PATTERN)
-                   .endsWith(SelectorUtils.DEEP_TREE_MATCH));
-    }
-
-    @Test
-    public void testWithoutLastToken() {
-        assertEquals(SelectorUtils.DEEP_TREE_MATCH + File.separatorChar
-                     + ".svn" + File.separator,
-                     new TokenizedPattern(DOT_SVN_PATTERN)
-                     .withoutLastToken().getPattern());
-    }
-
-    @Test
-    public void testMatchPath() {
-        File f = new File(".svn");
-        TokenizedPath p = new TokenizedPath(f.getAbsolutePath());
-        assertTrue(new TokenizedPattern(DOT_SVN_PATTERN).matchPath(p, true));
-        assertTrue(new TokenizedPattern(DOT_SVN_PATTERN)
-                   .withoutLastToken().matchPath(p, true));
-    }
-
-    @Test
-    /**
-     * this test illustrates the behavior described in bugzilla 59114
-     * meaning that the pattern "**" matches the empty path
-     * but the pattern "*" does not
-     */
-    public void testEmptyFolderWithStarStar() {
-        TokenizedPath p = TokenizedPath.EMPTY_PATH;
-        assertTrue(new TokenizedPattern(SelectorUtils.DEEP_TREE_MATCH).matchPath(p, true));
-        assertFalse(new TokenizedPattern("*").matchPath(p, true));
-    }
-
-}
+/*
+ *  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.types.selectors;
+
+import java.io.File;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class TokenizedPatternTest {
+    private static final String DOT_SVN_PATTERN =
+        SelectorUtils.DEEP_TREE_MATCH + File.separator + ".svn"
+        + File.separator + SelectorUtils.DEEP_TREE_MATCH;
+
+    @Test
+    public void testTokenization() {
+        TokenizedPattern pat = new TokenizedPattern(DOT_SVN_PATTERN);
+        assertEquals(3, pat.depth());
+        assertEquals(DOT_SVN_PATTERN, pat.getPattern());
+        assertTrue(pat.containsPattern(SelectorUtils.DEEP_TREE_MATCH));
+        assertTrue(pat.containsPattern(".svn"));
+    }
+
+    @Test
+    public void testEndsWith() {
+        assertTrue(new TokenizedPattern(DOT_SVN_PATTERN)
+                   .endsWith(SelectorUtils.DEEP_TREE_MATCH));
+    }
+
+    @Test
+    public void testWithoutLastToken() {
+        assertEquals(SelectorUtils.DEEP_TREE_MATCH + File.separatorChar
+                     + ".svn" + File.separator,
+                     new TokenizedPattern(DOT_SVN_PATTERN)
+                     .withoutLastToken().getPattern());
+    }
+
+    @Test
+    public void testMatchPath() {
+        File f = new File(".svn");
+        TokenizedPath p = new TokenizedPath(f.getAbsolutePath());
+        assertTrue(new TokenizedPattern(DOT_SVN_PATTERN).matchPath(p, true));
+        assertTrue(new TokenizedPattern(DOT_SVN_PATTERN)
+                   .withoutLastToken().matchPath(p, true));
+    }
+
+    @Test
+    /**
+     * this test illustrates the behavior described in bugzilla 59114
+     * meaning that the pattern "**" matches the empty path
+     * but the pattern "*" does not
+     */
+    public void testEmptyFolderWithStarStar() {
+        TokenizedPath p = TokenizedPath.EMPTY_PATH;
+        assertTrue(new TokenizedPattern(SelectorUtils.DEEP_TREE_MATCH).matchPath(p, true));
+        assertFalse(new TokenizedPattern("*").matchPath(p, true));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/selectors/TypeSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/TypeSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/TypeSelectorTest.java
index 777d772..f775f59 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/TypeSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/TypeSelectorTest.java
@@ -1,81 +1,81 @@
-/*
- *  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.types.selectors;
-
-import org.apache.tools.ant.BuildException;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-/**
- * Tests Type Selectors.
- *
- */
-public class TypeSelectorTest {
-
-    @Rule
-    public BaseSelectorRule selectorRule = new BaseSelectorRule();
-
-
-    /**
-     * Test the code that validates the selector.
-     */
-    @Test
-    public void testValidate() {
-        TypeSelector s = new TypeSelector();
-        try {
-            s.isSelected(selectorRule.getProject().getBaseDir(), selectorRule.getFilenames()[0] ,selectorRule.getFiles()[0]);
-            fail("TypeSelector did not check for required fields");
-        } catch (BuildException be1) {
-            assertEquals("The type attribute is required"
-                    , be1.getMessage());
-        }
-    }
-
-    /**
-     * Tests to make sure that the selector is selecting files correctly.
-     */
-    @Test
-    public void testSelectionBehaviour() {
-        TypeSelector s;
-        String results;
-
-        TypeSelector.FileType directory = new TypeSelector.FileType();
-        directory.setValue("dir");
-        TypeSelector.FileType file = new TypeSelector.FileType();
-        file.setValue("file");
-
-    
-
-        s = new TypeSelector();
-        s.setType(directory);
-        results = selectorRule.selectionString(s);
-        assertEquals("TFFFFFFFFFFT", results);
-
-        s = new TypeSelector();
-        s.setType(file);
-        results = selectorRule.selectionString(s);
-        assertEquals("FTTTTTTTTTTF", results);
-
-
-    }
-
-}
+/*
+ *  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.types.selectors;
+
+import org.apache.tools.ant.BuildException;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Tests Type Selectors.
+ *
+ */
+public class TypeSelectorTest {
+
+    @Rule
+    public BaseSelectorRule selectorRule = new BaseSelectorRule();
+
+
+    /**
+     * Test the code that validates the selector.
+     */
+    @Test
+    public void testValidate() {
+        TypeSelector s = new TypeSelector();
+        try {
+            s.isSelected(selectorRule.getProject().getBaseDir(), selectorRule.getFilenames()[0] ,selectorRule.getFiles()[0]);
+            fail("TypeSelector did not check for required fields");
+        } catch (BuildException be1) {
+            assertEquals("The type attribute is required"
+                    , be1.getMessage());
+        }
+    }
+
+    /**
+     * Tests to make sure that the selector is selecting files correctly.
+     */
+    @Test
+    public void testSelectionBehaviour() {
+        TypeSelector s;
+        String results;
+
+        TypeSelector.FileType directory = new TypeSelector.FileType();
+        directory.setValue("dir");
+        TypeSelector.FileType file = new TypeSelector.FileType();
+        file.setValue("file");
+
+
+
+        s = new TypeSelector();
+        s.setType(directory);
+        results = selectorRule.selectionString(s);
+        assertEquals("TFFFFFFFFFFT", results);
+
+        s = new TypeSelector();
+        s.setType(file);
+        results = selectorRule.selectionString(s);
+        assertEquals("FTTTTTTTTTTF", results);
+
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/Base64ConverterTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/Base64ConverterTest.java b/src/tests/junit/org/apache/tools/ant/util/Base64ConverterTest.java
index 22a2739..48a4cbd 100644
--- a/src/tests/junit/org/apache/tools/ant/util/Base64ConverterTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/Base64ConverterTest.java
@@ -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.util;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * TestCase for Base64Converter.
- *
- */
-public class Base64ConverterTest {
-
-    @Test
-    public void testOneValue() {
-        byte[] mybytes = {0, 0, (byte)0xFF};
-        Base64Converter base64Converter = new Base64Converter();
-        assertEquals("AAD/",base64Converter.encode(mybytes));
-    }
-
-    @Test
-    public void testHelloWorld() {
-        byte[] mybytes = "Hello World".getBytes();
-        Base64Converter base64Converter = new Base64Converter();
-        assertEquals("SGVsbG8gV29ybGQ=", base64Converter.encode(mybytes));
-    }
-}
+/*
+ *  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 org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * TestCase for Base64Converter.
+ *
+ */
+public class Base64ConverterTest {
+
+    @Test
+    public void testOneValue() {
+        byte[] mybytes = {0, 0, (byte)0xFF};
+        Base64Converter base64Converter = new Base64Converter();
+        assertEquals("AAD/",base64Converter.encode(mybytes));
+    }
+
+    @Test
+    public void testHelloWorld() {
+        byte[] mybytes = "Hello World".getBytes();
+        Base64Converter base64Converter = new Base64Converter();
+        assertEquals("SGVsbG8gV29ybGQ=", base64Converter.encode(mybytes));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/ClasspathUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/ClasspathUtilsTest.java b/src/tests/junit/org/apache/tools/ant/util/ClasspathUtilsTest.java
index 4399f91..3cffa10 100644
--- a/src/tests/junit/org/apache/tools/ant/util/ClasspathUtilsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/ClasspathUtilsTest.java
@@ -1,67 +1,67 @@
-/*
- *  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.IOException;
-import java.util.Enumeration;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.types.Path;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertTrue;
-
-
-/**
- * Test case for ClasspathUtils
- *
- */
-public class ClasspathUtilsTest {
-
-    private Project p;
-
-    @Before
-    public void setUp() {
-        p = new Project();
-        p.init();
-    }
-
-
-    @Test
-    public void testOnlyOneInstance() {
-        Enumeration enumeration;
-        String list = "";
-        ClassLoader c = ClasspathUtils.getUniqueClassLoaderForPath(p, (Path) null, false);
-        try {
-            enumeration = c.getResources(
-                "org/apache/tools/ant/taskdefs/defaults.properties");
-        } catch (IOException e) {
-            throw new BuildException(
-                "Could not get the defaults.properties resource", e);
-        }
-        int count = 0;
-        while (enumeration.hasMoreElements()) {
-            list = list + " " + enumeration.nextElement();
-            count++;
-        }
-        assertTrue("Should be only one and not " + count + " " + list, count == 1);
-    }
-}
+/*
+ *  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.IOException;
+import java.util.Enumeration;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.Path;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+
+
+/**
+ * Test case for ClasspathUtils
+ *
+ */
+public class ClasspathUtilsTest {
+
+    private Project p;
+
+    @Before
+    public void setUp() {
+        p = new Project();
+        p.init();
+    }
+
+
+    @Test
+    public void testOnlyOneInstance() {
+        Enumeration enumeration;
+        String list = "";
+        ClassLoader c = ClasspathUtils.getUniqueClassLoaderForPath(p, (Path) null, false);
+        try {
+            enumeration = c.getResources(
+                "org/apache/tools/ant/taskdefs/defaults.properties");
+        } catch (IOException e) {
+            throw new BuildException(
+                "Could not get the defaults.properties resource", e);
+        }
+        int count = 0;
+        while (enumeration.hasMoreElements()) {
+            list = list + " " + enumeration.nextElement();
+            count++;
+        }
+        assertTrue("Should be only one and not " + count + " " + list, count == 1);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/CollectionUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/CollectionUtilsTest.java b/src/tests/junit/org/apache/tools/ant/util/CollectionUtilsTest.java
index 5bcbc12..425dc47 100644
--- a/src/tests/junit/org/apache/tools/ant/util/CollectionUtilsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/CollectionUtilsTest.java
@@ -1,102 +1,102 @@
-/*
- *  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.util.Hashtable;
-import java.util.Properties;
-import java.util.Stack;
-import java.util.Vector;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertTrue;
-
-/**
- * Tests for org.apache.tools.ant.util.CollectionUtils.
- *
- */
-public class CollectionUtilsTest {
-
-
-    @Test
-    public void testVectorEquals() {
-        assertTrue(!CollectionUtils.equals(null, new Vector()));
-        assertTrue(!CollectionUtils.equals(new Vector(), null));
-        assertTrue(CollectionUtils.equals(new Vector(), new Vector()));
-        Vector v1 = new Vector();
-        Stack s2 = new Stack();
-        v1.addElement("foo");
-        s2.push("foo");
-        assertTrue(CollectionUtils.equals(v1, s2));
-        assertTrue(CollectionUtils.equals(s2, v1));
-        v1.addElement("bar");
-        assertTrue(!CollectionUtils.equals(v1, s2));
-        assertTrue(!CollectionUtils.equals(s2, v1));
-        s2.push("bar");
-        assertTrue(CollectionUtils.equals(v1, s2));
-        assertTrue(CollectionUtils.equals(s2, v1));
-        s2.push("baz");
-        assertTrue(!CollectionUtils.equals(v1, s2));
-        assertTrue(!CollectionUtils.equals(s2, v1));
-        v1.addElement("baz");
-        assertTrue(CollectionUtils.equals(v1, s2));
-        assertTrue(CollectionUtils.equals(s2, v1));
-        v1.addElement("zyzzy");
-        s2.push("zyzzy2");
-        assertTrue(!CollectionUtils.equals(v1, s2));
-        assertTrue(!CollectionUtils.equals(s2, v1));
-    }
-
-    @Test
-    public void testDictionaryEquals() {
-        assertTrue(!CollectionUtils.equals(null, new Hashtable()));
-        assertTrue(!CollectionUtils.equals(new Hashtable(), null));
-        assertTrue(CollectionUtils.equals(new Hashtable(), new Properties()));
-        Hashtable h1 = new Hashtable();
-        Properties p2 = new Properties();
-        h1.put("foo", "");
-        p2.put("foo", "");
-        assertTrue(CollectionUtils.equals(h1, p2));
-        assertTrue(CollectionUtils.equals(p2, h1));
-        h1.put("bar", "");
-        assertTrue(!CollectionUtils.equals(h1, p2));
-        assertTrue(!CollectionUtils.equals(p2, h1));
-        p2.put("bar", "");
-        assertTrue(CollectionUtils.equals(h1, p2));
-        assertTrue(CollectionUtils.equals(p2, h1));
-        p2.put("baz", "");
-        assertTrue(!CollectionUtils.equals(h1, p2));
-        assertTrue(!CollectionUtils.equals(p2, h1));
-        h1.put("baz", "");
-        assertTrue(CollectionUtils.equals(h1, p2));
-        assertTrue(CollectionUtils.equals(p2, h1));
-        h1.put("zyzzy", "");
-        p2.put("zyzzy2", "");
-        assertTrue(!CollectionUtils.equals(h1, p2));
-        assertTrue(!CollectionUtils.equals(p2, h1));
-        p2.put("zyzzy", "");
-        h1.put("zyzzy2", "");
-        assertTrue(CollectionUtils.equals(h1, p2));
-        assertTrue(CollectionUtils.equals(p2, h1));
-        h1.put("dada", "1");
-        p2.put("dada", "2");
-        assertTrue(!CollectionUtils.equals(h1, p2));
-        assertTrue(!CollectionUtils.equals(p2, h1));
-    }
-}
+/*
+ *  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.util.Hashtable;
+import java.util.Properties;
+import java.util.Stack;
+import java.util.Vector;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Tests for org.apache.tools.ant.util.CollectionUtils.
+ *
+ */
+public class CollectionUtilsTest {
+
+
+    @Test
+    public void testVectorEquals() {
+        assertTrue(!CollectionUtils.equals(null, new Vector()));
+        assertTrue(!CollectionUtils.equals(new Vector(), null));
+        assertTrue(CollectionUtils.equals(new Vector(), new Vector()));
+        Vector v1 = new Vector();
+        Stack s2 = new Stack();
+        v1.addElement("foo");
+        s2.push("foo");
+        assertTrue(CollectionUtils.equals(v1, s2));
+        assertTrue(CollectionUtils.equals(s2, v1));
+        v1.addElement("bar");
+        assertTrue(!CollectionUtils.equals(v1, s2));
+        assertTrue(!CollectionUtils.equals(s2, v1));
+        s2.push("bar");
+        assertTrue(CollectionUtils.equals(v1, s2));
+        assertTrue(CollectionUtils.equals(s2, v1));
+        s2.push("baz");
+        assertTrue(!CollectionUtils.equals(v1, s2));
+        assertTrue(!CollectionUtils.equals(s2, v1));
+        v1.addElement("baz");
+        assertTrue(CollectionUtils.equals(v1, s2));
+        assertTrue(CollectionUtils.equals(s2, v1));
+        v1.addElement("zyzzy");
+        s2.push("zyzzy2");
+        assertTrue(!CollectionUtils.equals(v1, s2));
+        assertTrue(!CollectionUtils.equals(s2, v1));
+    }
+
+    @Test
+    public void testDictionaryEquals() {
+        assertTrue(!CollectionUtils.equals(null, new Hashtable()));
+        assertTrue(!CollectionUtils.equals(new Hashtable(), null));
+        assertTrue(CollectionUtils.equals(new Hashtable(), new Properties()));
+        Hashtable h1 = new Hashtable();
+        Properties p2 = new Properties();
+        h1.put("foo", "");
+        p2.put("foo", "");
+        assertTrue(CollectionUtils.equals(h1, p2));
+        assertTrue(CollectionUtils.equals(p2, h1));
+        h1.put("bar", "");
+        assertTrue(!CollectionUtils.equals(h1, p2));
+        assertTrue(!CollectionUtils.equals(p2, h1));
+        p2.put("bar", "");
+        assertTrue(CollectionUtils.equals(h1, p2));
+        assertTrue(CollectionUtils.equals(p2, h1));
+        p2.put("baz", "");
+        assertTrue(!CollectionUtils.equals(h1, p2));
+        assertTrue(!CollectionUtils.equals(p2, h1));
+        h1.put("baz", "");
+        assertTrue(CollectionUtils.equals(h1, p2));
+        assertTrue(CollectionUtils.equals(p2, h1));
+        h1.put("zyzzy", "");
+        p2.put("zyzzy2", "");
+        assertTrue(!CollectionUtils.equals(h1, p2));
+        assertTrue(!CollectionUtils.equals(p2, h1));
+        p2.put("zyzzy", "");
+        h1.put("zyzzy2", "");
+        assertTrue(CollectionUtils.equals(h1, p2));
+        assertTrue(CollectionUtils.equals(p2, h1));
+        h1.put("dada", "1");
+        p2.put("dada", "2");
+        assertTrue(!CollectionUtils.equals(h1, p2));
+        assertTrue(!CollectionUtils.equals(p2, h1));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/DOMElementWriterTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/DOMElementWriterTest.java b/src/tests/junit/org/apache/tools/ant/util/DOMElementWriterTest.java
index 80a8d6b..fe09ce9 100644
--- a/src/tests/junit/org/apache/tools/ant/util/DOMElementWriterTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/DOMElementWriterTest.java
@@ -1,305 +1,305 @@
-/*
- *  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 org.junit.Test;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import java.io.IOException;
-import java.io.StringWriter;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Tests for org.apache.tools.ant.util.DOMElementWriter.
- *
- */
-public class DOMElementWriterTest {
-
-    private DOMElementWriter w = new DOMElementWriter();
-
-    @Test
-    public void testIsReference() {
-        assertTrue("&#20;", w.isReference("&#20;"));
-        assertTrue("&#x20;", w.isReference("&#x20;"));
-        assertTrue("&#xA0;", w.isReference("&#xA0;"));
-        assertTrue("&#A0;", !w.isReference("&#A0;"));
-        assertTrue("20;", !w.isReference("20;"));
-        assertTrue("&#20", !w.isReference("&#20"));
-        assertTrue("&quot;", w.isReference("&quot;"));
-        assertTrue("&apos;", w.isReference("&apos;"));
-        assertTrue("&gt;", w.isReference("&gt;"));
-        assertTrue("&lt;", w.isReference("&lt;"));
-        assertTrue("&amp;", w.isReference("&amp;"));
-    }
-
-    @Test
-    public void testEncode() {
-        assertEquals("&amp;#20;", w.encode("&#20;"));
-        assertEquals("&amp;#x20;", w.encode("&#x20;"));
-        assertEquals("&amp;#xA0;", w.encode("&#xA0;"));
-        assertEquals("&amp;#A0;", w.encode("&#A0;"));
-        assertEquals("20;", w.encode("20;"));
-        assertEquals("&amp;#20", w.encode("&#20"));
-        assertEquals("&amp;quot;", w.encode("&quot;"));
-        assertEquals("&amp;apos;", w.encode("&apos;"));
-        assertEquals("&amp;gt;", w.encode("&gt;"));
-        assertEquals("&amp;lt;", w.encode("&lt;"));
-        assertEquals("&amp;amp;", w.encode("&amp;"));
-        assertEquals("&quot;", w.encode("\""));
-        assertEquals("&lt;", w.encode("<"));
-        assertEquals("&amp;", w.encode("&"));
-        assertEquals("", w.encode("\u0017"));
-        assertEquals("\r\n\t", w.encode("\r\n\t"));
-    }
-
-    @Test
-    public void testEncodeAttributeValue() {
-        assertEquals("&amp;#20;", w.encodeAttributeValue("&#20;"));
-        assertEquals("&amp;#x20;", w.encodeAttributeValue("&#x20;"));
-        assertEquals("&amp;#xA0;", w.encodeAttributeValue("&#xA0;"));
-        assertEquals("&amp;#A0;", w.encodeAttributeValue("&#A0;"));
-        assertEquals("20;", w.encodeAttributeValue("20;"));
-        assertEquals("&amp;#20", w.encodeAttributeValue("&#20"));
-        assertEquals("&amp;quot;", w.encodeAttributeValue("&quot;"));
-        assertEquals("&amp;apos;", w.encodeAttributeValue("&apos;"));
-        assertEquals("&amp;gt;", w.encodeAttributeValue("&gt;"));
-        assertEquals("&amp;lt;", w.encodeAttributeValue("&lt;"));
-        assertEquals("&amp;amp;", w.encodeAttributeValue("&amp;"));
-        assertEquals("&quot;", w.encodeAttributeValue("\""));
-        assertEquals("&lt;", w.encodeAttributeValue("<"));
-        assertEquals("&amp;", w.encodeAttributeValue("&"));
-        assertEquals("", w.encodeAttributeValue("\u0017"));
-        assertEquals("&#xd;&#xa;&#x9;", w.encodeAttributeValue("\r\n\t"));
-    }
-
-    @Test
-    public void testAttributeWithWhitespace() throws IOException {
-        Document d = DOMUtils.newDocument();
-        Element root = d.createElement("root");
-        root.setAttribute("foo", "bar\nbaz");
-        StringWriter sw = new StringWriter();
-        DOMElementWriter w = new DOMElementWriter();
-        w.write(root, sw, 0, "  ");
-        assertEquals("<root foo=\"bar&#xa;baz\" />" + StringUtils.LINE_SEP,
-                     sw.toString());
-    }
-
-    @Test
-    public void testEncodeData() {
-        assertEquals("&#20;\"20;&", w.encodedata("&#20;\"20;&"));
-        assertEquals("", w.encodedata("\u0017"));
-    }
-
-    @Test
-    public void testIsLegalCharacter() {
-        assertTrue("0x00", !w.isLegalCharacter('\u0000'));
-        assertTrue("0x09", w.isLegalCharacter('\t'));
-        assertTrue("0x0A", w.isLegalCharacter('\n'));
-        assertTrue("0x0C", w.isLegalCharacter('\r'));
-        assertTrue("0x1F", !w.isLegalCharacter('\u001F'));
-        assertTrue("0x20", w.isLegalCharacter('\u0020'));
-        assertTrue("0xD7FF", w.isLegalCharacter('\uD7FF'));
-        assertTrue("0xD800", !w.isLegalCharacter('\uD800'));
-        assertTrue("0xDFFF", !w.isLegalCharacter('\uDFFF'));
-        assertTrue("0xE000", w.isLegalCharacter('\uE000'));
-        assertTrue("0xFFFD", w.isLegalCharacter('\uFFFD'));
-        assertTrue("0xFFFE", !w.isLegalCharacter('\uFFFE'));
-    }
-
-    @Test
-    public void testCDATAEndEncoding() {
-        assertEquals("]>", w.encodedata("]>"));
-        assertEquals("]]", w.encodedata("]]"));
-        assertEquals("]]]]><![CDATA[>", w.encodedata("]]>"));
-        assertEquals("]]]]><![CDATA[>A", w.encodedata("]]>A"));
-        assertEquals("A]]]]><![CDATA[>", w.encodedata("A]]>"));
-        assertEquals("A]]]]><![CDATA[>A", w.encodedata("A]]>A"));
-        assertEquals("A]]]]><![CDATA[>B]]]]><![CDATA[>C",
-                     w.encodedata("A]]>B]]>C"));
-    }
-
-    @Test
-    public void testNoAdditionalWhiteSpaceForText() throws IOException {
-        Document d = DOMUtils.newDocument();
-        Element root = d.createElement("root");
-        DOMUtils.appendTextElement(root, "textElement", "content");
-
-        StringWriter sw = new StringWriter();
-        DOMElementWriter w = new DOMElementWriter();
-        w.write(root, sw, 0, "  ");
-        assertEquals("<root>" + StringUtils.LINE_SEP
-                     + "  <textElement>content</textElement>"
-                     + StringUtils.LINE_SEP
-                     + "</root>" + StringUtils.LINE_SEP,
-                     sw.toString());
-    }
-
-    @Test
-    public void testNoAdditionalWhiteSpaceForCDATA() throws IOException {
-        Document d = DOMUtils.newDocument();
-        Element root = d.createElement("root");
-        DOMUtils.appendCDATAElement(root, "cdataElement", "content");
-
-        StringWriter sw = new StringWriter();
-        DOMElementWriter w = new DOMElementWriter();
-        w.write(root, sw, 0, "  ");
-        assertEquals("<root>" + StringUtils.LINE_SEP
-                     + "  <cdataElement><![CDATA[content]]></cdataElement>"
-                     + StringUtils.LINE_SEP
-                     + "</root>" + StringUtils.LINE_SEP,
-                     sw.toString());
-    }
-
-    @Test
-    public void testNoAdditionalWhiteSpaceForEmptyElement() throws IOException {
-        Document d = DOMUtils.newDocument();
-        Element root = d.createElement("root");
-        DOMUtils.createChildElement(root, "emptyElement");
-
-        StringWriter sw = new StringWriter();
-        DOMElementWriter w = new DOMElementWriter();
-        w.write(root, sw, 0, "  ");
-        assertEquals("<root>" + StringUtils.LINE_SEP
-                     //                     + "  <emptyElement></emptyElement>"
-                     + "  <emptyElement />"
-                     + StringUtils.LINE_SEP
-                     + "</root>" + StringUtils.LINE_SEP,
-                     sw.toString());
-    }
-
-    @Test
-    public void testNoNSPrefixByDefault() throws IOException {
-        Document d = DOMUtils.newDocument();
-        Element root = d.createElementNS("urn:foo", "root");
-        root.setAttributeNS("urn:foo2", "bar", "baz");
-
-        StringWriter sw = new StringWriter();
-        DOMElementWriter w = new DOMElementWriter();
-        w.write(root, sw, 0, "  ");
-        assertEquals("<root bar=\"baz\" />"
-                     + StringUtils.LINE_SEP, sw.toString());
-    }
-
-    @Test
-    public void testNSOnElement() throws IOException {
-        Document d = DOMUtils.newDocument();
-        Element root = d.createElementNS("urn:foo", "root");
-        root.setAttributeNS("urn:foo2", "bar", "baz");
-
-        StringWriter sw = new StringWriter();
-        DOMElementWriter w =
-            new DOMElementWriter(false,
-                                 DOMElementWriter.XmlNamespacePolicy
-                                 .ONLY_QUALIFY_ELEMENTS);
-        w.write(root, sw, 0, "  ");
-        assertEquals("<root bar=\"baz\" xmlns=\"urn:foo\" />"
-                     + StringUtils.LINE_SEP, sw.toString());
-    }
-
-    @Test
-    public void testNSPrefixOnAttribute() throws IOException {
-        Document d = DOMUtils.newDocument();
-        Element root = d.createElementNS("urn:foo", "root");
-        root.setAttributeNS("urn:foo2", "bar", "baz");
-
-        StringWriter sw = new StringWriter();
-        DOMElementWriter w =
-            new DOMElementWriter(false,
-                                 DOMElementWriter.XmlNamespacePolicy
-                                 .QUALIFY_ALL);
-        w.write(root, sw, 0, "  ");
-        assertEquals("<root ns0:bar=\"baz\" xmlns=\"urn:foo\""
-                     + " xmlns:ns0=\"urn:foo2\" />"
-                     + StringUtils.LINE_SEP, sw.toString());
-    }
-
-    @Test
-    public void testNSPrefixOnAttributeEvenWithoutElement() throws IOException {
-        Document d = DOMUtils.newDocument();
-        Element root = d.createElementNS("urn:foo", "root");
-        root.setAttributeNS("urn:foo2", "bar", "baz");
-
-        StringWriter sw = new StringWriter();
-        DOMElementWriter w =
-            new DOMElementWriter(false,
-                                 new DOMElementWriter.XmlNamespacePolicy(false,
-                                                                         true)
-                                 );
-        w.write(root, sw, 0, "  ");
-        assertEquals("<root ns0:bar=\"baz\" xmlns:ns0=\"urn:foo2\" />"
-                     + StringUtils.LINE_SEP, sw.toString());
-    }
-
-    @Test
-    public void testNSGetsReused() throws IOException {
-        Document d = DOMUtils.newDocument();
-        Element root = d.createElementNS("urn:foo", "root");
-        Element child = d.createElementNS("urn:foo", "child");
-        root.appendChild(child);
-        StringWriter sw = new StringWriter();
-        DOMElementWriter w =
-            new DOMElementWriter(false,
-                                 DOMElementWriter.XmlNamespacePolicy
-                                 .ONLY_QUALIFY_ELEMENTS);
-        w.write(root, sw, 0, "  ");
-        assertEquals("<root xmlns=\"urn:foo\">"
-                     + StringUtils.LINE_SEP
-                     + "  <child />"
-                     + StringUtils.LINE_SEP
-                     + "</root>"
-                     + StringUtils.LINE_SEP, sw.toString());
-    }
-
-    @Test
-    public void testNSGoesOutOfScope() throws IOException {
-        Document d = DOMUtils.newDocument();
-        Element root = d.createElementNS("urn:foo", "root");
-        Element child = d.createElementNS("urn:foo2", "child");
-        root.appendChild(child);
-        Element child2 = d.createElementNS("urn:foo2", "child");
-        root.appendChild(child2);
-        Element grandChild = d.createElementNS("urn:foo2", "grandchild");
-        child2.appendChild(grandChild);
-        Element child3 = d.createElementNS("urn:foo2", "child");
-        root.appendChild(child3);
-        StringWriter sw = new StringWriter();
-        DOMElementWriter w =
-            new DOMElementWriter(false,
-                                 DOMElementWriter.XmlNamespacePolicy
-                                 .ONLY_QUALIFY_ELEMENTS);
-        w.write(root, sw, 0, "  ");
-        assertEquals("<root xmlns=\"urn:foo\">"
-                     + StringUtils.LINE_SEP
-                     + "  <ns0:child xmlns:ns0=\"urn:foo2\" />"
-                     + StringUtils.LINE_SEP
-                     + "  <ns1:child xmlns:ns1=\"urn:foo2\">"
-                     + StringUtils.LINE_SEP
-                     + "    <ns1:grandchild />"
-                     + StringUtils.LINE_SEP
-                     + "  </ns1:child>"
-                     + StringUtils.LINE_SEP
-                     + "  <ns2:child xmlns:ns2=\"urn:foo2\" />"
-                     + StringUtils.LINE_SEP
-                      + "</root>"
-                     + StringUtils.LINE_SEP, sw.toString());
-    }
-}
+/*
+ *  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 org.junit.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import java.io.IOException;
+import java.io.StringWriter;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Tests for org.apache.tools.ant.util.DOMElementWriter.
+ *
+ */
+public class DOMElementWriterTest {
+
+    private DOMElementWriter w = new DOMElementWriter();
+
+    @Test
+    public void testIsReference() {
+        assertTrue("&#20;", w.isReference("&#20;"));
+        assertTrue("&#x20;", w.isReference("&#x20;"));
+        assertTrue("&#xA0;", w.isReference("&#xA0;"));
+        assertTrue("&#A0;", !w.isReference("&#A0;"));
+        assertTrue("20;", !w.isReference("20;"));
+        assertTrue("&#20", !w.isReference("&#20"));
+        assertTrue("&quot;", w.isReference("&quot;"));
+        assertTrue("&apos;", w.isReference("&apos;"));
+        assertTrue("&gt;", w.isReference("&gt;"));
+        assertTrue("&lt;", w.isReference("&lt;"));
+        assertTrue("&amp;", w.isReference("&amp;"));
+    }
+
+    @Test
+    public void testEncode() {
+        assertEquals("&amp;#20;", w.encode("&#20;"));
+        assertEquals("&amp;#x20;", w.encode("&#x20;"));
+        assertEquals("&amp;#xA0;", w.encode("&#xA0;"));
+        assertEquals("&amp;#A0;", w.encode("&#A0;"));
+        assertEquals("20;", w.encode("20;"));
+        assertEquals("&amp;#20", w.encode("&#20"));
+        assertEquals("&amp;quot;", w.encode("&quot;"));
+        assertEquals("&amp;apos;", w.encode("&apos;"));
+        assertEquals("&amp;gt;", w.encode("&gt;"));
+        assertEquals("&amp;lt;", w.encode("&lt;"));
+        assertEquals("&amp;amp;", w.encode("&amp;"));
+        assertEquals("&quot;", w.encode("\""));
+        assertEquals("&lt;", w.encode("<"));
+        assertEquals("&amp;", w.encode("&"));
+        assertEquals("", w.encode("\u0017"));
+        assertEquals("\r\n\t", w.encode("\r\n\t"));
+    }
+
+    @Test
+    public void testEncodeAttributeValue() {
+        assertEquals("&amp;#20;", w.encodeAttributeValue("&#20;"));
+        assertEquals("&amp;#x20;", w.encodeAttributeValue("&#x20;"));
+        assertEquals("&amp;#xA0;", w.encodeAttributeValue("&#xA0;"));
+        assertEquals("&amp;#A0;", w.encodeAttributeValue("&#A0;"));
+        assertEquals("20;", w.encodeAttributeValue("20;"));
+        assertEquals("&amp;#20", w.encodeAttributeValue("&#20"));
+        assertEquals("&amp;quot;", w.encodeAttributeValue("&quot;"));
+        assertEquals("&amp;apos;", w.encodeAttributeValue("&apos;"));
+        assertEquals("&amp;gt;", w.encodeAttributeValue("&gt;"));
+        assertEquals("&amp;lt;", w.encodeAttributeValue("&lt;"));
+        assertEquals("&amp;amp;", w.encodeAttributeValue("&amp;"));
+        assertEquals("&quot;", w.encodeAttributeValue("\""));
+        assertEquals("&lt;", w.encodeAttributeValue("<"));
+        assertEquals("&amp;", w.encodeAttributeValue("&"));
+        assertEquals("", w.encodeAttributeValue("\u0017"));
+        assertEquals("&#xd;&#xa;&#x9;", w.encodeAttributeValue("\r\n\t"));
+    }
+
+    @Test
+    public void testAttributeWithWhitespace() throws IOException {
+        Document d = DOMUtils.newDocument();
+        Element root = d.createElement("root");
+        root.setAttribute("foo", "bar\nbaz");
+        StringWriter sw = new StringWriter();
+        DOMElementWriter w = new DOMElementWriter();
+        w.write(root, sw, 0, "  ");
+        assertEquals("<root foo=\"bar&#xa;baz\" />" + StringUtils.LINE_SEP,
+                     sw.toString());
+    }
+
+    @Test
+    public void testEncodeData() {
+        assertEquals("&#20;\"20;&", w.encodedata("&#20;\"20;&"));
+        assertEquals("", w.encodedata("\u0017"));
+    }
+
+    @Test
+    public void testIsLegalCharacter() {
+        assertTrue("0x00", !w.isLegalCharacter('\u0000'));
+        assertTrue("0x09", w.isLegalCharacter('\t'));
+        assertTrue("0x0A", w.isLegalCharacter('\n'));
+        assertTrue("0x0C", w.isLegalCharacter('\r'));
+        assertTrue("0x1F", !w.isLegalCharacter('\u001F'));
+        assertTrue("0x20", w.isLegalCharacter('\u0020'));
+        assertTrue("0xD7FF", w.isLegalCharacter('\uD7FF'));
+        assertTrue("0xD800", !w.isLegalCharacter('\uD800'));
+        assertTrue("0xDFFF", !w.isLegalCharacter('\uDFFF'));
+        assertTrue("0xE000", w.isLegalCharacter('\uE000'));
+        assertTrue("0xFFFD", w.isLegalCharacter('\uFFFD'));
+        assertTrue("0xFFFE", !w.isLegalCharacter('\uFFFE'));
+    }
+
+    @Test
+    public void testCDATAEndEncoding() {
+        assertEquals("]>", w.encodedata("]>"));
+        assertEquals("]]", w.encodedata("]]"));
+        assertEquals("]]]]><![CDATA[>", w.encodedata("]]>"));
+        assertEquals("]]]]><![CDATA[>A", w.encodedata("]]>A"));
+        assertEquals("A]]]]><![CDATA[>", w.encodedata("A]]>"));
+        assertEquals("A]]]]><![CDATA[>A", w.encodedata("A]]>A"));
+        assertEquals("A]]]]><![CDATA[>B]]]]><![CDATA[>C",
+                     w.encodedata("A]]>B]]>C"));
+    }
+
+    @Test
+    public void testNoAdditionalWhiteSpaceForText() throws IOException {
+        Document d = DOMUtils.newDocument();
+        Element root = d.createElement("root");
+        DOMUtils.appendTextElement(root, "textElement", "content");
+
+        StringWriter sw = new StringWriter();
+        DOMElementWriter w = new DOMElementWriter();
+        w.write(root, sw, 0, "  ");
+        assertEquals("<root>" + StringUtils.LINE_SEP
+                     + "  <textElement>content</textElement>"
+                     + StringUtils.LINE_SEP
+                     + "</root>" + StringUtils.LINE_SEP,
+                     sw.toString());
+    }
+
+    @Test
+    public void testNoAdditionalWhiteSpaceForCDATA() throws IOException {
+        Document d = DOMUtils.newDocument();
+        Element root = d.createElement("root");
+        DOMUtils.appendCDATAElement(root, "cdataElement", "content");
+
+        StringWriter sw = new StringWriter();
+        DOMElementWriter w = new DOMElementWriter();
+        w.write(root, sw, 0, "  ");
+        assertEquals("<root>" + StringUtils.LINE_SEP
+                     + "  <cdataElement><![CDATA[content]]></cdataElement>"
+                     + StringUtils.LINE_SEP
+                     + "</root>" + StringUtils.LINE_SEP,
+                     sw.toString());
+    }
+
+    @Test
+    public void testNoAdditionalWhiteSpaceForEmptyElement() throws IOException {
+        Document d = DOMUtils.newDocument();
+        Element root = d.createElement("root");
+        DOMUtils.createChildElement(root, "emptyElement");
+
+        StringWriter sw = new StringWriter();
+        DOMElementWriter w = new DOMElementWriter();
+        w.write(root, sw, 0, "  ");
+        assertEquals("<root>" + StringUtils.LINE_SEP
+                     //                     + "  <emptyElement></emptyElement>"
+                     + "  <emptyElement />"
+                     + StringUtils.LINE_SEP
+                     + "</root>" + StringUtils.LINE_SEP,
+                     sw.toString());
+    }
+
+    @Test
+    public void testNoNSPrefixByDefault() throws IOException {
+        Document d = DOMUtils.newDocument();
+        Element root = d.createElementNS("urn:foo", "root");
+        root.setAttributeNS("urn:foo2", "bar", "baz");
+
+        StringWriter sw = new StringWriter();
+        DOMElementWriter w = new DOMElementWriter();
+        w.write(root, sw, 0, "  ");
+        assertEquals("<root bar=\"baz\" />"
+                     + StringUtils.LINE_SEP, sw.toString());
+    }
+
+    @Test
+    public void testNSOnElement() throws IOException {
+        Document d = DOMUtils.newDocument();
+        Element root = d.createElementNS("urn:foo", "root");
+        root.setAttributeNS("urn:foo2", "bar", "baz");
+
+        StringWriter sw = new StringWriter();
+        DOMElementWriter w =
+            new DOMElementWriter(false,
+                                 DOMElementWriter.XmlNamespacePolicy
+                                 .ONLY_QUALIFY_ELEMENTS);
+        w.write(root, sw, 0, "  ");
+        assertEquals("<root bar=\"baz\" xmlns=\"urn:foo\" />"
+                     + StringUtils.LINE_SEP, sw.toString());
+    }
+
+    @Test
+    public void testNSPrefixOnAttribute() throws IOException {
+        Document d = DOMUtils.newDocument();
+        Element root = d.createElementNS("urn:foo", "root");
+        root.setAttributeNS("urn:foo2", "bar", "baz");
+
+        StringWriter sw = new StringWriter();
+        DOMElementWriter w =
+            new DOMElementWriter(false,
+                                 DOMElementWriter.XmlNamespacePolicy
+                                 .QUALIFY_ALL);
+        w.write(root, sw, 0, "  ");
+        assertEquals("<root ns0:bar=\"baz\" xmlns=\"urn:foo\""
+                     + " xmlns:ns0=\"urn:foo2\" />"
+                     + StringUtils.LINE_SEP, sw.toString());
+    }
+
+    @Test
+    public void testNSPrefixOnAttributeEvenWithoutElement() throws IOException {
+        Document d = DOMUtils.newDocument();
+        Element root = d.createElementNS("urn:foo", "root");
+        root.setAttributeNS("urn:foo2", "bar", "baz");
+
+        StringWriter sw = new StringWriter();
+        DOMElementWriter w =
+            new DOMElementWriter(false,
+                                 new DOMElementWriter.XmlNamespacePolicy(false,
+                                                                         true)
+                                 );
+        w.write(root, sw, 0, "  ");
+        assertEquals("<root ns0:bar=\"baz\" xmlns:ns0=\"urn:foo2\" />"
+                     + StringUtils.LINE_SEP, sw.toString());
+    }
+
+    @Test
+    public void testNSGetsReused() throws IOException {
+        Document d = DOMUtils.newDocument();
+        Element root = d.createElementNS("urn:foo", "root");
+        Element child = d.createElementNS("urn:foo", "child");
+        root.appendChild(child);
+        StringWriter sw = new StringWriter();
+        DOMElementWriter w =
+            new DOMElementWriter(false,
+                                 DOMElementWriter.XmlNamespacePolicy
+                                 .ONLY_QUALIFY_ELEMENTS);
+        w.write(root, sw, 0, "  ");
+        assertEquals("<root xmlns=\"urn:foo\">"
+                     + StringUtils.LINE_SEP
+                     + "  <child />"
+                     + StringUtils.LINE_SEP
+                     + "</root>"
+                     + StringUtils.LINE_SEP, sw.toString());
+    }
+
+    @Test
+    public void testNSGoesOutOfScope() throws IOException {
+        Document d = DOMUtils.newDocument();
+        Element root = d.createElementNS("urn:foo", "root");
+        Element child = d.createElementNS("urn:foo2", "child");
+        root.appendChild(child);
+        Element child2 = d.createElementNS("urn:foo2", "child");
+        root.appendChild(child2);
+        Element grandChild = d.createElementNS("urn:foo2", "grandchild");
+        child2.appendChild(grandChild);
+        Element child3 = d.createElementNS("urn:foo2", "child");
+        root.appendChild(child3);
+        StringWriter sw = new StringWriter();
+        DOMElementWriter w =
+            new DOMElementWriter(false,
+                                 DOMElementWriter.XmlNamespacePolicy
+                                 .ONLY_QUALIFY_ELEMENTS);
+        w.write(root, sw, 0, "  ");
+        assertEquals("<root xmlns=\"urn:foo\">"
+                     + StringUtils.LINE_SEP
+                     + "  <ns0:child xmlns:ns0=\"urn:foo2\" />"
+                     + StringUtils.LINE_SEP
+                     + "  <ns1:child xmlns:ns1=\"urn:foo2\">"
+                     + StringUtils.LINE_SEP
+                     + "    <ns1:grandchild />"
+                     + StringUtils.LINE_SEP
+                     + "  </ns1:child>"
+                     + StringUtils.LINE_SEP
+                     + "  <ns2:child xmlns:ns2=\"urn:foo2\" />"
+                     + StringUtils.LINE_SEP
+                      + "</root>"
+                     + StringUtils.LINE_SEP, sw.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/DeweyDecimalTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/DeweyDecimalTest.java b/src/tests/junit/org/apache/tools/ant/util/DeweyDecimalTest.java
index 2e27cde..bcda609 100644
--- a/src/tests/junit/org/apache/tools/ant/util/DeweyDecimalTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/DeweyDecimalTest.java
@@ -1,70 +1,70 @@
-/*
- *  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 static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-
-@SuppressWarnings("ResultOfObjectAllocationIgnored")
-public class DeweyDecimalTest {
-
-    @Test public void parse() {
-        assertEquals("1.2.3", new DeweyDecimal("1.2.3").toString());
-    }
-
-    @Test(expected=NumberFormatException.class) public void misparseEmpty() {
-        new DeweyDecimal("1..2");
-    }
-
-    @Test(expected=NumberFormatException.class) public void misparseNonNumeric() {
-        new DeweyDecimal("1.2.3-beta-5");
-    }
-
-    @Test(expected=NumberFormatException.class) public void misparseFinalDot() {
-        new DeweyDecimal("1.2.");
-    }
-
-    // TODO initial dots, empty string, null, negative numbers, ...
-
-    @Test public void testHashCode() {
-        assertEquals(new DeweyDecimal("1.2.3").hashCode(), new DeweyDecimal("1.2.3").hashCode());
-    }
-
-    @Test public void testEquals() {
-        assertTrue(new DeweyDecimal("1.2.3").equals(new DeweyDecimal("1.2.3")));
-        assertFalse(new DeweyDecimal("1.2.3").equals(new DeweyDecimal("1.2.4")));
-        assertTrue(new DeweyDecimal("1.2.0").equals(new DeweyDecimal("1.2")));
-        assertTrue(new DeweyDecimal("1.2").equals(new DeweyDecimal("1.2.0")));
-    }
-
-    @Test public void compareTo() {
-        assertTrue(new DeweyDecimal("1.2.3").compareTo(new DeweyDecimal("1.2")) > 0);
-        assertTrue(new DeweyDecimal("1.2").compareTo(new DeweyDecimal("1.2.3")) < 0);
-        assertTrue(new DeweyDecimal("1.2.3").compareTo(new DeweyDecimal("1.2.3")) == 0);
-        assertTrue(new DeweyDecimal("1.2.3").compareTo(new DeweyDecimal("1.1.4")) > 0);
-        assertTrue(new DeweyDecimal("1.2.3").compareTo(new DeweyDecimal("1.2.2.9")) > 0);
-        assertTrue(new DeweyDecimal("1.2.0").compareTo(new DeweyDecimal("1.2")) == 0);
-        assertTrue(new DeweyDecimal("1.2").compareTo(new DeweyDecimal("1.2.0")) == 0);
-    }
-
-    // TODO isGreaterThan, ...
-
-}
+/*
+ *  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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import org.junit.Test;
+
+@SuppressWarnings("ResultOfObjectAllocationIgnored")
+public class DeweyDecimalTest {
+
+    @Test public void parse() {
+        assertEquals("1.2.3", new DeweyDecimal("1.2.3").toString());
+    }
+
+    @Test(expected=NumberFormatException.class) public void misparseEmpty() {
+        new DeweyDecimal("1..2");
+    }
+
+    @Test(expected=NumberFormatException.class) public void misparseNonNumeric() {
+        new DeweyDecimal("1.2.3-beta-5");
+    }
+
+    @Test(expected=NumberFormatException.class) public void misparseFinalDot() {
+        new DeweyDecimal("1.2.");
+    }
+
+    // TODO initial dots, empty string, null, negative numbers, ...
+
+    @Test public void testHashCode() {
+        assertEquals(new DeweyDecimal("1.2.3").hashCode(), new DeweyDecimal("1.2.3").hashCode());
+    }
+
+    @Test public void testEquals() {
+        assertTrue(new DeweyDecimal("1.2.3").equals(new DeweyDecimal("1.2.3")));
+        assertFalse(new DeweyDecimal("1.2.3").equals(new DeweyDecimal("1.2.4")));
+        assertTrue(new DeweyDecimal("1.2.0").equals(new DeweyDecimal("1.2")));
+        assertTrue(new DeweyDecimal("1.2").equals(new DeweyDecimal("1.2.0")));
+    }
+
+    @Test public void compareTo() {
+        assertTrue(new DeweyDecimal("1.2.3").compareTo(new DeweyDecimal("1.2")) > 0);
+        assertTrue(new DeweyDecimal("1.2").compareTo(new DeweyDecimal("1.2.3")) < 0);
+        assertTrue(new DeweyDecimal("1.2.3").compareTo(new DeweyDecimal("1.2.3")) == 0);
+        assertTrue(new DeweyDecimal("1.2.3").compareTo(new DeweyDecimal("1.1.4")) > 0);
+        assertTrue(new DeweyDecimal("1.2.3").compareTo(new DeweyDecimal("1.2.2.9")) > 0);
+        assertTrue(new DeweyDecimal("1.2.0").compareTo(new DeweyDecimal("1.2")) == 0);
+        assertTrue(new DeweyDecimal("1.2").compareTo(new DeweyDecimal("1.2.0")) == 0);
+    }
+
+    // TODO isGreaterThan, ...
+
+}


[17/21] ant git commit: Normalise tabulation and line breaks

Posted by gi...@apache.org.
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitClassLoaderTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitClassLoaderTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitClassLoaderTest.java
index 0c303c1..4baf741 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitClassLoaderTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitClassLoaderTest.java
@@ -1,37 +1,37 @@
-/*
- *  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 static org.junit.Assert.assertSame;
-
-import org.junit.Test;
-
-/**
- * Test to ensure that the classloader loading JUnit testcase
- * is also the context classloader.
- *
- */
-public class JUnitClassLoaderTest {
-
-    @Test
-    public void testContextClassLoader(){
-        ClassLoader context = Thread.currentThread().getContextClassLoader();
-        ClassLoader caller = getClass().getClassLoader();
-        assertSame(context, caller);
-    }
-}
+/*
+ *  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 static org.junit.Assert.assertSame;
+
+import org.junit.Test;
+
+/**
+ * Test to ensure that the classloader loading JUnit testcase
+ * is also the context classloader.
+ *
+ */
+public class JUnitClassLoaderTest {
+
+    @Test
+    public void testContextClassLoader(){
+        ClassLoader context = Thread.currentThread().getContextClassLoader();
+        ClassLoader caller = getClass().getClassLoader();
+        assertSame(context, caller);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java
index db2172e..c393005 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java
@@ -63,39 +63,39 @@ import org.w3c.dom.Node;
 
 public class JUnitTaskTest {
 
-	@Rule
-	public BuildFileRule buildRule = new BuildFileRule();
-	
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
     /**
      * The JUnit setup method.
      */
-	@Before
+    @Before
     public void setUp() {
         buildRule.configureProject("src/etc/testcases/taskdefs/optional/junit.xml");
     }
 
-	@Test
+    @Test
     public void testCrash() {
-    	buildRule.executeTarget("crash");
-    	assertEquals("true", buildRule.getProject().getProperty("crashed"));
+        buildRule.executeTarget("crash");
+        assertEquals("true", buildRule.getProject().getProperty("crashed"));
     }
 
-	@Test
+    @Test
     public void testNoCrash() {
-    	buildRule.executeTarget("nocrash");
-    	assertNull(buildRule.getProject().getProperty("crashed"));
+        buildRule.executeTarget("nocrash");
+        assertNull(buildRule.getProject().getProperty("crashed"));
     }
 
-	@Test
+    @Test
     public void testTimeout() {
-    	buildRule.executeTarget("timeout");
-    	assertEquals("true", buildRule.getProject().getProperty("timeout"));
+        buildRule.executeTarget("timeout");
+        assertEquals("true", buildRule.getProject().getProperty("timeout"));
     }
 
     @Test
     public void testNoTimeout() {
        buildRule.executeTarget("notimeout");
-   	   assertNull(buildRule.getProject().getProperty("timeout"));
+       assertNull(buildRule.getProject().getProperty("timeout"));
     }
 
     @Test
@@ -141,7 +141,7 @@ public class JUnitTaskTest {
     public void testFailureRecorder() {
         if (JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_1_5)) {
             try {
-            	Class<?> clazz =Class.forName("junit.framework.JUnit4TestAdapter");
+                Class<?> clazz =Class.forName("junit.framework.JUnit4TestAdapter");
                 Assume.assumeFalse("Skipping test since it fails with JUnit 4", clazz != null);
             } catch (ClassNotFoundException e) {
                 // OK, this is JUnit3, can run test
@@ -154,14 +154,14 @@ public class JUnitTaskTest {
 
         // ensure that there is a clean test environment
         assertFalse("Test directory '" + testDir.getAbsolutePath()
-                    + "' must not exist before the test preparation.", 
+                    + "' must not exist before the test preparation.",
                     testDir.exists());
         assertFalse("The collector file '"
                     + collectorFile.getAbsolutePath()
-                    + "'must not exist before the test preparation.", 
+                    + "'must not exist before the test preparation.",
                     collectorFile.exists());
 
-    
+
         // prepare the test environment
         buildRule.executeTarget("failureRecorder.prepare");
         assertTrue("Test directory '" + testDir.getAbsolutePath()
@@ -169,14 +169,14 @@ public class JUnitTaskTest {
         assertTrue("There should be one class.",
                    (new File(testDir, "A.class")).exists());
         assertFalse("The collector file '"
-                    + collectorFile.getAbsolutePath() 
+                    + collectorFile.getAbsolutePath()
                     + "' should not exist before the 1st run.",
                     collectorFile.exists());
-    
-    
+
+
         // 1st junit run: should do all tests - failing and not failing tests
         buildRule.executeTarget("failureRecorder.runtest");
-        assertTrue("The collector file '" + collectorFile.getAbsolutePath() 
+        assertTrue("The collector file '" + collectorFile.getAbsolutePath()
                    + "' should exist after the 1st run.",
                    collectorFile.exists());
         // the passing test cases
@@ -202,10 +202,10 @@ public class JUnitTaskTest {
         buildRule.executeTarget("D.test10");
         assertContains("1st run: should run D.test10", buildRule.getOutput());
 
-    
+
         // 2nd junit run: should do only failing tests
         buildRule.executeTarget("failureRecorder.runtest");
-        assertTrue("The collector file '" + collectorFile.getAbsolutePath() 
+        assertTrue("The collector file '" + collectorFile.getAbsolutePath()
                    + "' should exist after the 2nd run.",
                    collectorFile.exists());
         // the passing test cases
@@ -230,14 +230,14 @@ public class JUnitTaskTest {
         assertContains("2nd run: should run B.test04", buildRule.getOutput());
         buildRule.executeTarget("D.test10");
         assertContains("2nd run: should run D.test10", buildRule.getOutput());
-    
-    
+
+
         // "fix" errors in class A
         buildRule.executeTarget("failureRecorder.fixing");
-    
+
         // 3rd run: four running tests with two errors
         buildRule.executeTarget("failureRecorder.runtest");
-        assertTrue("The collector file '" + collectorFile.getAbsolutePath() 
+        assertTrue("The collector file '" + collectorFile.getAbsolutePath()
                    + "' should exist after the 3rd run.",
                    collectorFile.exists());
         buildRule.executeTarget("A.test02");
@@ -248,11 +248,11 @@ public class JUnitTaskTest {
         assertContains("3rd run: should run B.test04", buildRule.getOutput());
         buildRule.executeTarget("D.test10");
         assertContains("3rd run: should run D.test10", buildRule.getOutput());
-    
-    
+
+
         // 4rd run: two running tests with errors
         buildRule.executeTarget("failureRecorder.runtest");
-        assertTrue("The collector file '" + collectorFile.getAbsolutePath() 
+        assertTrue("The collector file '" + collectorFile.getAbsolutePath()
                    + "' should exist after the 4th run.",
                    collectorFile.exists());
         //TODO: these two statements fail

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestListenerTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestListenerTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestListenerTest.java
index 2b7acd4..49c1fb4 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestListenerTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestListenerTest.java
@@ -1,111 +1,111 @@
-/*
- *  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 static org.apache.tools.ant.AntAssert.assertContains;
-import static org.apache.tools.ant.AntAssert.assertNotContains;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class JUnitTestListenerTest{
-	
-	@Rule
-	public BuildFileRule buildRule = new BuildFileRule();
-
-    // The captureToSummary test writes to stdout and stderr, good for
-    // verifying that the TestListener support doesn't break anything.
-    private static final String PASS_TEST_TARGET = "captureToSummary";
-
-    // testNoCrash is the test invoked by the captureToSummary's junit task
-    private static final String PASS_TEST = "testNoCrash";
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject("src/etc/testcases/taskdefs/optional/junit.xml");
-    }
-
-
-    @Test
-    public void testFullLogOutput() {
-        buildRule.getProject().setProperty("enableEvents", "true");
-        buildRule.executeTarget(PASS_TEST_TARGET);
-        assertContains("expecting full log to have BuildListener events", 
-        		JUnitTask.TESTLISTENER_PREFIX, buildRule.getFullLog());
-    }
-    
-    @Test
-    public void testNoLogOutput() {
-        buildRule.getProject().setProperty("enableEvents", "true");
-        buildRule.executeTarget(PASS_TEST_TARGET);
-        assertNotContains("expecting log to not have BuildListener events", 
-        		JUnitTask.TESTLISTENER_PREFIX, buildRule.getLog());
-    }
-
-    @Test
-    public void testTestCountFired() {
-        buildRule.getProject().setProperty("enableEvents", "true");
-        buildRule.executeTarget(PASS_TEST_TARGET);
-	    assertContains("expecting test count message", JUnitTask.TESTLISTENER_PREFIX + 
-				   "tests to run: ", buildRule.getFullLog());
-    }
-    
-    @Test
-    public void testStartTestFired() {
-        buildRule.getProject().setProperty("enableEvents", "true");
-        buildRule.executeTarget(PASS_TEST_TARGET);
-        assertContains("expecting test started message", JUnitTask.TESTLISTENER_PREFIX + 
-				   "startTest(" + PASS_TEST + ")", buildRule.getFullLog());
-    }
-    
-    @Test
-    public void testEndTestFired() {
-        buildRule.getProject().setProperty("enableEvents", "true");
-        buildRule.executeTarget(PASS_TEST_TARGET);
-        assertContains("expecting test ended message", JUnitTask.TESTLISTENER_PREFIX + 
-				   "endTest(" + PASS_TEST + ")", buildRule.getFullLog());
-    }
-    
-    @Test
-    public void testNoFullLogOutputByDefault() {
-        buildRule.executeTarget(PASS_TEST_TARGET);
-        assertNotContains("expecting full log to not have BuildListener events", 
-        		JUnitTask.TESTLISTENER_PREFIX, buildRule.getFullLog());
-    }
-    
-    @Test
-    public void testFullLogOutputMagicProperty() {
-        buildRule.getProject().setProperty(JUnitTask.ENABLE_TESTLISTENER_EVENTS, "true");
-        buildRule.executeTarget(PASS_TEST_TARGET);
-        assertContains("expecting full log to have BuildListener events", 
-        		JUnitTask.TESTLISTENER_PREFIX, buildRule.getFullLog());
-    }
-    
-    @Test
-    public void testNoFullLogOutputMagicPropertyWins() {
-        buildRule.getProject().setProperty(JUnitTask.ENABLE_TESTLISTENER_EVENTS, "false");
-        buildRule.getProject().setProperty("enableEvents", "true");
-        buildRule.executeTarget(PASS_TEST_TARGET);
-        assertNotContains("expecting full log to not have BuildListener events", 
-        		JUnitTask.TESTLISTENER_PREFIX, buildRule.getFullLog());
-    }
-    
-}
+/*
+ *  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 static org.apache.tools.ant.AntAssert.assertContains;
+import static org.apache.tools.ant.AntAssert.assertNotContains;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class JUnitTestListenerTest{
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    // The captureToSummary test writes to stdout and stderr, good for
+    // verifying that the TestListener support doesn't break anything.
+    private static final String PASS_TEST_TARGET = "captureToSummary";
+
+    // testNoCrash is the test invoked by the captureToSummary's junit task
+    private static final String PASS_TEST = "testNoCrash";
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject("src/etc/testcases/taskdefs/optional/junit.xml");
+    }
+
+
+    @Test
+    public void testFullLogOutput() {
+        buildRule.getProject().setProperty("enableEvents", "true");
+        buildRule.executeTarget(PASS_TEST_TARGET);
+        assertContains("expecting full log to have BuildListener events",
+                JUnitTask.TESTLISTENER_PREFIX, buildRule.getFullLog());
+    }
+
+    @Test
+    public void testNoLogOutput() {
+        buildRule.getProject().setProperty("enableEvents", "true");
+        buildRule.executeTarget(PASS_TEST_TARGET);
+        assertNotContains("expecting log to not have BuildListener events",
+                JUnitTask.TESTLISTENER_PREFIX, buildRule.getLog());
+    }
+
+    @Test
+    public void testTestCountFired() {
+        buildRule.getProject().setProperty("enableEvents", "true");
+        buildRule.executeTarget(PASS_TEST_TARGET);
+        assertContains("expecting test count message", JUnitTask.TESTLISTENER_PREFIX +
+                   "tests to run: ", buildRule.getFullLog());
+    }
+
+    @Test
+    public void testStartTestFired() {
+        buildRule.getProject().setProperty("enableEvents", "true");
+        buildRule.executeTarget(PASS_TEST_TARGET);
+        assertContains("expecting test started message", JUnitTask.TESTLISTENER_PREFIX +
+                   "startTest(" + PASS_TEST + ")", buildRule.getFullLog());
+    }
+
+    @Test
+    public void testEndTestFired() {
+        buildRule.getProject().setProperty("enableEvents", "true");
+        buildRule.executeTarget(PASS_TEST_TARGET);
+        assertContains("expecting test ended message", JUnitTask.TESTLISTENER_PREFIX +
+                   "endTest(" + PASS_TEST + ")", buildRule.getFullLog());
+    }
+
+    @Test
+    public void testNoFullLogOutputByDefault() {
+        buildRule.executeTarget(PASS_TEST_TARGET);
+        assertNotContains("expecting full log to not have BuildListener events",
+                JUnitTask.TESTLISTENER_PREFIX, buildRule.getFullLog());
+    }
+
+    @Test
+    public void testFullLogOutputMagicProperty() {
+        buildRule.getProject().setProperty(JUnitTask.ENABLE_TESTLISTENER_EVENTS, "true");
+        buildRule.executeTarget(PASS_TEST_TARGET);
+        assertContains("expecting full log to have BuildListener events",
+                JUnitTask.TESTLISTENER_PREFIX, buildRule.getFullLog());
+    }
+
+    @Test
+    public void testNoFullLogOutputMagicPropertyWins() {
+        buildRule.getProject().setProperty(JUnitTask.ENABLE_TESTLISTENER_EVENTS, "false");
+        buildRule.getProject().setProperty("enableEvents", "true");
+        buildRule.executeTarget(PASS_TEST_TARGET);
+        assertNotContains("expecting full log to not have BuildListener events",
+                JUnitTask.TESTLISTENER_PREFIX, buildRule.getFullLog());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunnerTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunnerTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunnerTest.java
index e5092fe..7c0fa16 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunnerTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunnerTest.java
@@ -38,7 +38,7 @@ import org.junit.Test;
  */
 public class JUnitTestRunnerTest{
 
-  
+
 
     // check that a valid method name generates no errors
     @Test
@@ -56,8 +56,8 @@ public class JUnitTestRunnerTest{
         String error = runner.getFormatter().getError();
         // might be FAILURES or ERRORS depending on JUnit version?
         assertTrue(error, runner.getRetCode() != JUnitTestRunner.SUCCESS);
-    }    
-    
+    }
+
     // check that having no suite generates no errors
     @Test
     public void testNoSuite(){
@@ -92,7 +92,7 @@ public class JUnitTestRunnerTest{
         runner.run();
         // On junit3 this is a FAILURE, on junit4 this is an ERROR
         int ret = runner.getRetCode();
-        
+
         if (ret != JUnitTestRunner.FAILURES && ret != JUnitTestRunner.ERRORS) {
             fail("Unexpected result " + ret + " from junit runner");
         }
@@ -131,21 +131,21 @@ public class JUnitTestRunnerTest{
     }
 
     protected TestRunner createRunner(Class<?> clazz){
-        return new TestRunner(new JUnitTest(clazz.getName()), null, 
+        return new TestRunner(new JUnitTest(clazz.getName()), null,
                                             true, true, true);
     }
 
     protected TestRunner createRunnerForTestMethod(Class<?> clazz, String method){
         return new TestRunner(new JUnitTest(clazz.getName()), new String[] {method},
                                             true, true, true);
-    }    
-    
+    }
+
     // the test runner that wrap the dummy formatter that interests us
     private final static class TestRunner extends JUnitTestRunner {
         private ResultFormatter formatter = new ResultFormatter();
         TestRunner(JUnitTest test, String[] methods, boolean haltonerror,
                    boolean filtertrace, boolean haltonfailure){
-            super(test, methods, haltonerror, filtertrace,  haltonfailure, 
+            super(test, methods, haltonerror, filtertrace,  haltonfailure,
                   false, false, TestRunner.class.getClassLoader());
             // use the classloader that loaded this class otherwise
             // it will not be able to run inner classes if this test
@@ -206,8 +206,8 @@ public class JUnitTestRunnerTest{
             // should not be executed
             throw new NullPointerException("thrown on purpose");
         }
-    }    
-    
+    }
+
     public static class InvalidTestCase extends TestCase {
         public InvalidTestCase(String name){
             super(name);
@@ -242,4 +242,3 @@ public class JUnitTestRunnerTest{
         }
     }
 }
-

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelperTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelperTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelperTest.java
index b00bfde..2f3fdb7 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelperTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelperTest.java
@@ -1,102 +1,102 @@
-/*
- *  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 static org.junit.Assert.assertEquals;
-import junit.framework.JUnit4TestAdapterCache;
-import junit.framework.TestCase;
-import junit.framework.TestResult;
-
-import org.junit.Test;
-import org.junit.runner.Description;
-
-/**
- */
-public class JUnitVersionHelperTest {
-
-	@Test
-    public void testMyOwnName() {
-        assertEquals("testMyOwnName",
-        		JUnitVersionHelper.getTestCaseName(
-                    JUnit4TestAdapterCache.getDefault().asTest(
-                    		Description.createTestDescription(JUnitVersionHelperTest.class, "testMyOwnName")
-                    )
-                )
-        );
-    }
-
-	@Test
-    public void testNonTestCaseName() {
-        assertEquals("I'm a foo",
-                     JUnitVersionHelper.getTestCaseName(new Foo1()));
-    }
-
-	@Test
-    public void testNoStringReturn() {
-        assertEquals("unknown",
-                     JUnitVersionHelper.getTestCaseName(new Foo2()));
-    }
-
-	@Test
-    public void testNoGetName() {
-        assertEquals("unknown",
-                     JUnitVersionHelper.getTestCaseName(new Foo3()));
-    }
-
-	@Test
-    public void testNameNotGetName() {
-        assertEquals("I'm a foo, too",
-                     JUnitVersionHelper.getTestCaseName(new Foo4()));
-    }
-
-	@Test
-    public void testNull() {
-        assertEquals("unknown", JUnitVersionHelper.getTestCaseName(null));
-    }
-
-	@Test
-    public void testTestCaseSubClass() {
-        assertEquals("overridden getName",
-                     JUnitVersionHelper.getTestCaseName(new Foo5()));
-    }
-
-    public static class Foo implements junit.framework.Test {
-        public int countTestCases() {return 0;}
-        public void run(TestResult result) {}
-    }
-
-    public static class Foo1 extends Foo {
-        public String getName() {return "I'm a foo";}
-    }
-
-    public static class Foo2 extends Foo {
-        public int getName() {return 1;}
-    }
-
-    public static class Foo3 extends Foo {
-    }
-
-    public static class Foo4 extends Foo {
-        public String name() {return "I'm a foo, too";}
-    }
-
-    public static class Foo5 extends TestCase {
-        public String getName() {return "overridden getName";}
-    }
-
-}
+/*
+ *  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 static org.junit.Assert.assertEquals;
+import junit.framework.JUnit4TestAdapterCache;
+import junit.framework.TestCase;
+import junit.framework.TestResult;
+
+import org.junit.Test;
+import org.junit.runner.Description;
+
+/**
+ */
+public class JUnitVersionHelperTest {
+
+    @Test
+    public void testMyOwnName() {
+        assertEquals("testMyOwnName",
+                JUnitVersionHelper.getTestCaseName(
+                    JUnit4TestAdapterCache.getDefault().asTest(
+                            Description.createTestDescription(JUnitVersionHelperTest.class, "testMyOwnName")
+                    )
+                )
+        );
+    }
+
+    @Test
+    public void testNonTestCaseName() {
+        assertEquals("I'm a foo",
+                     JUnitVersionHelper.getTestCaseName(new Foo1()));
+    }
+
+    @Test
+    public void testNoStringReturn() {
+        assertEquals("unknown",
+                     JUnitVersionHelper.getTestCaseName(new Foo2()));
+    }
+
+    @Test
+    public void testNoGetName() {
+        assertEquals("unknown",
+                     JUnitVersionHelper.getTestCaseName(new Foo3()));
+    }
+
+    @Test
+    public void testNameNotGetName() {
+        assertEquals("I'm a foo, too",
+                     JUnitVersionHelper.getTestCaseName(new Foo4()));
+    }
+
+    @Test
+    public void testNull() {
+        assertEquals("unknown", JUnitVersionHelper.getTestCaseName(null));
+    }
+
+    @Test
+    public void testTestCaseSubClass() {
+        assertEquals("overridden getName",
+                     JUnitVersionHelper.getTestCaseName(new Foo5()));
+    }
+
+    public static class Foo implements junit.framework.Test {
+        public int countTestCases() {return 0;}
+        public void run(TestResult result) {}
+    }
+
+    public static class Foo1 extends Foo {
+        public String getName() {return "I'm a foo";}
+    }
+
+    public static class Foo2 extends Foo {
+        public int getName() {return 1;}
+    }
+
+    public static class Foo3 extends Foo {
+    }
+
+    public static class Foo4 extends Foo {
+        public String name() {return "I'm a foo, too";}
+    }
+
+    public static class Foo5 extends TestCase {
+        public String getName() {return "overridden getName";}
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/NoVmCrash.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/NoVmCrash.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/NoVmCrash.java
index 85fbee7..392a92e 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/NoVmCrash.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/NoVmCrash.java
@@ -1,30 +1,30 @@
-/*
- *  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 org.junit.Test;
-
-/**
- */
-public class NoVmCrash {
-
-    @Test
-    public void testNoCrash() {
-    }
-
-}
+/*
+ *  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 org.junit.Test;
+
+/**
+ */
+public class NoVmCrash {
+
+    @Test
+    public void testNoCrash() {
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/Printer.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/Printer.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/Printer.java
index c290772..0200648 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/Printer.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/Printer.java
@@ -1,42 +1,42 @@
-/*
- *  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 org.junit.Test;
-
-/**
- */
-public class Printer {
-
-    public Printer() {
-        System.err.println("constructor print to System.err");
-        System.out.println("constructor print to System.out");
-    }
-
-    static {
-        System.err.println("static print to System.err");
-        System.out.println("static print to System.out");
-    }
-
-    @Test
-    public void testNoCrash() {
-        System.err.println("method print to System.err");
-        System.out.println("method print to System.out");
-    }
-
-}
+/*
+ *  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 org.junit.Test;
+
+/**
+ */
+public class Printer {
+
+    public Printer() {
+        System.err.println("constructor print to System.err");
+        System.out.println("constructor print to System.out");
+    }
+
+    static {
+        System.err.println("static print to System.err");
+        System.out.println("static print to System.out");
+    }
+
+    @Test
+    public void testNoCrash() {
+        System.err.println("method print to System.err");
+        System.out.println("method print to System.out");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/Sleeper.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/Sleeper.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/Sleeper.java
index 0d0cb67..1509894 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/Sleeper.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/Sleeper.java
@@ -1,30 +1,30 @@
-/*
- *  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 org.junit.Test;
-
-public class Sleeper {
-
-    @Test
-    public void testSleep() throws InterruptedException {
-        Thread.sleep(5 * 1000);
-    }
-
-}
+/*
+ *  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 org.junit.Test;
+
+public class Sleeper {
+
+    @Test
+    public void testSleep() throws InterruptedException {
+        Thread.sleep(5 * 1000);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/SuiteMethodTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/SuiteMethodTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/SuiteMethodTest.java
index 207dda6..14a0966 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/SuiteMethodTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/SuiteMethodTest.java
@@ -1,42 +1,42 @@
-/*
- *  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.Test;
-import junit.framework.TestCase;
-
-/**
- * validates that the suite() method works in classes that don't
- * implement Test.
- */
-public class SuiteMethodTest {
-
-    public static Test suite() {
-        return new Nested("testMethod");
-    }
-
-    public static class Nested extends TestCase {
-        public Nested(String name) {
-            super(name);
-        }
-
-        public void testMethod() {
-            assertTrue(true);
-        }
-    }
-}
+/*
+ *  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.Test;
+import junit.framework.TestCase;
+
+/**
+ * validates that the suite() method works in classes that don't
+ * implement Test.
+ */
+public class SuiteMethodTest {
+
+    public static Test suite() {
+        return new Nested("testMethod");
+    }
+
+    public static class Nested extends TestCase {
+        public Nested(String name) {
+            super(name);
+        }
+
+        public void testMethod() {
+            assertTrue(true);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/TearDownOnVmCrashTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/TearDownOnVmCrashTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/TearDownOnVmCrashTest.java
index bfc6d31..eb20284 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/TearDownOnVmCrashTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/TearDownOnVmCrashTest.java
@@ -1,53 +1,53 @@
-/*
- *  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 static org.apache.tools.ant.AntAssert.assertContains;
-import static org.apache.tools.ant.AntAssert.assertNotContains;
-import static org.junit.Assert.assertEquals;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class TearDownOnVmCrashTest {
-	
-	@Rule
-	public BuildFileRule buildRule = new BuildFileRule();
-
-	@Before
-    public void setUp() {
-        buildRule.configureProject("src/etc/testcases/taskdefs/optional/junit/teardownlistener.xml");
-    }
-
-	@Test
-    public void testNoTeardown() {
-        buildRule.executeTarget("testNoTeardown");
-        assertEquals("true", buildRule.getProject().getProperty("error"));
-        assertNotContains("tearDown called on Timeout", buildRule.getOutput());
-    }
-
-	@Test
-    public void testTeardown() {
-		buildRule.executeTarget("testTeardown");
-		assertEquals("true", buildRule.getProject().getProperty("error"));
-		assertContains("tearDown called on Timeout", buildRule.getOutput());
-    }
-}
\ No newline at end of file
+/*
+ *  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 static org.apache.tools.ant.AntAssert.assertContains;
+import static org.apache.tools.ant.AntAssert.assertNotContains;
+import static org.junit.Assert.assertEquals;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class TearDownOnVmCrashTest {
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject("src/etc/testcases/taskdefs/optional/junit/teardownlistener.xml");
+    }
+
+    @Test
+    public void testNoTeardown() {
+        buildRule.executeTarget("testNoTeardown");
+        assertEquals("true", buildRule.getProject().getProperty("error"));
+        assertNotContains("tearDown called on Timeout", buildRule.getOutput());
+    }
+
+    @Test
+    public void testTeardown() {
+        buildRule.executeTarget("testTeardown");
+        assertEquals("true", buildRule.getProject().getProperty("error"));
+        assertContains("tearDown called on Timeout", buildRule.getOutput());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/TestFormatter.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/TestFormatter.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/TestFormatter.java
index d40da0b..27420d6 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/TestFormatter.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/TestFormatter.java
@@ -1,112 +1,112 @@
-/*
- *  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 java.io.IOException;
-import java.io.OutputStream;
-
-import junit.framework.AssertionFailedError;
-import junit.framework.Test;
-
-import org.apache.tools.ant.BuildException;
-
-public class TestFormatter implements JUnitResultFormatter {
-
-    private static final byte[] grafitto = new byte[] {
-        (byte) 'T', (byte) 'e', (byte) 's', (byte) 't', (byte) 'F', (byte) 'o',
-        (byte) 'r', (byte) 'm', (byte) 'a', (byte) 't', (byte) 't', (byte) 'e',
-        (byte) 'r', (byte) ' ', (byte) 'w', (byte) 'a', (byte) 's', (byte) ' ',
-        (byte) 'h', (byte) 'e', (byte) 'r', (byte) 'e', 10
-    };
-
-    /**
-     * Where to write the log to.
-     */
-    private OutputStream out;
-
-    /**
-     * Empty
-     */
-    public TestFormatter() {
-    }
-
-    /**
-     * Empty
-     */
-    public void startTestSuite(JUnitTest suite) {
-    }
-    /**
-     * Empty
-     */
-    public void startTest(Test t) {
-    }
-    /**
-     * Empty
-     */
-    public void endTest(Test test) {
-    }
-    /**
-     * Empty
-     */
-    public void addFailure(Test test, Throwable t) {
-    }
-    /**
-     * Empty
-     */
-    public void addFailure(Test test, AssertionFailedError t) {
-    }
-    /**
-     * Empty
-     */
-    public void addError(Test test, Throwable t) {
-    }
-    /**
-     * Empty
-     */
-    public void setSystemOutput(String out) {
-    }
-    /**
-     * Empty
-     */
-    public void setSystemError(String err) {
-    }
-
-    public void setOutput(OutputStream out) {
-        this.out = out;
-    }
-
-    public void endTestSuite(JUnitTest suite) throws BuildException {
-        if (out != null) {
-            try {
-                out.write(grafitto);
-                out.flush();
-            } catch (IOException ioex) {
-                throw new BuildException("Unable to write output", ioex);
-            } finally {
-                if (out != System.out && out != System.err) {
-                    try {
-                        out.close();
-                    } catch (IOException e) {
-                        // ignore
-                    }
-                }
-            }
-        }
-    }
-}
+/*
+ *  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 java.io.IOException;
+import java.io.OutputStream;
+
+import junit.framework.AssertionFailedError;
+import junit.framework.Test;
+
+import org.apache.tools.ant.BuildException;
+
+public class TestFormatter implements JUnitResultFormatter {
+
+    private static final byte[] grafitto = new byte[] {
+        (byte) 'T', (byte) 'e', (byte) 's', (byte) 't', (byte) 'F', (byte) 'o',
+        (byte) 'r', (byte) 'm', (byte) 'a', (byte) 't', (byte) 't', (byte) 'e',
+        (byte) 'r', (byte) ' ', (byte) 'w', (byte) 'a', (byte) 's', (byte) ' ',
+        (byte) 'h', (byte) 'e', (byte) 'r', (byte) 'e', 10
+    };
+
+    /**
+     * Where to write the log to.
+     */
+    private OutputStream out;
+
+    /**
+     * Empty
+     */
+    public TestFormatter() {
+    }
+
+    /**
+     * Empty
+     */
+    public void startTestSuite(JUnitTest suite) {
+    }
+    /**
+     * Empty
+     */
+    public void startTest(Test t) {
+    }
+    /**
+     * Empty
+     */
+    public void endTest(Test test) {
+    }
+    /**
+     * Empty
+     */
+    public void addFailure(Test test, Throwable t) {
+    }
+    /**
+     * Empty
+     */
+    public void addFailure(Test test, AssertionFailedError t) {
+    }
+    /**
+     * Empty
+     */
+    public void addError(Test test, Throwable t) {
+    }
+    /**
+     * Empty
+     */
+    public void setSystemOutput(String out) {
+    }
+    /**
+     * Empty
+     */
+    public void setSystemError(String err) {
+    }
+
+    public void setOutput(OutputStream out) {
+        this.out = out;
+    }
+
+    public void endTestSuite(JUnitTest suite) throws BuildException {
+        if (out != null) {
+            try {
+                out.write(grafitto);
+                out.flush();
+            } catch (IOException ioex) {
+                throw new BuildException("Unable to write output", ioex);
+            } finally {
+                if (out != System.out && out != System.err) {
+                    try {
+                        out.close();
+                    } catch (IOException e) {
+                        // ignore
+                    }
+                }
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/VmCrash.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/VmCrash.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/VmCrash.java
index 9c5e589..92d21b6 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/VmCrash.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/VmCrash.java
@@ -1,31 +1,31 @@
-/*
- *  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 org.junit.Test;
-
-/**
- */
-public class VmCrash {
-
-    @Test
-    public void testCrash() {
-        System.exit(0);
-    }
-
-}
+/*
+ *  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 org.junit.Test;
+
+/**
+ */
+public class VmCrash {
+
+    @Test
+    public void testCrash() {
+        System.exit(0);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLFormatterWithCDATAOnSystemOut.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLFormatterWithCDATAOnSystemOut.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLFormatterWithCDATAOnSystemOut.java
index f28bf72..3f464d8 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLFormatterWithCDATAOnSystemOut.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLFormatterWithCDATAOnSystemOut.java
@@ -1,83 +1,83 @@
-/*
- *  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 java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.apache.tools.ant.util.FileUtils;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertTrue;
-
-public class XMLFormatterWithCDATAOnSystemOut {
-
-    private static final String DIR = "src/etc/testcases/taskdefs/optional/junit";
-    private static final String REPORT =
-        "TEST-" + XMLFormatterWithCDATAOnSystemOut.class.getName() + ".xml";
-
-    private static final String TESTDATA =
-        "<ERROR>" +
-        "<![CDATA[<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
-        "  <RESPONSE>" +
-        "    <GDS/>" +
-        "    <ERROR>" +
-        "      <ID/>" +
-        "      <MESSAGE/>" +
-        "      <REQUEST_TYPE/>" +
-        "      <RESEND/>" +
-        "      <RAW_RESPONSE/>" +
-        "    </ERROR>" +
-        "  </RESPONSE>" +
-        "]]>" +
-        "</ERROR>";
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Test
-    public void testOutput() {
-        System.out.println(TESTDATA);
-    }
-
-    @Test
-    public void testBuildfile() throws IOException {
-        buildRule.configureProject(DIR + "/cdataoutput.xml");
-        if (buildRule.getProject().getProperty("cdata.inner") == null) {
-            // avoid endless loop
-            buildRule.executeTarget("run-junit");
-            File f = buildRule.getProject().resolveFile(REPORT);
-            FileReader reader = null;
-            try {
-                reader = new FileReader(f);
-                String content = FileUtils.readFully(reader);
-                assertTrue(content.indexOf("</RESPONSE>&#x5d;&#x5d;&gt;"
-                                           + "</ERROR>") > 0);
-            } finally {
-                if (reader != null) {
-                    reader.close();
-                }
-                f.delete();
-            }
-        }
-    }
-
-}
+/*
+ *  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 java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.apache.tools.ant.util.FileUtils;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+
+public class XMLFormatterWithCDATAOnSystemOut {
+
+    private static final String DIR = "src/etc/testcases/taskdefs/optional/junit";
+    private static final String REPORT =
+        "TEST-" + XMLFormatterWithCDATAOnSystemOut.class.getName() + ".xml";
+
+    private static final String TESTDATA =
+        "<ERROR>" +
+        "<![CDATA[<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+        "  <RESPONSE>" +
+        "    <GDS/>" +
+        "    <ERROR>" +
+        "      <ID/>" +
+        "      <MESSAGE/>" +
+        "      <REQUEST_TYPE/>" +
+        "      <RESEND/>" +
+        "      <RAW_RESPONSE/>" +
+        "    </ERROR>" +
+        "  </RESPONSE>" +
+        "]]>" +
+        "</ERROR>";
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Test
+    public void testOutput() {
+        System.out.println(TESTDATA);
+    }
+
+    @Test
+    public void testBuildfile() throws IOException {
+        buildRule.configureProject(DIR + "/cdataoutput.xml");
+        if (buildRule.getProject().getProperty("cdata.inner") == null) {
+            // avoid endless loop
+            buildRule.executeTarget("run-junit");
+            File f = buildRule.getProject().resolveFile(REPORT);
+            FileReader reader = null;
+            try {
+                reader = new FileReader(f);
+                String content = FileUtils.readFully(reader);
+                assertTrue(content.indexOf("</RESPONSE>&#x5d;&#x5d;&gt;"
+                                           + "</ERROR>") > 0);
+            } finally {
+                if (reader != null) {
+                    reader.close();
+                }
+                f.delete();
+            }
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregatorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregatorTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregatorTest.java
index 095a2f0..c8636b0 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregatorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregatorTest.java
@@ -1,93 +1,93 @@
-/*
- *  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 static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.PrintWriter;
-import java.security.Permission;
-
-import org.apache.tools.ant.DefaultLogger;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.Delete;
-import org.apache.tools.ant.types.FileSet;
-import org.junit.Assume;
-import org.junit.Test;
-
-public class XMLResultAggregatorTest {
-
-	@Test
-    public void testFrames() throws Exception {
-        // For now, skip this test on JDK 6 (and below); see below for why:
-        try {
-            Class.forName("java.nio.file.Files");
-        } catch (ClassNotFoundException x) {
-            Assume.assumeNoException("Skip test on JDK 6 and below", x);
-        }
-        final File d = new File(System.getProperty("java.io.tmpdir"), "XMLResultAggregatorTest");
-        if (d.exists()) {
-            new Delete() {{removeDir(d);}}; // is there no utility method for this?
-        }
-        assertTrue(d.getAbsolutePath(), d.mkdir());
-        File xml = new File(d, "x.xml");
-        PrintWriter pw = new PrintWriter(new FileOutputStream(xml));
-        try {
-            pw.println("<testsuite errors='0' failures='0' name='my.UnitTest' tests='1'>");
-            pw.println(" <testcase classname='my.UnitTest' name='testSomething'/>");
-            pw.println("</testsuite>");
-            pw.flush();
-        } finally {
-            pw.close();
-        }
-        XMLResultAggregator task = new XMLResultAggregator();
-        task.setTodir(d);
-        Project project = new Project();
-        DefaultLogger logger = new DefaultLogger();
-        logger.setOutputPrintStream(System.out);
-        logger.setErrorPrintStream(System.err);
-        logger.setMessageOutputLevel(Project.MSG_INFO);
-        project.addBuildListener(logger);
-        project.init();
-        task.setProject(project);
-        AggregateTransformer report = task.createReport();
-        report.setTodir(d);
-        FileSet fs = new FileSet();
-        fs.setFile(xml);
-        task.addFileSet(fs);
-        /* getResourceAsStream override unnecessary on JDK 7. Ought to work around JAXP #6723276 in JDK 6, but causes a TypeCheckError in FunctionCall for reasons TBD:
-        Thread.currentThread().setContextClassLoader(new ClassLoader(ClassLoader.getSystemClassLoader().getParent()) {
-            public InputStream getResourceAsStream(String name) {
-                if (name.startsWith("META-INF/services/")) {
-                    return new ByteArrayInputStream(new byte[0]);
-                }
-                return super.getResourceAsStream(name);
-            }
-        });
-        */
-        // Use the JRE's Xerces, not lib/optional/xerces.jar:
-        Thread.currentThread().setContextClassLoader(ClassLoader.getSystemClassLoader().getParent());
-        // Tickle #51668:
-        System.setSecurityManager(new SecurityManager() {public void checkPermission(Permission perm) {}});
-        task.execute();
-        assertTrue(new File(d, "index.html").isFile());
-    }
-
-}
+/*
+ *  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 static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.PrintWriter;
+import java.security.Permission;
+
+import org.apache.tools.ant.DefaultLogger;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Delete;
+import org.apache.tools.ant.types.FileSet;
+import org.junit.Assume;
+import org.junit.Test;
+
+public class XMLResultAggregatorTest {
+
+    @Test
+    public void testFrames() throws Exception {
+        // For now, skip this test on JDK 6 (and below); see below for why:
+        try {
+            Class.forName("java.nio.file.Files");
+        } catch (ClassNotFoundException x) {
+            Assume.assumeNoException("Skip test on JDK 6 and below", x);
+        }
+        final File d = new File(System.getProperty("java.io.tmpdir"), "XMLResultAggregatorTest");
+        if (d.exists()) {
+            new Delete() {{removeDir(d);}}; // is there no utility method for this?
+        }
+        assertTrue(d.getAbsolutePath(), d.mkdir());
+        File xml = new File(d, "x.xml");
+        PrintWriter pw = new PrintWriter(new FileOutputStream(xml));
+        try {
+            pw.println("<testsuite errors='0' failures='0' name='my.UnitTest' tests='1'>");
+            pw.println(" <testcase classname='my.UnitTest' name='testSomething'/>");
+            pw.println("</testsuite>");
+            pw.flush();
+        } finally {
+            pw.close();
+        }
+        XMLResultAggregator task = new XMLResultAggregator();
+        task.setTodir(d);
+        Project project = new Project();
+        DefaultLogger logger = new DefaultLogger();
+        logger.setOutputPrintStream(System.out);
+        logger.setErrorPrintStream(System.err);
+        logger.setMessageOutputLevel(Project.MSG_INFO);
+        project.addBuildListener(logger);
+        project.init();
+        task.setProject(project);
+        AggregateTransformer report = task.createReport();
+        report.setTodir(d);
+        FileSet fs = new FileSet();
+        fs.setFile(xml);
+        task.addFileSet(fs);
+        /* getResourceAsStream override unnecessary on JDK 7. Ought to work around JAXP #6723276 in JDK 6, but causes a TypeCheckError in FunctionCall for reasons TBD:
+        Thread.currentThread().setContextClassLoader(new ClassLoader(ClassLoader.getSystemClassLoader().getParent()) {
+            public InputStream getResourceAsStream(String name) {
+                if (name.startsWith("META-INF/services/")) {
+                    return new ByteArrayInputStream(new byte[0]);
+                }
+                return super.getResourceAsStream(name);
+            }
+        });
+        */
+        // Use the JRE's Xerces, not lib/optional/xerces.jar:
+        Thread.currentThread().setContextClassLoader(ClassLoader.getSystemClassLoader().getParent());
+        // Tickle #51668:
+        System.setSecurityManager(new SecurityManager() {public void checkPermission(Permission perm) {}});
+        task.execute();
+        assertTrue(new File(d, "index.html").isFile());
+    }
+
+}


[20/21] ant git commit: Normalise tabulation and line breaks

Posted by gi...@apache.org.
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestClassPathTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestClassPathTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestClassPathTest.java
index 95d4f3d..695d45c 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestClassPathTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestClassPathTest.java
@@ -39,71 +39,71 @@ import org.junit.Test;
  * Tests &lt;bm:manifestclasspath&gt;.
  */
 public class ManifestClassPathTest {
-	
-	@Rule
-	public BuildFileRule buildRule = new BuildFileRule();
 
-	@Before
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
     public void setUp() {
         buildRule.configureProject("src/etc/testcases/taskdefs/manifestclasspath.xml");
     }
 
-	@Test
+    @Test
     public void testBadDirectory() {
-		try {
-			buildRule.executeTarget("test-bad-directory");
-			fail("Build exception should have been thrown on bad directory");
-		} catch (BuildException ex) {
-			assertContains("Jar's directory not found:", ex.getMessage());
-		}
+        try {
+            buildRule.executeTarget("test-bad-directory");
+            fail("Build exception should have been thrown on bad directory");
+        } catch (BuildException ex) {
+            assertContains("Jar's directory not found:", ex.getMessage());
+        }
         assertNull(buildRule.getProject().getProperty("jar.classpath"));
     }
 
-	@Test
+    @Test
     public void testBadNoProperty() {
         try {
-			buildRule.executeTarget("test-bad-no-property");
-			fail("Build exception should have been thrown on no property");
-		} catch (BuildException ex) {
-			assertContains("Missing 'property' attribute!", ex.getMessage());
-		}
+            buildRule.executeTarget("test-bad-no-property");
+            fail("Build exception should have been thrown on no property");
+        } catch (BuildException ex) {
+            assertContains("Missing 'property' attribute!", ex.getMessage());
+        }
         assertNull(buildRule.getProject().getProperty("jar.classpath"));
     }
 
-	@Test
+    @Test
     public void testBadPropertyExists() {
         try {
-			buildRule.executeTarget("test-bad-property-exists");
-			fail("Build exception should have been thrown on bad property");
-		} catch (BuildException ex) {
-			assertContains("Property 'jar.classpath' already set!", ex.getMessage());
-		}
+            buildRule.executeTarget("test-bad-property-exists");
+            fail("Build exception should have been thrown on bad property");
+        } catch (BuildException ex) {
+            assertContains("Property 'jar.classpath' already set!", ex.getMessage());
+        }
         assertEquals(buildRule.getProject().getProperty("jar.classpath"), "exists");
     }
 
-	@Test
+    @Test
     public void testBadNoJarfile() {
-		try {
-			buildRule.executeTarget("test-bad-no-jarfile");
-			fail("Build exception should have been thrown on bad jar file");
-		} catch (BuildException ex) {
-			assertContains("Missing 'jarfile' attribute!", ex.getMessage());
-		}
+        try {
+            buildRule.executeTarget("test-bad-no-jarfile");
+            fail("Build exception should have been thrown on bad jar file");
+        } catch (BuildException ex) {
+            assertContains("Missing 'jarfile' attribute!", ex.getMessage());
+        }
         assertNull(buildRule.getProject().getProperty("jar.classpath"));
     }
 
-	@Test
+    @Test
     public void testBadNoClassPath() {
-		try {
-			buildRule.executeTarget("test-bad-no-classpath");
-			fail("Build exception should have been thrown on no classpath");
-		} catch (BuildException ex) {
-			assertContains("Missing nested <classpath>!", ex.getMessage());
-		}
+        try {
+            buildRule.executeTarget("test-bad-no-classpath");
+            fail("Build exception should have been thrown on no classpath");
+        } catch (BuildException ex) {
+            assertContains("Missing nested <classpath>!", ex.getMessage());
+        }
         assertNull(buildRule.getProject().getProperty("jar.classpath"));
     }
 
-	@Test
+    @Test
     public void testParentLevel1() {
         buildRule.executeTarget("test-parent-level1");
 
@@ -118,7 +118,7 @@ public class ManifestClassPathTest {
                                               "../resources/dsp-void/");
     }
 
-	@Test
+    @Test
     public void testParentLevel2() {
         buildRule.executeTarget("test-parent-level2");
 
@@ -133,21 +133,21 @@ public class ManifestClassPathTest {
                                               "../../resources/dsp-void/");
     }
 
-	@Test
+    @Test
     public void testParentLevel2TooDeep() {
-		try {
-			buildRule.executeTarget("test-parent-level2-too-deep");
-			fail("Build exception should have been thrown on no suitable path");
-		} catch (BuildException ex) {
-			assertContains("No suitable relative path from ", ex.getMessage());
-		}
+        try {
+            buildRule.executeTarget("test-parent-level2-too-deep");
+            fail("Build exception should have been thrown on no suitable path");
+        } catch (BuildException ex) {
+            assertContains("No suitable relative path from ", ex.getMessage());
+        }
         assertNull(buildRule.getProject().getProperty("jar.classpath"));
     }
 
     @Test
     public void testPseudoTahoeRefid() {
         Assume.assumeTrue("No regexp matcher is present", RegexpMatcherFactory.regexpMatcherPresent(buildRule.getProject()));
-        
+
         buildRule.executeTarget("test-pseudo-tahoe-refid");
         assertEquals(buildRule.getProject().getProperty("jar.classpath"), "classes/dsp-core/ " +
                                               "classes/dsp-pres/ " +
@@ -159,9 +159,9 @@ public class ManifestClassPathTest {
 
     @Test
     public void testPseudoTahoeNested() {
-    	Assume.assumeTrue("No regexp matcher is present", RegexpMatcherFactory.regexpMatcherPresent(buildRule.getProject()));
-        
-    	buildRule.executeTarget("test-pseudo-tahoe-nested");
+        Assume.assumeTrue("No regexp matcher is present", RegexpMatcherFactory.regexpMatcherPresent(buildRule.getProject()));
+
+        buildRule.executeTarget("test-pseudo-tahoe-nested");
         assertEquals(buildRule.getProject().getProperty("jar.classpath"), "classes/dsp-core/ " +
                                               "classes/dsp-pres/ " +
                                               "classes/dsp-void/ " +
@@ -186,7 +186,7 @@ public class ManifestClassPathTest {
                                               "../../resources/dsp-pres/ " +
                                               "../../resources/dsp-void/");
     }
-    
+
     @Test
     public void testInternationalGerman() {
         buildRule.executeTarget("international-german");
@@ -194,10 +194,10 @@ public class ManifestClassPathTest {
         assertContains("beta alpha", buildRule.getLog());
 
     }
-    
+
     @Test
     public void testInternationalHebrew() {
-        Assume.assumeFalse("Test with hebrew path not attempted under Windows", Os.isFamily("windows")); 
+        Assume.assumeFalse("Test with hebrew path not attempted under Windows", Os.isFamily("windows"));
         buildRule.executeTarget("international-hebrew");
         buildRule.executeTarget("run-two-jars");
         assertContains("beta alpha", buildRule.getLog());
@@ -212,7 +212,7 @@ public class ManifestClassPathTest {
 
     @Test
     public void testDifferentWindowsDrive() {
-    	Assume.assumeTrue("Test with drive letters only run on windows", Os.isFamily("windows"));
+        Assume.assumeTrue("Test with drive letters only run on windows", Os.isFamily("windows"));
         // the lines below try to find a drive name different than the one containing the temp dir
         // if the temp dir is C will try to use D
         // if the temp dir is on D or other will try to use C
@@ -233,17 +233,17 @@ public class ManifestClassPathTest {
             }
             new java.io.File(altDriveLetter + ":/foo.txt").getCanonicalPath();
         } catch (java.io.IOException e) {
-        	Assume.assumeNoException("Drive " + altDriveLetter + ": doesn't exist or is not ready", e);
+            Assume.assumeNoException("Drive " + altDriveLetter + ": doesn't exist or is not ready", e);
         }
         buildRule.getProject().setProperty("altDriveLetter", altDriveLetter);
-        
+
         try {
-			buildRule.executeTarget("testDifferentDrive");
-			fail("Build exception should have been thrown on no alternative drive");
-		} catch (BuildException ex) {
-			assertContains("No suitable relative path from ", ex.getMessage());
-		}
-        
+            buildRule.executeTarget("testDifferentDrive");
+            fail("Build exception should have been thrown on no alternative drive");
+        } catch (BuildException ex) {
+            assertContains("No suitable relative path from ", ex.getMessage());
+        }
+
         assertNull(buildRule.getProject().getProperty("cp"));
     }
-} // END class ManifestClassPathTest
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/MkdirTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/MkdirTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/MkdirTest.java
index d8f1bfc..637face 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/MkdirTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/MkdirTest.java
@@ -40,21 +40,21 @@ public class MkdirTest {
     @Test
     public void test1() {
         try {
-			buildRule.executeTarget("test1");
-			fail("BuildException expected: required argument missing");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test1");
+            fail("BuildException expected: required argument missing");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
     public void test2() {
         try {
-			buildRule.executeTarget("test2");
-			fail("BuildException expected: directory already exists as a file");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test2");
+            fail("BuildException expected: directory already exists as a file");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/NiceTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/NiceTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/NiceTest.java
index 98d9fa5..635c2d5 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/NiceTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/NiceTest.java
@@ -63,21 +63,21 @@ public class NiceTest {
     @Test
     public void testTooSlow() {
         try {
-			buildRule.executeTarget("too_slow");
-			fail("BuildException expected: out of range");
-		} catch (BuildException ex) {
-			assertContains("out of the range 1-10", ex.getMessage());
-		}
+            buildRule.executeTarget("too_slow");
+            fail("BuildException expected: out of range");
+        } catch (BuildException ex) {
+            assertContains("out of the range 1-10", ex.getMessage());
+        }
     }
 
     @Test
     public void testTooFast() {
         try {
-			buildRule.executeTarget("too_fast");
-			fail("BuildException expected: out of range");
-		} catch (BuildException ex) {
-			assertContains("out of the range 1-10", ex.getMessage());
-		}
+            buildRule.executeTarget("too_fast");
+            fail("BuildException expected: out of range");
+        } catch (BuildException ex) {
+            assertContains("out of the range 1-10", ex.getMessage());
+        }
     }
 
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/PreSetDefTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/PreSetDefTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/PreSetDefTest.java
index 8c7c1f3..65b66a4 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/PreSetDefTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/PreSetDefTest.java
@@ -33,10 +33,10 @@ import static org.junit.Assert.fail;
 /**
  */
 public class PreSetDefTest {
-    
+
     @Rule
     public final BuildFileRule buildRule = new BuildFileRule();
-    
+
     @Before
     public void setUp() {
         buildRule.configureProject("src/etc/testcases/taskdefs/presetdef.xml");
@@ -45,55 +45,55 @@ public class PreSetDefTest {
     @Test
     public void testSimple() {
         buildRule.executeTarget("simple");
-		assertEquals("Hello world", buildRule.getLog());
+        assertEquals("Hello world", buildRule.getLog());
     }
 
     @Test
     public void testText() {
         buildRule.executeTarget("text");
-		assertEquals("Inner Text", buildRule.getLog());
+        assertEquals("Inner Text", buildRule.getLog());
     }
 
     @Test
     public void testUri() {
         buildRule.executeTarget("uri");
-		assertEquals("Hello world", buildRule.getLog());
+        assertEquals("Hello world", buildRule.getLog());
     }
 
     @Test
     public void testDefaultTest() {
         buildRule.executeTarget("defaulttest");
-		assertEquals("attribute is false", buildRule.getLog());
+        assertEquals("attribute is false", buildRule.getLog());
     }
 
     @Test
     public void testDoubleDefault() {
         buildRule.executeTarget("doubledefault");
-		assertEquals("attribute is falseattribute is true", buildRule.getLog());
+        assertEquals("attribute is falseattribute is true", buildRule.getLog());
     }
 
     @Test
     public void testTextOptional() {
         buildRule.executeTarget("text.optional");
-		assertEquals("MyTextoverride text", buildRule.getLog());
+        assertEquals("MyTextoverride text", buildRule.getLog());
     }
 
     @Test
     public void testElementOrder() {
         buildRule.executeTarget("element.order");
-		assertEquals("Line 1Line 2", buildRule.getLog());
+        assertEquals("Line 1Line 2", buildRule.getLog());
     }
 
     @Test
     public void testElementOrder2() {
         buildRule.executeTarget("element.order2");
-		assertEquals("Line 1Line 2Line 3", buildRule.getLog());
+        assertEquals("Line 1Line 2Line 3", buildRule.getLog());
     }
 
     @Test
     public void testAntTypeTest() {
         buildRule.executeTarget("antTypeTest");
-		assertEquals("", buildRule.getLog());
+        assertEquals("", buildRule.getLog());
     }
 
     @Test
@@ -115,13 +115,13 @@ public class PreSetDefTest {
             assertContains("javac doesn't support the", ex.getMessage());
         }
     }
-    
+
     @Test
     public void testPresetdefWithNestedElementTwice() { // #38056
         buildRule.executeTarget("presetdef-with-nested-element-twice");
         buildRule.executeTarget("presetdef-with-nested-element-twice");
     }
-    
+
     /**
      * A test class to check default properties
      */
@@ -151,4 +151,3 @@ public class PreSetDefTest {
         }
     }
 }
-

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/PropertyTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/PropertyTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/PropertyTest.java
index 52b762d..17e7114 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/PropertyTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/PropertyTest.java
@@ -34,9 +34,9 @@ import org.junit.Test;
 /**
  */
 public class PropertyTest {
-	
-	@Rule
-	public BuildFileRule buildRule = new BuildFileRule();
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
 
     /** Utilities used for file operations */
     private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
@@ -50,14 +50,14 @@ public class PropertyTest {
     @Test
     public void test1() {
         // should get no output at all
-    	buildRule.executeTarget("test1");
-    	assertEquals("System output should have been empty", "", buildRule.getOutput());
-    	assertEquals("System error should have been empty", "", buildRule.getError());
+        buildRule.executeTarget("test1");
+        assertEquals("System output should have been empty", "", buildRule.getOutput());
+        assertEquals("System error should have been empty", "", buildRule.getError());
     }
 
     @Test
     public void test2() {
-    	buildRule.executeTarget("test2");
+        buildRule.executeTarget("test2");
         assertContains("testprop1=aa, testprop3=xxyy, testprop4=aazz", buildRule.getLog());
     }
 
@@ -71,21 +71,21 @@ public class PropertyTest {
             assertTrue("Circular definition not detected - ",
                      e.getMessage().indexOf("was circularly defined") != -1);
         }
-        
+
     }
 
     @Test
     public void test4() {
-    	buildRule.executeTarget("test4");
-    	assertContains("http.url is http://localhost:999", buildRule.getLog());
+        buildRule.executeTarget("test4");
+        assertContains("http.url is http://localhost:999", buildRule.getLog());
     }
 
     @Test
     public void test5() {
         String baseDir = buildRule.getProject().getProperty("basedir");
-    	String uri = FILE_UTILS.toURI(baseDir + "/property3.properties");
+        String uri = FILE_UTILS.toURI(baseDir + "/property3.properties");
         buildRule.getProject().setNewProperty("test5.url", uri);
-        
+
         buildRule.executeTarget("test5");
         assertContains("http.url is http://localhost:999", buildRule.getLog());
     }
@@ -103,7 +103,7 @@ public class PropertyTest {
             fail("Did not throw exception on invalid use of prefix");
         }
         catch (BuildException e) {
-            assertContains("Prefix allowed on non-resource/file load - ", 
+            assertContains("Prefix allowed on non-resource/file load - ",
                      "Prefix is only valid", e.getMessage());
         }
     }
@@ -121,21 +121,21 @@ public class PropertyTest {
 
     @Test
     public void testThisIsNotACircularReference() {
-    	buildRule.executeTarget("thisIsNotACircularReference");
+        buildRule.executeTarget("thisIsNotACircularReference");
         assertContains("b is A/A/A", buildRule.getLog());
     }
-    
+
     @Test
     public void testXmlProperty() {
         try {
             Class.forName("java.lang.Iterable");
         } catch (ClassNotFoundException e) {
-        	Assume.assumeNoException("XML Loading only on Java 5+", e);
+            Assume.assumeNoException("XML Loading only on Java 5+", e);
         }
         buildRule.executeTarget("testXmlProperty");
         assertEquals("ONE", buildRule.getProject().getProperty("xml.one"));
         assertEquals("TWO", buildRule.getProject().getProperty("xml.two"));
-        
+
     }
 
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/ReplaceTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ReplaceTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ReplaceTest.java
index 387c54d..cd485d0 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ReplaceTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ReplaceTest.java
@@ -41,7 +41,7 @@ import static org.junit.Assume.assumeTrue;
 /**
  */
 public class ReplaceTest {
-    
+
     @Rule
     public final BuildFileRule buildRule = new BuildFileRule();
 
@@ -54,41 +54,41 @@ public class ReplaceTest {
     @Test
     public void test1() {
         try {
-			buildRule.executeTarget("test1");
-			fail("BuildException expected: required argument not specified");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test1");
+            fail("BuildException expected: required argument not specified");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
     public void test2() {
         try {
-			buildRule.executeTarget("test2");
-			fail("BuildException expected: required argument not specified");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test2");
+            fail("BuildException expected: required argument not specified");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
     public void test3() {
         try {
-			buildRule.executeTarget("test3");
-			fail("BuildException expected: required argument not specified");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test3");
+            fail("BuildException expected: required argument not specified");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
     public void test4() {
         try {
-			buildRule.executeTarget("test4");
-			fail("BuildException expected: empty token not allowed");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test4");
+            fail("BuildException expected: empty token not allowed");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
@@ -99,21 +99,21 @@ public class ReplaceTest {
     @Test
     public void test6() {
         try {
-			buildRule.executeTarget("test6");
-			fail("BuildException expected: required argument not specified");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test6");
+            fail("BuildException expected: required argument not specified");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
     public void test7() {
         try {
-			buildRule.executeTarget("test7");
-			fail("BuildException expected: empty token not allowed");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test7");
+            fail("BuildException expected: empty token not allowed");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/SleepTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/SleepTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/SleepTest.java
index d1487df..f34c26c 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/SleepTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/SleepTest.java
@@ -33,9 +33,9 @@ public class SleepTest {
     public final BuildFileRule buildRule = new BuildFileRule();
 
     private final static String TASKDEFS_DIR = "src/etc/testcases/taskdefs/";
-	private final static int ERROR_RANGE=1000;
-	
-    
+    private final static int ERROR_RANGE=1000;
+
+
     @Before
     public void setUp() {
         buildRule.configureProject(TASKDEFS_DIR + "sleep.xml");
@@ -117,4 +117,3 @@ public class SleepTest {
     }
 
 }
-

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/TStampTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/TStampTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/TStampTest.java
index ed7403c..71921cb 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/TStampTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/TStampTest.java
@@ -103,7 +103,7 @@ public class TStampTest {
 
     @Test
     public void testFormatPrefix() throws Exception {
-	    Tstamp.CustomFormat format = tstamp.createFormat();
+        Tstamp.CustomFormat format = tstamp.createFormat();
         format.setProperty("format");
         format.setPattern("HH:mm:ss z");
         format.setTimezone("GMT");

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/TarTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/TarTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/TarTest.java
index c5ba120..3d77ba1 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/TarTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/TarTest.java
@@ -45,41 +45,41 @@ public class TarTest {
     @Test
     public void test1() {
         try {
-			buildRule.executeTarget("test1");
-			fail("BuildException expected: required argument not specified");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test1");
+            fail("BuildException expected: required argument not specified");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
     public void test2() {
         try {
-			buildRule.executeTarget("test2");
-			fail("BuildException expected: required argument not specified");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test2");
+            fail("BuildException expected: required argument not specified");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
     public void test3() {
         try {
-			buildRule.executeTarget("test3");
-			fail("BuildException expected: required argument not specified");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test3");
+            fail("BuildException expected: required argument not specified");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
     public void test4() {
         try {
-			buildRule.executeTarget("test4");
-			fail("BuildException expected: tar cannot include itself");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test4");
+            fail("BuildException expected: tar cannot include itself");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
@@ -96,11 +96,11 @@ public class TarTest {
     @Test
     public void test6() {
         try {
-			buildRule.executeTarget("test6");
-			fail("BuildException expected: Invalid value specified for longfile attribute.");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test6");
+            fail("BuildException expected: Invalid value specified for longfile attribute.");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
@@ -172,11 +172,11 @@ public class TarTest {
     @Test
     public void test9() {
         try {
-			buildRule.executeTarget("test9");
-			fail("BuildException expected: Invalid value specified for compression attribute.");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test9");
+            fail("BuildException expected: Invalid value specified for compression attribute.");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/TaskdefTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/TaskdefTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/TaskdefTest.java
index eaa8a66..7f28de0 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/TaskdefTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/TaskdefTest.java
@@ -44,41 +44,41 @@ public class TaskdefTest {
     @Test
     public void test1() {
         try {
-			buildRule.executeTarget("test1");
-			fail("BuildException expected: required argument not specified");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test1");
+            fail("BuildException expected: required argument not specified");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
     public void test2() {
         try {
-			buildRule.executeTarget("test2");
-			fail("BuildException expected: required argument not specified");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test2");
+            fail("BuildException expected: required argument not specified");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
     public void test3() {
         try {
-			buildRule.executeTarget("test3");
-			fail("BuildException expected: required argument not specified");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test3");
+            fail("BuildException expected: required argument not specified");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
     public void test4() {
         try {
-			buildRule.executeTarget("test4");
-			fail("BuildException expected: classname specified doesn't exist");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test4");
+            fail("BuildException expected: classname specified doesn't exist");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
@@ -99,19 +99,19 @@ public class TaskdefTest {
     @Test
     public void test6() {
         buildRule.executeTarget("test6");
-		assertEquals("simpletask: worked", buildRule.getLog());
+        assertEquals("simpletask: worked", buildRule.getLog());
     }
 
     @Test
     public void test7() {
         buildRule.executeTarget("test7");
-		assertEquals("worked", buildRule.getLog());
+        assertEquals("worked", buildRule.getLog());
     }
 
     @Test
     public void testGlobal() {
         buildRule.executeTarget("testGlobal");
-		assertEquals("worked", buildRule.getLog());
+        assertEquals("worked", buildRule.getLog());
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/TypeAdapterTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/TypeAdapterTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/TypeAdapterTest.java
index 3488f39..14c1c56 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/TypeAdapterTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/TypeAdapterTest.java
@@ -50,13 +50,13 @@ public class TypeAdapterTest {
     @Test
     public void testTaskAdapter() {
         buildRule.executeTarget("taskadapter");
-		assertContains("MyExec called", buildRule.getLog());
+        assertContains("MyExec called", buildRule.getLog());
     }
 
     @Test
     public void testRunAdapter() {
         buildRule.executeTarget("runadapter");
-		assertContains("MyRunnable called", buildRule.getLog());
+        assertContains("MyRunnable called", buildRule.getLog());
     }
 
     @Test
@@ -72,19 +72,19 @@ public class TypeAdapterTest {
     @Test
     public void testDelay() {
         buildRule.executeTarget("delay");
-		assertContains("MyTask called", buildRule.getLog());
+        assertContains("MyTask called", buildRule.getLog());
     }
 
     @Test
     public void testOnErrorReport() {
         buildRule.executeTarget("onerror.report");
-		assertContains("MyTaskNotPresent cannot be found", buildRule.getLog());
+        assertContains("MyTaskNotPresent cannot be found", buildRule.getLog());
     }
 
     @Test
     public void testOnErrorIgnore() {
         buildRule.executeTarget("onerror.ignore");
-		assertEquals("", buildRule.getLog());
+        assertEquals("", buildRule.getLog());
     }
 
     public static class MyTask extends Task {

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/TypedefTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/TypedefTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/TypedefTest.java
index bfc11dd..242f7c6 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/TypedefTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/TypedefTest.java
@@ -32,7 +32,7 @@ import static org.junit.Assert.fail;
 /**
  */
 public class TypedefTest {
-    
+
     @Rule
     public final BuildFileRule buildRule = new BuildFileRule();
 
@@ -45,41 +45,41 @@ public class TypedefTest {
     @Test
     public void testEmpty() {
         try {
-			buildRule.executeTarget("empty");
-			fail("BuildException expected: required argument not specified");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("empty");
+            fail("BuildException expected: required argument not specified");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
     public void testNoName() {
         try {
-			buildRule.executeTarget("noName");
-			fail("BuildException expected: required argument not specified");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("noName");
+            fail("BuildException expected: required argument not specified");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
     public void testNoClassname() {
         try {
-			buildRule.executeTarget("noClassname");
-			fail("BuildException expected: required argument not specified");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("noClassname");
+            fail("BuildException expected: required argument not specified");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
     public void testClassNotFound() {
         try {
-			buildRule.executeTarget("classNotFound");
-			fail("BuildException expected: classname specified doesn't exist");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("classNotFound");
+            fail("BuildException expected: classname specified doesn't exist");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
@@ -109,28 +109,28 @@ public class TypedefTest {
     @Test
     public void testDoubleNotPresent() {
         buildRule.executeTarget("double-notpresent");
-		assertContains("hi", buildRule.getLog());
+        assertContains("hi", buildRule.getLog());
     }
-    
+
     @Test
     public void testNoResourceOnErrorFailAll(){
-    		try {
-			buildRule.executeTarget("noresourcefailall");
-			fail("BuildException expected: the requested resource does not exist");
-		} catch (BuildException ex) {
-			assertContains("Could not load definitions from resource ", ex.getMessage());
-		}
+            try {
+            buildRule.executeTarget("noresourcefailall");
+            fail("BuildException expected: the requested resource does not exist");
+        } catch (BuildException ex) {
+            assertContains("Could not load definitions from resource ", ex.getMessage());
+        }
     }
-    
+
     @Test
     public void testNoResourceOnErrorFail(){
-		buildRule.executeTarget("noresourcefail");
-		assertContains("Could not load definitions from resource ", buildRule.getLog());
+        buildRule.executeTarget("noresourcefail");
+        assertContains("Could not load definitions from resource ", buildRule.getLog());
     }
-    
+
     @Test
     public void testNoResourceOnErrorNotFail(){
-    		buildRule.executeTarget("noresourcenotfail");
-		assertContains("Could not load definitions from resource ", buildRule.getLog());
+            buildRule.executeTarget("noresourcenotfail");
+        assertContains("Could not load definitions from resource ", buildRule.getLog());
     }
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/UnzipTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/UnzipTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/UnzipTest.java
index ad99620..1997561 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/UnzipTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/UnzipTest.java
@@ -45,31 +45,31 @@ public class UnzipTest {
     @Test
     public void test1() {
         try {
-			buildRule.executeTarget("test1");
-			fail("BuildException expected: required argument not specified");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test1");
+            fail("BuildException expected: required argument not specified");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
     public void test2() {
         try {
-			buildRule.executeTarget("test2");
-			fail("BuildException expected: required argument not specified");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test2");
+            fail("BuildException expected: required argument not specified");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
     public void test3() {
         try {
-			buildRule.executeTarget("test3");
-			fail("BuildException expected: required argument not specified");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test3");
+            fail("BuildException expected: required argument not specified");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
 
@@ -227,11 +227,11 @@ public class UnzipTest {
     @Test
     public void testTwoMappers() {
         try {
-			buildRule.executeTarget("testTwoMappers");
-			fail("BuildException expected: " + Expand.ERROR_MULTIPLE_MAPPERS);
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("testTwoMappers");
+            fail("BuildException expected: " + Expand.ERROR_MULTIPLE_MAPPERS);
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/UpToDateTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/UpToDateTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/UpToDateTest.java
index b9677c4..4428b93 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/UpToDateTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/UpToDateTest.java
@@ -54,24 +54,24 @@ public class UpToDateTest {
     @Test
     public void testFilesetUpToDate() {
         buildRule.executeTarget("testFilesetUpToDate");
-		assertEquals("true", buildRule.getProject().getProperty("foo"));
+        assertEquals("true", buildRule.getProject().getProperty("foo"));
     }
 
     @Test
     public void testFilesetOutOfDate() {
         buildRule.executeTarget("testFilesetOutOfDate");
-		assertNull(buildRule.getProject().getProperty("foo"));
+        assertNull(buildRule.getProject().getProperty("foo"));
     }
 
     @Test
     public void testRCUpToDate() {
         buildRule.executeTarget("testRCUpToDate");
-		assertEquals("true", buildRule.getProject().getProperty("foo"));
+        assertEquals("true", buildRule.getProject().getProperty("foo"));
     }
 
     @Test
     public void testRCOutOfDate() {
         buildRule.executeTarget("testRCOutOfDate");
-		assertNull(buildRule.getProject().getProperty("foo"));
+        assertNull(buildRule.getProject().getProperty("foo"));
     }
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/XmlnsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/XmlnsTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/XmlnsTest.java
index 590a4db..379fc02 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/XmlnsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/XmlnsTest.java
@@ -42,19 +42,19 @@ public class XmlnsTest {
     @Test
     public void testXmlns() {
         buildRule.executeTarget("xmlns");
-		assertEquals("MyTask called", buildRule.getLog());
+        assertEquals("MyTask called", buildRule.getLog());
     }
 
     @Test
     public void testXmlnsFile() {
         buildRule.executeTarget("xmlns.file");
-		assertEquals("MyTask called", buildRule.getLog());
+        assertEquals("MyTask called", buildRule.getLog());
     }
 
     @Test
     public void testCore() {
         buildRule.executeTarget("core");
-		assertEquals("MyTask called", buildRule.getLog());
+        assertEquals("MyTask called", buildRule.getLog());
     }
 
     @Test
@@ -70,13 +70,13 @@ public class XmlnsTest {
     @Test
     public void testOther() {
         buildRule.executeTarget("other");
-		assertEquals("a message", buildRule.getLog());
+        assertEquals("a message", buildRule.getLog());
     }
 
     @Test
     public void testNsAttributes() {
         buildRule.executeTarget("ns.attributes");
-		assertEquals("hello world", buildRule.getLog());
+        assertEquals("hello world", buildRule.getLog());
     }
 
     public static class MyTask extends Task {
@@ -86,4 +86,3 @@ public class XmlnsTest {
     }
 
 }
-

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java
index efa9f77..d1340b5 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java
@@ -43,10 +43,10 @@ import static org.junit.Assume.assumeTrue;
 
 
 public class ZipTest {
-    
+
     @Rule
     public BuildFileRule buildRule = new BuildFileRule();
-            
+
     //instance variable to allow cleanup
     ZipFile zfPrefixAddsDir = null;
 
@@ -60,42 +60,42 @@ public class ZipTest {
     @Test
     public void test1() {
         try {
-			buildRule.executeTarget("test1");
-			fail("BuildException expected: required argument not specified");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test1");
+            fail("BuildException expected: required argument not specified");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
     public void test2() {
         try {
-			buildRule.executeTarget("test2");
-			fail("BuildException expected: required argument not specified");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test2");
+            fail("BuildException expected: required argument not specified");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
     public void test3() {
         try {
-			buildRule.executeTarget("test3");
-			fail("BuildException expected: zip cannot include itself");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test3");
+            fail("BuildException expected: zip cannot include itself");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
     @Ignore("Previously commented out")
     public void test4() {
         try {
-			buildRule.executeTarget("test4");
-			fail("BuildException expected: zip cannot include itself");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test4");
+            fail("BuildException expected: zip cannot include itself");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @After
@@ -157,7 +157,7 @@ public class ZipTest {
     @Test
     public void testUpdateIsNecessary() {
         buildRule.executeTarget("testUpdateIsNecessary");
-		assertContains("Updating", buildRule.getLog());
+        assertContains("Updating", buildRule.getLog());
     }
 
     // Bugzilla Report 18403
@@ -202,7 +202,7 @@ public class ZipTest {
     @Test
     public void testZipEmptyCreate() {
         buildRule.executeTarget("zipEmptyCreate");
-		assertContains("Note: creating empty", buildRule.getLog());
+        assertContains("Note: creating empty", buildRule.getLog());
     }
     // Bugzilla Report 25513
     @Test

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/email/MessageTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/email/MessageTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/email/MessageTest.java
index 505decd..df75067 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/email/MessageTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/email/MessageTest.java
@@ -1,62 +1,62 @@
-/*
- *  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.email;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.PrintStream;
-
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.util.FileUtils;
-import org.junit.After;
-import org.junit.Test;
-
-public class MessageTest {
-    private static final File f = new File(System.getProperty("java.io.tmpdir"),
-                              "message.txt");
-    /**
-     * test for bugzilla 48932
-     */
-    @Test
-    public void testPrintStreamDoesNotGetClosed() throws IOException {
-        Message ms = new Message();
-        Project p = new Project();
-        ms.setProject(p);
-        ms.addText("hi, this is an email");
-        FileOutputStream fis = null;
-        try {
-            fis = new FileOutputStream(f);
-            ms.print(new PrintStream(fis));
-            fis.write(120);
-        } finally {
-            FileUtils.close(fis);
-        }
-
-    }
-
-    @After
-    public void tearDown() {
-        if (f.exists()) {
-            FileUtils fu = FileUtils.getFileUtils();
-            fu.tryHardToDelete(f);
-        }
-    }
-
-}
+/*
+ *  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.email;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.util.FileUtils;
+import org.junit.After;
+import org.junit.Test;
+
+public class MessageTest {
+    private static final File f = new File(System.getProperty("java.io.tmpdir"),
+                              "message.txt");
+    /**
+     * test for bugzilla 48932
+     */
+    @Test
+    public void testPrintStreamDoesNotGetClosed() throws IOException {
+        Message ms = new Message();
+        Project p = new Project();
+        ms.setProject(p);
+        ms.addText("hi, this is an email");
+        FileOutputStream fis = null;
+        try {
+            fis = new FileOutputStream(f);
+            ms.print(new PrintStream(fis));
+            fis.write(120);
+        } finally {
+            FileUtils.close(fis);
+        }
+
+    }
+
+    @After
+    public void tearDown() {
+        if (f.exists()) {
+            FileUtils fu = FileUtils.getFileUtils();
+            fu.tryHardToDelete(f);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ANTLRTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ANTLRTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ANTLRTest.java
index 47abcfe..9258448 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ANTLRTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ANTLRTest.java
@@ -1,216 +1,216 @@
-/*
- *  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;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.BuildFileRule;
-import org.apache.tools.ant.FileUtilities;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import java.io.File;
-import java.io.FilenameFilter;
-
-import static org.apache.tools.ant.AntAssert.assertContains;
-import static org.apache.tools.ant.AntAssert.assertNotContains;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-/**
- * If you want to run tests, it is highly recommended
- * to download ANTLR (www.antlr.org), build the 'antlrall.jar' jar
- * with  <code>make antlr-all.jar</code> and drop the jar (about 300KB) into
- * Ant lib.
- * - Running w/ the default antlr.jar (70KB) does not work (missing class)
- *
- * Unless of course you specify the ANTLR classpath in your
- * system classpath. (see ANTLR install.html)
- *
- */
-public class ANTLRTest {
-
-    private final static String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/antlr/";
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject(TASKDEFS_DIR + "antlr.xml");
-    }
-
-    @Test
-    public void test1() {
-        try {
-            buildRule.executeTarget("test1");
-            fail("required argument, target, missing");
-        } catch (BuildException ex) {
-            //TODO should check exception message
-        }
-    }
-
-    @Test
-    public void test2() {
-        try {
-            buildRule.executeTarget("test2");
-            fail("Invalid output directory");
-        } catch (BuildException ex) {
-            //TODO should check exception message
-        }
-    }
-
-    @Test
-    public void test3() {
-        buildRule.executeTarget("test3");
-    }
-
-    @Test
-    public void test4() {
-        buildRule.executeTarget("test4");
-    }
-
-    @Test
-    public void test5() {
-        // should print "panic: Cannot find importVocab file 'JavaTokenTypes.txt'"
-        // since it needs to run java.g first before java.tree.g
-        try {
-            buildRule.executeTarget("test5");
-            fail("ANTLR returned: 1");
-        } catch (BuildException ex) {
-            //TODO should check exception message
-        }
-    }
-
-    @Test
-    public void test6() {
-        buildRule.executeTarget("test6");
-    }
-
-    @Test
-    public void test7() {
-        try {
-            buildRule.executeTarget("test7");
-            fail("Unable to determine generated class");
-        } catch (BuildException ex) {
-            //TODO should check exception message
-        }
-    }
-
-    /**
-     * This is a negative test for the super grammar (glib) option.
-     */
-    @Test
-    public void test8() {
-        try {
-            buildRule.executeTarget("test8");
-            fail("Invalid super grammar file");
-        } catch (BuildException ex) {
-            //TODO should check exception message
-        }
-    }
-
-    /**
-     * This is a positive test for the super grammar (glib) option.  ANTLR
-     * will throw an error if everything is not correct.
-     */
-    @Test
-    public void test9() {
-        buildRule.executeTarget("test9");
-    }
-
-    /**
-     * This test creates an html-ized version of the calculator grammar.
-     * The sanity check is simply whether or not an html file was generated.
-     */
-    @Test
-    public void test10() {
-        buildRule.executeTarget("test10");
-        File outputDirectory = new File(buildRule.getProject().getProperty("output"));
-        String[] calcFiles = outputDirectory.list(new HTMLFilter());
-        assertTrue(calcFiles.length > 0);
-    }
-
-    /**
-     * This is just a quick sanity check to run the diagnostic option and
-     * make sure that it doesn't throw any funny exceptions.
-     */
-    @Test
-    public void test11() {
-        buildRule.executeTarget("test11");
-    }
-
-    /**
-     * This is just a quick sanity check to run the trace option and
-     * make sure that it doesn't throw any funny exceptions.
-     */
-    @Test
-    public void test12() {
-        buildRule.executeTarget("test12");
-    }
-
-    /**
-     * This is just a quick sanity check to run all the rest of the
-     * trace options (traceLexer, traceParser, and traceTreeWalker) to
-     * make sure that they don't throw any funny exceptions.
-     */
-    @Test
-    public void test13() {
-        buildRule.executeTarget("test13");
-    }
-
-    @Test
-    public void testNoRecompile() {
-        buildRule.executeTarget("test9");
-        assertNotContains("Skipped grammar file.", buildRule.getFullLog());
-        buildRule.executeTarget("noRecompile");
-        assertContains("Skipped grammar file.", buildRule.getFullLog());
-    }
-
-    @Test
-    public void testNormalRecompile() {
-        buildRule.executeTarget("test9");
-        assertNotContains("Skipped grammar file.", buildRule.getFullLog());
-
-        FileUtilities.rollbackTimetamps(buildRule.getOutputDir(), 5);
-
-        buildRule.executeTarget("normalRecompile");
-        assertNotContains("Skipped grammar file.", buildRule.getFullLog());
-    }
-
-    @Test
-    // Bugzilla Report 12961
-    public void testSupergrammarChangeRecompile() {
-        buildRule.executeTarget("test9");
-        assertNotContains("Skipped grammar file.", buildRule.getFullLog());
-
-        FileUtilities.rollbackTimetamps(buildRule.getOutputDir(), 5);
-
-        buildRule.executeTarget("supergrammarChangeRecompile");
-        assertNotContains("Skipped grammar file.", buildRule.getFullLog());
-
-    }
-
-}
-
-class HTMLFilter implements FilenameFilter {
-    public boolean accept(File dir, String name) {
-        return name.endsWith("html");
-    }
-}
+/*
+ *  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;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileRule;
+import org.apache.tools.ant.FileUtilities;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import java.io.File;
+import java.io.FilenameFilter;
+
+import static org.apache.tools.ant.AntAssert.assertContains;
+import static org.apache.tools.ant.AntAssert.assertNotContains;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * If you want to run tests, it is highly recommended
+ * to download ANTLR (www.antlr.org), build the 'antlrall.jar' jar
+ * with  <code>make antlr-all.jar</code> and drop the jar (about 300KB) into
+ * Ant lib.
+ * - Running w/ the default antlr.jar (70KB) does not work (missing class)
+ *
+ * Unless of course you specify the ANTLR classpath in your
+ * system classpath. (see ANTLR install.html)
+ *
+ */
+public class ANTLRTest {
+
+    private final static String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/antlr/";
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject(TASKDEFS_DIR + "antlr.xml");
+    }
+
+    @Test
+    public void test1() {
+        try {
+            buildRule.executeTarget("test1");
+            fail("required argument, target, missing");
+        } catch (BuildException ex) {
+            //TODO should check exception message
+        }
+    }
+
+    @Test
+    public void test2() {
+        try {
+            buildRule.executeTarget("test2");
+            fail("Invalid output directory");
+        } catch (BuildException ex) {
+            //TODO should check exception message
+        }
+    }
+
+    @Test
+    public void test3() {
+        buildRule.executeTarget("test3");
+    }
+
+    @Test
+    public void test4() {
+        buildRule.executeTarget("test4");
+    }
+
+    @Test
+    public void test5() {
+        // should print "panic: Cannot find importVocab file 'JavaTokenTypes.txt'"
+        // since it needs to run java.g first before java.tree.g
+        try {
+            buildRule.executeTarget("test5");
+            fail("ANTLR returned: 1");
+        } catch (BuildException ex) {
+            //TODO should check exception message
+        }
+    }
+
+    @Test
+    public void test6() {
+        buildRule.executeTarget("test6");
+    }
+
+    @Test
+    public void test7() {
+        try {
+            buildRule.executeTarget("test7");
+            fail("Unable to determine generated class");
+        } catch (BuildException ex) {
+            //TODO should check exception message
+        }
+    }
+
+    /**
+     * This is a negative test for the super grammar (glib) option.
+     */
+    @Test
+    public void test8() {
+        try {
+            buildRule.executeTarget("test8");
+            fail("Invalid super grammar file");
+        } catch (BuildException ex) {
+            //TODO should check exception message
+        }
+    }
+
+    /**
+     * This is a positive test for the super grammar (glib) option.  ANTLR
+     * will throw an error if everything is not correct.
+     */
+    @Test
+    public void test9() {
+        buildRule.executeTarget("test9");
+    }
+
+    /**
+     * This test creates an html-ized version of the calculator grammar.
+     * The sanity check is simply whether or not an html file was generated.
+     */
+    @Test
+    public void test10() {
+        buildRule.executeTarget("test10");
+        File outputDirectory = new File(buildRule.getProject().getProperty("output"));
+        String[] calcFiles = outputDirectory.list(new HTMLFilter());
+        assertTrue(calcFiles.length > 0);
+    }
+
+    /**
+     * This is just a quick sanity check to run the diagnostic option and
+     * make sure that it doesn't throw any funny exceptions.
+     */
+    @Test
+    public void test11() {
+        buildRule.executeTarget("test11");
+    }
+
+    /**
+     * This is just a quick sanity check to run the trace option and
+     * make sure that it doesn't throw any funny exceptions.
+     */
+    @Test
+    public void test12() {
+        buildRule.executeTarget("test12");
+    }
+
+    /**
+     * This is just a quick sanity check to run all the rest of the
+     * trace options (traceLexer, traceParser, and traceTreeWalker) to
+     * make sure that they don't throw any funny exceptions.
+     */
+    @Test
+    public void test13() {
+        buildRule.executeTarget("test13");
+    }
+
+    @Test
+    public void testNoRecompile() {
+        buildRule.executeTarget("test9");
+        assertNotContains("Skipped grammar file.", buildRule.getFullLog());
+        buildRule.executeTarget("noRecompile");
+        assertContains("Skipped grammar file.", buildRule.getFullLog());
+    }
+
+    @Test
+    public void testNormalRecompile() {
+        buildRule.executeTarget("test9");
+        assertNotContains("Skipped grammar file.", buildRule.getFullLog());
+
+        FileUtilities.rollbackTimetamps(buildRule.getOutputDir(), 5);
+
+        buildRule.executeTarget("normalRecompile");
+        assertNotContains("Skipped grammar file.", buildRule.getFullLog());
+    }
+
+    @Test
+    // Bugzilla Report 12961
+    public void testSupergrammarChangeRecompile() {
+        buildRule.executeTarget("test9");
+        assertNotContains("Skipped grammar file.", buildRule.getFullLog());
+
+        FileUtilities.rollbackTimetamps(buildRule.getOutputDir(), 5);
+
+        buildRule.executeTarget("supergrammarChangeRecompile");
+        assertNotContains("Skipped grammar file.", buildRule.getFullLog());
+
+    }
+
+}
+
+class HTMLFilter implements FilenameFilter {
+    public boolean accept(File dir, String name) {
+        return name.endsWith("html");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/AbstractXSLTLiaisonTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/AbstractXSLTLiaisonTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/AbstractXSLTLiaisonTest.java
index 8f2f494..4e1ee7a 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/AbstractXSLTLiaisonTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/AbstractXSLTLiaisonTest.java
@@ -1,104 +1,104 @@
-/*
- *  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;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.net.URL;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.apache.tools.ant.taskdefs.XSLTLiaison;
-import org.apache.tools.ant.util.FileUtils;
-import org.junit.Before;
-import org.junit.Test;
-import org.w3c.dom.Document;
-
-/**
- * Abtract testcase for XSLTLiaison.
- * Override createLiaison for each XSLTLiaison.
- *
- * <a href="sbailliez@apache.org">Stephane Bailliez</a>
- */
-public abstract class AbstractXSLTLiaisonTest {
-
-    private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
-    
-    protected XSLTLiaison liaison;
-
-    @Before
-    public void setUp() throws Exception {
-        liaison = createLiaison();
-    }
-
-    // to override
-    protected abstract XSLTLiaison createLiaison() throws Exception ;
-
-    /** load the file from the caller classloader that loaded this class */
-    protected File getFile(String name) throws FileNotFoundException {
-        URL url = getClass().getResource(name);
-        if (url == null){
-          throw new FileNotFoundException("Unable to load '" + name + "' from classpath");
-        }
-        return new File(FILE_UTILS.fromURI(url.toExternalForm()));
-    }
-
-    /** keep it simple stupid */
-    @Test
-    public void testTransform() throws Exception {
-        File xsl = getFile("/taskdefs/optional/xsltliaison-in.xsl");
-        liaison.setStylesheet(xsl);
-        liaison.addParam("param", "value");
-        File in = getFile("/taskdefs/optional/xsltliaison-in.xml");
-        File out = new File("xsltliaison.tmp");
-        out.deleteOnExit(); // just to be sure
-        try {
-            liaison.transform(in, out);
-        } finally {
-            out.delete();
-        }
-    }
-
-    @Test
-    public void testEncoding() throws Exception {
-        File xsl = getFile("/taskdefs/optional/xsltliaison-encoding-in.xsl");
-        liaison.setStylesheet(xsl);
-        File in = getFile("/taskdefs/optional/xsltliaison-encoding-in.xml");
-        File out = new File("xsltliaison-encoding.tmp");
-        out.deleteOnExit(); // just to be sure
-        try {
-            liaison.transform(in, out);
-            Document doc = parseXML(out);
-            assertEquals("root",doc.getDocumentElement().getNodeName());
-            assertEquals("message",doc.getDocumentElement().getFirstChild().getNodeName());
-            assertEquals("\u00E9\u00E0\u00E8\u00EF\u00F9",doc.getDocumentElement().getFirstChild().getFirstChild().getNodeValue());
-        } finally {
-            out.delete();
-        }
-    }
-
-    public Document parseXML(File file) throws Exception {
-        DocumentBuilderFactory dbfactory = DocumentBuilderFactory.newInstance();
-        DocumentBuilder dbuilder = dbfactory.newDocumentBuilder();
-        return dbuilder.parse(file);
-    }
-}
+/*
+ *  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;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.net.URL;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.apache.tools.ant.taskdefs.XSLTLiaison;
+import org.apache.tools.ant.util.FileUtils;
+import org.junit.Before;
+import org.junit.Test;
+import org.w3c.dom.Document;
+
+/**
+ * Abtract testcase for XSLTLiaison.
+ * Override createLiaison for each XSLTLiaison.
+ *
+ * <a href="sbailliez@apache.org">Stephane Bailliez</a>
+ */
+public abstract class AbstractXSLTLiaisonTest {
+
+    private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
+
+    protected XSLTLiaison liaison;
+
+    @Before
+    public void setUp() throws Exception {
+        liaison = createLiaison();
+    }
+
+    // to override
+    protected abstract XSLTLiaison createLiaison() throws Exception ;
+
+    /** load the file from the caller classloader that loaded this class */
+    protected File getFile(String name) throws FileNotFoundException {
+        URL url = getClass().getResource(name);
+        if (url == null){
+          throw new FileNotFoundException("Unable to load '" + name + "' from classpath");
+        }
+        return new File(FILE_UTILS.fromURI(url.toExternalForm()));
+    }
+
+    /** keep it simple stupid */
+    @Test
+    public void testTransform() throws Exception {
+        File xsl = getFile("/taskdefs/optional/xsltliaison-in.xsl");
+        liaison.setStylesheet(xsl);
+        liaison.addParam("param", "value");
+        File in = getFile("/taskdefs/optional/xsltliaison-in.xml");
+        File out = new File("xsltliaison.tmp");
+        out.deleteOnExit(); // just to be sure
+        try {
+            liaison.transform(in, out);
+        } finally {
+            out.delete();
+        }
+    }
+
+    @Test
+    public void testEncoding() throws Exception {
+        File xsl = getFile("/taskdefs/optional/xsltliaison-encoding-in.xsl");
+        liaison.setStylesheet(xsl);
+        File in = getFile("/taskdefs/optional/xsltliaison-encoding-in.xml");
+        File out = new File("xsltliaison-encoding.tmp");
+        out.deleteOnExit(); // just to be sure
+        try {
+            liaison.transform(in, out);
+            Document doc = parseXML(out);
+            assertEquals("root",doc.getDocumentElement().getNodeName());
+            assertEquals("message",doc.getDocumentElement().getFirstChild().getNodeName());
+            assertEquals("\u00E9\u00E0\u00E8\u00EF\u00F9",doc.getDocumentElement().getFirstChild().getFirstChild().getNodeValue());
+        } finally {
+            out.delete();
+        }
+    }
+
+    public Document parseXML(File file) throws Exception {
+        DocumentBuilderFactory dbfactory = DocumentBuilderFactory.newInstance();
+        DocumentBuilder dbuilder = dbfactory.newDocumentBuilder();
+        return dbuilder.parse(file);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/BeanShellScriptTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/BeanShellScriptTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/BeanShellScriptTest.java
index 834f173..8802022 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/BeanShellScriptTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/BeanShellScriptTest.java
@@ -1,48 +1,48 @@
-/*
- *  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;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Tests the examples of the &lt;script&gt; task docs.
- *
- * @since Ant 1.5.2
- */
-public class BeanShellScriptTest {
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject("src/etc/testcases/taskdefs/optional/script.xml");
-    }
-
-    @Test
-    public void testCanLoad() {
-        buildRule.executeTarget("useBeanshell");
-        assertEquals("I'm here", buildRule.getLog());
-    }
-
-}
+/*
+ *  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;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests the examples of the &lt;script&gt; task docs.
+ *
+ * @since Ant 1.5.2
+ */
+public class BeanShellScriptTest {
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject("src/etc/testcases/taskdefs/optional/script.xml");
+    }
+
+    @Test
+    public void testCanLoad() {
+        buildRule.executeTarget("useBeanshell");
+        assertEquals("I'm here", buildRule.getLog());
+    }
+
+}


[03/21] ant git commit: Normalise tabulation and line breaks

Posted by gi...@apache.org.
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/bzip2/BlockSortTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/bzip2/BlockSortTest.java b/src/tests/junit/org/apache/tools/bzip2/BlockSortTest.java
index 0f32955..e043f5d 100644
--- a/src/tests/junit/org/apache/tools/bzip2/BlockSortTest.java
+++ b/src/tests/junit/org/apache/tools/bzip2/BlockSortTest.java
@@ -1,171 +1,171 @@
-/*
- * 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.bzip2;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-
-public class BlockSortTest {
-
-    private static final byte[] FIXTURE = { 0, 1, (byte) 252, (byte) 253, (byte) 255,
-                                            (byte) 254, 3, 2, (byte) 128 };
-
-    /*
-      Burrows-Wheeler transform of fixture the manual way:
-
-      * build the matrix
-
-      0, 1, 252, 253, 255, 254, 3, 2, 128
-      1, 252, 253, 255, 254, 3, 2, 128, 0
-      252, 253, 255, 254, 3, 2, 128, 0, 1
-      253, 255, 254, 3, 2, 128, 0, 1, 252
-      255, 254, 3, 2, 128, 0, 1, 252, 253
-      254, 3, 2, 128, 0, 1, 252, 253, 255
-      3, 2, 128, 0, 1, 252, 253, 255, 254
-      2, 128, 0, 1, 252, 253, 255, 254, 3
-      128, 0, 1, 252, 253, 255, 254, 3, 2
-
-      * sort it
-
-      0, 1, 252, 253, 255, 254, 3, 2, 128
-      1, 252, 253, 255, 254, 3, 2, 128, 0
-      2, 128, 0, 1, 252, 253, 255, 254, 3
-      3, 2, 128, 0, 1, 252, 253, 255, 254
-      128, 0, 1, 252, 253, 255, 254, 3, 2
-      252, 253, 255, 254, 3, 2, 128, 0, 1
-      253, 255, 254, 3, 2, 128, 0, 1, 252
-      254, 3, 2, 128, 0, 1, 252, 253, 255
-      255, 254, 3, 2, 128, 0, 1, 252, 253
-
-      * grab last column
-
-      128, 0, 3, 254, 2, 1, 252, 255, 253
-
-        and the original line has been 0
-    */
-
-    private static final byte[] FIXTURE_BWT = { (byte) 128, 0, 3, (byte) 254, 2, 1, 
-                                                (byte) 252, (byte) 255, (byte) 253 };
-
-    private static final int[] FIXTURE_SORTED = {
-        0, 1, 7, 6, 8, 2, 3, 5, 4
-    };
-
-    private static final byte[] FIXTURE2 = { 
-        'C', 'o', 'm', 'm', 'o', 'n', 's', ' ', 'C', 'o', 'm', 'p', 'r', 'e', 's', 's', 
-    };
-
-    private static final byte[] FIXTURE2_BWT = {
-        's', 's', ' ', 'r', 'o', 'm', 'o', 'o', 'C', 'C', 'm', 'm', 'p', 'n', 's', 'e', 
-    };
-
-    @Test
-    public void testSortFixture() {
-        DS ds = setUpFixture();
-        ds.s.blockSort(ds.data, FIXTURE.length - 1);
-        assertFixtureSorted(ds.data);
-        assertEquals(0, ds.data.origPtr);
-    }
-
-    @Test
-    public void testSortFixtureMainSort() {
-        DS ds = setUpFixture();
-        ds.s.mainSort(ds.data, FIXTURE.length - 1);
-        assertFixtureSorted(ds.data);
-    }
-
-    @Test
-    public void testSortFixtureFallbackSort() {
-        DS ds = setUpFixture();
-        ds.s.fallbackSort(ds.data, FIXTURE.length - 1);
-        assertFixtureSorted(ds.data);
-    }
-
-    @Test
-    public void testSortFixture2() {
-        DS ds = setUpFixture2();
-        ds.s.blockSort(ds.data, FIXTURE2.length - 1);
-        assertFixture2Sorted(ds.data);
-        assertEquals(1, ds.data.origPtr);
-    }
-
-    @Test
-    public void testSortFixture2MainSort() {
-        DS ds = setUpFixture2();
-        ds.s.mainSort(ds.data, FIXTURE2.length - 1);
-        assertFixture2Sorted(ds.data);
-    }
-
-    @Test
-    public void testSortFixture2FallbackSort() {
-        DS ds = setUpFixture2();
-        ds.s.fallbackSort(ds.data, FIXTURE2.length - 1);
-        assertFixture2Sorted(ds.data);
-    }
-
-    @Test
-    public void testFallbackSort() {
-        CBZip2OutputStream.Data data = new CBZip2OutputStream.Data(1);
-        BlockSort s = new BlockSort(data);
-        int[] fmap = new int[FIXTURE.length];
-        s.fallbackSort(fmap, FIXTURE, FIXTURE.length);
-        assertArrayEquals(FIXTURE_SORTED, fmap);
-    }
-
-    private DS setUpFixture() {
-        return setUpFixture(FIXTURE);
-    }
-
-    private void assertFixtureSorted(CBZip2OutputStream.Data data) {
-        assertFixtureSorted(data, FIXTURE, FIXTURE_BWT);
-    }
-
-    private DS setUpFixture2() {
-        return setUpFixture(FIXTURE2);
-    }
-
-    private void assertFixture2Sorted(CBZip2OutputStream.Data data) {
-        assertFixtureSorted(data, FIXTURE2, FIXTURE2_BWT);
-    }
-
-    private DS setUpFixture(byte[] fixture) {
-        CBZip2OutputStream.Data data = new CBZip2OutputStream.Data(1);
-        System.arraycopy(fixture, 0, data.block, 1, fixture.length);
-        return new DS(data, new BlockSort(data));
-    }
-
-    private void assertFixtureSorted(CBZip2OutputStream.Data data,
-                                     byte[] fixture, byte[] fixtureBwt) {
-        assertEquals(fixture[fixture.length - 1], data.block[0]);
-        for (int i = 0; i < fixture.length; i++) {
-            assertEquals(fixtureBwt[i], data.block[data.fmap[i]]);
-        }
-    }
-
-    private static class DS {
-        private final CBZip2OutputStream.Data data;
-        private final BlockSort s;
-        DS(CBZip2OutputStream.Data data, BlockSort s) {
-            this.data = data;
-            this.s = s;
-        }
-    }
-}
\ No newline at end of file
+/*
+ * 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.bzip2;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+
+public class BlockSortTest {
+
+    private static final byte[] FIXTURE = { 0, 1, (byte) 252, (byte) 253, (byte) 255,
+                                            (byte) 254, 3, 2, (byte) 128 };
+
+    /*
+      Burrows-Wheeler transform of fixture the manual way:
+
+      * build the matrix
+
+      0, 1, 252, 253, 255, 254, 3, 2, 128
+      1, 252, 253, 255, 254, 3, 2, 128, 0
+      252, 253, 255, 254, 3, 2, 128, 0, 1
+      253, 255, 254, 3, 2, 128, 0, 1, 252
+      255, 254, 3, 2, 128, 0, 1, 252, 253
+      254, 3, 2, 128, 0, 1, 252, 253, 255
+      3, 2, 128, 0, 1, 252, 253, 255, 254
+      2, 128, 0, 1, 252, 253, 255, 254, 3
+      128, 0, 1, 252, 253, 255, 254, 3, 2
+
+      * sort it
+
+      0, 1, 252, 253, 255, 254, 3, 2, 128
+      1, 252, 253, 255, 254, 3, 2, 128, 0
+      2, 128, 0, 1, 252, 253, 255, 254, 3
+      3, 2, 128, 0, 1, 252, 253, 255, 254
+      128, 0, 1, 252, 253, 255, 254, 3, 2
+      252, 253, 255, 254, 3, 2, 128, 0, 1
+      253, 255, 254, 3, 2, 128, 0, 1, 252
+      254, 3, 2, 128, 0, 1, 252, 253, 255
+      255, 254, 3, 2, 128, 0, 1, 252, 253
+
+      * grab last column
+
+      128, 0, 3, 254, 2, 1, 252, 255, 253
+
+        and the original line has been 0
+    */
+
+    private static final byte[] FIXTURE_BWT = { (byte) 128, 0, 3, (byte) 254, 2, 1,
+                                                (byte) 252, (byte) 255, (byte) 253 };
+
+    private static final int[] FIXTURE_SORTED = {
+        0, 1, 7, 6, 8, 2, 3, 5, 4
+    };
+
+    private static final byte[] FIXTURE2 = {
+        'C', 'o', 'm', 'm', 'o', 'n', 's', ' ', 'C', 'o', 'm', 'p', 'r', 'e', 's', 's',
+    };
+
+    private static final byte[] FIXTURE2_BWT = {
+        's', 's', ' ', 'r', 'o', 'm', 'o', 'o', 'C', 'C', 'm', 'm', 'p', 'n', 's', 'e',
+    };
+
+    @Test
+    public void testSortFixture() {
+        DS ds = setUpFixture();
+        ds.s.blockSort(ds.data, FIXTURE.length - 1);
+        assertFixtureSorted(ds.data);
+        assertEquals(0, ds.data.origPtr);
+    }
+
+    @Test
+    public void testSortFixtureMainSort() {
+        DS ds = setUpFixture();
+        ds.s.mainSort(ds.data, FIXTURE.length - 1);
+        assertFixtureSorted(ds.data);
+    }
+
+    @Test
+    public void testSortFixtureFallbackSort() {
+        DS ds = setUpFixture();
+        ds.s.fallbackSort(ds.data, FIXTURE.length - 1);
+        assertFixtureSorted(ds.data);
+    }
+
+    @Test
+    public void testSortFixture2() {
+        DS ds = setUpFixture2();
+        ds.s.blockSort(ds.data, FIXTURE2.length - 1);
+        assertFixture2Sorted(ds.data);
+        assertEquals(1, ds.data.origPtr);
+    }
+
+    @Test
+    public void testSortFixture2MainSort() {
+        DS ds = setUpFixture2();
+        ds.s.mainSort(ds.data, FIXTURE2.length - 1);
+        assertFixture2Sorted(ds.data);
+    }
+
+    @Test
+    public void testSortFixture2FallbackSort() {
+        DS ds = setUpFixture2();
+        ds.s.fallbackSort(ds.data, FIXTURE2.length - 1);
+        assertFixture2Sorted(ds.data);
+    }
+
+    @Test
+    public void testFallbackSort() {
+        CBZip2OutputStream.Data data = new CBZip2OutputStream.Data(1);
+        BlockSort s = new BlockSort(data);
+        int[] fmap = new int[FIXTURE.length];
+        s.fallbackSort(fmap, FIXTURE, FIXTURE.length);
+        assertArrayEquals(FIXTURE_SORTED, fmap);
+    }
+
+    private DS setUpFixture() {
+        return setUpFixture(FIXTURE);
+    }
+
+    private void assertFixtureSorted(CBZip2OutputStream.Data data) {
+        assertFixtureSorted(data, FIXTURE, FIXTURE_BWT);
+    }
+
+    private DS setUpFixture2() {
+        return setUpFixture(FIXTURE2);
+    }
+
+    private void assertFixture2Sorted(CBZip2OutputStream.Data data) {
+        assertFixtureSorted(data, FIXTURE2, FIXTURE2_BWT);
+    }
+
+    private DS setUpFixture(byte[] fixture) {
+        CBZip2OutputStream.Data data = new CBZip2OutputStream.Data(1);
+        System.arraycopy(fixture, 0, data.block, 1, fixture.length);
+        return new DS(data, new BlockSort(data));
+    }
+
+    private void assertFixtureSorted(CBZip2OutputStream.Data data,
+                                     byte[] fixture, byte[] fixtureBwt) {
+        assertEquals(fixture[fixture.length - 1], data.block[0]);
+        for (int i = 0; i < fixture.length; i++) {
+            assertEquals(fixtureBwt[i], data.block[data.fmap[i]]);
+        }
+    }
+
+    private static class DS {
+        private final CBZip2OutputStream.Data data;
+        private final BlockSort s;
+        DS(CBZip2OutputStream.Data data, BlockSort s) {
+            this.data = data;
+            this.s = s;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/bzip2/CBZip2StreamTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/bzip2/CBZip2StreamTest.java b/src/tests/junit/org/apache/tools/bzip2/CBZip2StreamTest.java
index cc3bc46..50e0e57 100644
--- a/src/tests/junit/org/apache/tools/bzip2/CBZip2StreamTest.java
+++ b/src/tests/junit/org/apache/tools/bzip2/CBZip2StreamTest.java
@@ -1,47 +1,47 @@
-/*
- *  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.bzip2;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-import org.junit.Test;
-
-import static org.junit.Assert.fail;
-
-public class CBZip2StreamTest {
-
-    @Test
-    public void testNullPointer() throws IOException {
-        try {
-            new CBZip2InputStream(new ByteArrayInputStream(new byte[0]));
-            fail("expected an exception");
-        } catch (IOException e) {
-            // expected
-            //TODO assert exception values
-        }
-    }
-
-    @Test
-    public void testDivisionByZero() throws IOException {
-        CBZip2OutputStream cb = new CBZip2OutputStream(new ByteArrayOutputStream());
-        cb.close();
-        // expected no exception
-    }
-}
+/*
+ *  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.bzip2;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+import org.junit.Test;
+
+import static org.junit.Assert.fail;
+
+public class CBZip2StreamTest {
+
+    @Test
+    public void testNullPointer() throws IOException {
+        try {
+            new CBZip2InputStream(new ByteArrayInputStream(new byte[0]));
+            fail("expected an exception");
+        } catch (IOException e) {
+            // expected
+            //TODO assert exception values
+        }
+    }
+
+    @Test
+    public void testDivisionByZero() throws IOException {
+        CBZip2OutputStream cb = new CBZip2OutputStream(new ByteArrayOutputStream());
+        cb.close();
+        // expected no exception
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/mail/MailMessageTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/mail/MailMessageTest.java b/src/tests/junit/org/apache/tools/mail/MailMessageTest.java
index 0bad323..435729e 100644
--- a/src/tests/junit/org/apache/tools/mail/MailMessageTest.java
+++ b/src/tests/junit/org/apache/tools/mail/MailMessageTest.java
@@ -1,707 +1,707 @@
-/*
- *  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.mail;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.io.PrintStream;
-import java.net.InetAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.util.Enumeration;
-import java.util.Vector;
-
-import org.apache.tools.ant.BuildException;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.internal.AssumptionViolatedException;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-
-/**
- * JUnit testcases for org.apache.tools.mail.MailMessage.
- *
- * @since Ant 1.6
- */
-public class MailMessageTest {
-
-    // 27224 = magic (a random port which is unlikely to be in use)
-    private static int TEST_PORT = 27224;
-
-    private String local = null;
-
-    @Before
-    public void setUp() {
-        try {
-            local = InetAddress.getLocalHost().getHostName();
-        } catch (java.net.UnknownHostException uhe) {
-            // ignore
-        }
-    }
-
-    /**
-     *  Test an example that is similar to the one given in the API
-     *  If this testcase takes >90s to complete, it is very likely that
-     *  the two threads are blocked waiting for each other and Thread.join()
-     *  timed out.
-     * @throws InterruptedException 
-     */
-    @Test
-    public void testAPIExample() throws InterruptedException {
-
-        ServerThread testMailServer = new ServerThread();
-        Thread server = new Thread(testMailServer);
-        server.start();
-
-        ClientThread testMailClient = new ClientThread();
-
-        testMailClient.from("Mail Message <Em...@ant.apache.org>");
-        testMailClient.to("to@you.com");
-        testMailClient.cc("cc1@you.com");
-        testMailClient.cc("cc2@you.com");
-        testMailClient.bcc("bcc@you.com");
-        testMailClient.setSubject("Test subject");
-        testMailClient.setMessage( "test line 1\n" +
-            "test line 2" );
-
-        Thread client = new Thread(testMailClient);
-        client.start();
-
-        server.join(60 * 1000); // 60s
-        client.join(30 * 1000); // a further 30s
-
-        String result = testMailServer.getResult();
-        String expectedResult = "220 test SMTP EmailTaskTest\r\n" +
-        "HELO " + local + "\r\n" +
-        "250 " + local + " Hello " + local + " [127.0.0.1], pleased to meet you\r\n" +
-        "MAIL FROM: <Em...@ant.apache.org>\r\n" +
-        "250\r\n" +
-        "RCPT TO: <to...@you.com>\r\n" +
-        "250\r\n" +
-        "RCPT TO: <cc...@you.com>\r\n" +
-        "250\r\n" +
-        "RCPT TO: <cc...@you.com>\r\n" +
-        "250\r\n" +
-        "RCPT TO: <bc...@you.com>\r\n" +
-        "250\r\n" +
-        "DATA\r\n" +
-        "354\r\n" +
-        "Subject: Test subject\r\n" +
-        "From: Mail Message <Em...@ant.apache.org>\r\n" +
-        "To: to@you.com\r\n" +
-        "Cc: cc1@you.com, cc2@you.com\r\n" +
-        "X-Mailer: org.apache.tools.mail.MailMessage (ant.apache.org)\r\n" +
-        "\r\n" +
-        "test line 1\r\n" +
-        "test line 2\r\n" +
-        "\r\n" +
-        ".\r\n" +
-        "250\r\n" +
-        "QUIT\r\n" +
-        "221\r\n";
-        /*for (int icounter = 0; icounter<expectedResult.length(); icounter++) {
-            if (icounter < result.length()) {
-                if (expectedResult.charAt(icounter) != result.charAt(icounter)) {
-                    System.out.println("posit " + icounter + " expected "
-                        + expectedResult.charAt(icounter)
-                    + " result " + result.charAt(icounter));
-                }
-            }
-        }
-        if (expectedResult.length()>result.length()) {
-            System.out.println("excedent of expected result "
-                + expectedResult.substring(result.length()));
-        }
-        if (expectedResult.length()<result.length()) {
-            System.out.println("excedent of result "
-                + result.substring(expectedResult.length()));
-        }*/
-        assertEquals(expectedResult.length(), result.length());
-        assertEquals(expectedResult, result); // order of headers cannot be guaranteed
-        assertFalse(testMailClient.getFailMessage(), testMailClient.isFailed());
-    }
-
-    /**
-     *  Test a MailMessage with no cc or bcc lines
-     * @throws InterruptedException 
-     */
-    @Test
-    public void testToOnly() throws InterruptedException {
-        ServerThread testMailServer = new ServerThread();
-        Thread server = new Thread(testMailServer);
-        server.start();
-
-        ClientThread testMailClient = new ClientThread();
-
-        testMailClient.from("Mail Message <Em...@ant.apache.org>");
-        testMailClient.to("to@you.com");
-        testMailClient.setSubject("Test subject");
-        testMailClient.setMessage( "test line 1\n" +
-            "test line 2" );
-
-        Thread client = new Thread(testMailClient);
-        client.start();
-
-        server.join(60 * 1000); // 60s
-        client.join(30 * 1000); // a further 30s
-
-        String result = testMailServer.getResult();
-        String expectedResult = "220 test SMTP EmailTaskTest\r\n" +
-        "HELO " + local + "\r\n" +
-        "250 " + local + " Hello " + local + " [127.0.0.1], pleased to meet you\r\n" +
-        "MAIL FROM: <Em...@ant.apache.org>\r\n" +
-        "250\r\n" +
-        "RCPT TO: <to...@you.com>\r\n" +
-        "250\r\n" +
-        "DATA\r\n" +
-        "354\r\n" +
-        "Subject: Test subject\r\n" +
-            "From: Mail Message <Em...@ant.apache.org>\r\n" +
-            "To: to@you.com\r\n" +
-        "X-Mailer: org.apache.tools.mail.MailMessage (ant.apache.org)\r\n" +
-        "\r\n" +
-        "test line 1\r\n" +
-        "test line 2\r\n" +
-        "\r\n" +
-        ".\r\n" +
-        "250\r\n" +
-        "QUIT\r\n" +
-        "221\r\n";
-        assertEquals(expectedResult.length(), result.length());
-        assertEquals(expectedResult, result); // order of headers cannot be guaranteed
-        assertFalse(testMailClient.getFailMessage(), testMailClient.isFailed());
-    }
-
-
-    /**
-     *  Test a MailMessage with no to or bcc lines
-     * @throws InterruptedException 
-     */
-    @Test
-    public void testCcOnly() throws InterruptedException {
-        ServerThread testMailServer = new ServerThread();
-        Thread server = new Thread(testMailServer);
-        server.start();
-
-        ClientThread testMailClient = new ClientThread();
-
-        testMailClient.from("Mail Message <Em...@ant.apache.org>");
-        testMailClient.cc("cc@you.com");
-        testMailClient.setSubject("Test subject");
-        testMailClient.setMessage( "test line 1\n" +
-            "test line 2" );
-
-        Thread client = new Thread(testMailClient);
-        client.start();
-
-        server.join(60 * 1000); // 60s
-        client.join(30 * 1000); // a further 30s
-
-        String result = testMailServer.getResult();
-        String expectedResult = "220 test SMTP EmailTaskTest\r\n" +
-        "HELO " + local + "\r\n" +
-        "250 " + local + " Hello " + local + " [127.0.0.1], pleased to meet you\r\n" +
-        "MAIL FROM: <Em...@ant.apache.org>\r\n" +
-        "250\r\n" +
-        "RCPT TO: <cc...@you.com>\r\n" +
-        "250\r\n" +
-        "DATA\r\n" +
-        "354\r\n" +
-        "Subject: Test subject\r\n" +
-            "From: Mail Message <Em...@ant.apache.org>\r\n" +
-            "Cc: cc@you.com\r\n" +
-        "X-Mailer: org.apache.tools.mail.MailMessage (ant.apache.org)\r\n" +
-        "\r\n" +
-        "test line 1\r\n" +
-        "test line 2\r\n" +
-        "\r\n" +
-        ".\r\n" +
-        "250\r\n" +
-        "QUIT\r\n" +
-        "221\r\n";
-        assertEquals(expectedResult.length(), result.length());
-        assertEquals(expectedResult, result);
-        assertFalse(testMailClient.getFailMessage(), testMailClient.isFailed());
-    }
-
-
-    /**
-     *  Test a MailMessage with no to or cc lines
-     * @throws InterruptedException 
-     */
-    @Test
-    public void testBccOnly() throws InterruptedException {
-        ServerThread testMailServer = new ServerThread();
-        Thread server = new Thread(testMailServer);
-        server.start();
-
-        ClientThread testMailClient = new ClientThread();
-
-        testMailClient.from("Mail Message <Em...@ant.apache.org>");
-        testMailClient.bcc("bcc@you.com");
-        testMailClient.setSubject("Test subject");
-        testMailClient.setMessage( "test line 1\n" +
-            "test line 2" );
-
-        Thread client = new Thread(testMailClient);
-        client.start();
-
-        server.join(60 * 1000); // 60s
-        client.join(30 * 1000); // a further 30s
-
-        String result = testMailServer.getResult();
-        String expectedResult = "220 test SMTP EmailTaskTest\r\n" +
-        "HELO " + local + "\r\n" +
-        "250 " + local + " Hello " + local + " [127.0.0.1], pleased to meet you\r\n" +
-        "MAIL FROM: <Em...@ant.apache.org>\r\n" +
-        "250\r\n" +
-        "RCPT TO: <bc...@you.com>\r\n" +
-        "250\r\n" +
-        "DATA\r\n" +
-        "354\r\n" +
-        "Subject: Test subject\r\n" +
-        "From: Mail Message <Em...@ant.apache.org>\r\n" +
-        "X-Mailer: org.apache.tools.mail.MailMessage (ant.apache.org)\r\n" +
-        "\r\n" +
-        "test line 1\r\n" +
-        "test line 2\r\n" +
-        "\r\n" +
-        ".\r\n" +
-        "250\r\n" +
-        "QUIT\r\n" +
-        "221\r\n";
-        assertEquals( expectedResult.length(), result.length() );
-        assertEquals( expectedResult, result );
-        assertFalse(testMailClient.getFailMessage(), testMailClient.isFailed());
-    }
-
-
-    /**
-     *  Test a MailMessage with no subject line
-     *  Subject is an optional field (RFC 822 s4.1)
-     * @throws InterruptedException 
-     */
-    @Test
-    public void testNoSubject() throws InterruptedException {
-        ServerThread testMailServer = new ServerThread();
-        Thread server = new Thread(testMailServer);
-        server.start();
-
-        ClientThread testMailClient = new ClientThread();
-
-        testMailClient.from("Mail Message <Em...@ant.apache.org>");
-        testMailClient.to("to@you.com");
-        testMailClient.setMessage( "test line 1\n" +
-            "test line 2" );
-
-        Thread client = new Thread(testMailClient);
-        client.start();
-
-        server.join(60 * 1000); // 60s
-        client.join(30 * 1000); // a further 30s
-
-        String result = testMailServer.getResult();
-        String expectedResult = "220 test SMTP EmailTaskTest\r\n" +
-        "HELO " + local + "\r\n" +
-        "250 " + local + " Hello " + local + " [127.0.0.1], pleased to meet you\r\n" +
-        "MAIL FROM: <Em...@ant.apache.org>\r\n" +
-        "250\r\n" +
-        "RCPT TO: <to...@you.com>\r\n" +
-        "250\r\n" +
-        "DATA\r\n" +
-        "354\r\n" +
-        "From: Mail Message <Em...@ant.apache.org>\r\n" +
-            "To: to@you.com\r\n" +
-        "X-Mailer: org.apache.tools.mail.MailMessage (ant.apache.org)\r\n" +
-        "\r\n" +
-        "test line 1\r\n" +
-        "test line 2\r\n" +
-        "\r\n" +
-        ".\r\n" +
-        "250\r\n" +
-        "QUIT\r\n" +
-        "221\r\n";
-        assertEquals( expectedResult.length(), result.length() );
-        assertEquals( expectedResult, result );
-        assertFalse(testMailClient.getFailMessage(), testMailClient.isFailed());
-    }
-
-
-    /**
-     *  Test a MailMessage with empty body message
-     * @throws InterruptedException 
-     */
-    @Test
-    public void testEmptyBody() throws InterruptedException {
-        ServerThread testMailServer = new ServerThread();
-        Thread server = new Thread(testMailServer);
-        server.start();
-
-        ClientThread testMailClient = new ClientThread();
-
-        testMailClient.from("Mail Message <Em...@ant.apache.org>");
-        testMailClient.to("to@you.com");
-        testMailClient.setSubject("Test subject");
-        testMailClient.setMessage("");
-
-        Thread client = new Thread(testMailClient);
-        client.start();
-
-        server.join(60 * 1000); // 60s
-        client.join(30 * 1000); // a further 30s
-
-        String result = testMailServer.getResult();
-        String expectedResult = "220 test SMTP EmailTaskTest\r\n" +
-        "HELO " + local + "\r\n" +
-        "250 " + local + " Hello " + local + " [127.0.0.1], pleased to meet you\r\n" +
-        "MAIL FROM: <Em...@ant.apache.org>\r\n" +
-        "250\r\n" +
-        "RCPT TO: <to...@you.com>\r\n" +
-        "250\r\n" +
-        "DATA\r\n" +
-        "354\r\n" +
-        "Subject: Test subject\r\n" +
-            "From: Mail Message <Em...@ant.apache.org>\r\n" +
-            "To: to@you.com\r\n" +
-        "X-Mailer: org.apache.tools.mail.MailMessage (ant.apache.org)\r\n" +
-        "\r\n" +
-        "\r\n" +
-        "\r\n" +
-        ".\r\n" +
-        "250\r\n" +
-        "QUIT\r\n" +
-        "221\r\n";
-        assertEquals(expectedResult.length(), result.length());
-        assertEquals(expectedResult, result);
-        assertFalse(testMailClient.getFailMessage(), testMailClient.isFailed());
-    }
-
-
-    /**
-     *  Test a MailMessage with US-ASCII character set
-     *  The next four testcase can be kinda hard to debug as Ant will often
-     *  print the junit failure in US-ASCII.
-     * @throws InterruptedException 
-     */
-    @Test
-    public void testAsciiCharset() throws InterruptedException {
-
-        ServerThread testMailServer = new ServerThread();
-        Thread server = new Thread(testMailServer);
-        server.start();
-
-        ClientThread testMailClient = new ClientThread();
-
-        testMailClient.from("Mail Message <Em...@ant.apache.org>");
-        testMailClient.to("Ceki G\u00fclc\u00fc <ab...@mail-abuse.org>");
-        testMailClient.setSubject("Test subject");
-        testMailClient.setMessage("");
-
-        Thread client = new Thread(testMailClient);
-        client.start();
-
-        server.join(60 * 1000); // 60s
-        client.join(30 * 1000); // a further 30s
-
-        String result = testMailServer.getResult();
-        String expectedResult = "220 test SMTP EmailTaskTest\r\n" +
-        "HELO " + local + "\r\n" +
-        "250 " + local + " Hello " + local + " [127.0.0.1], pleased to meet you\r\n" +
-        "MAIL FROM: <Em...@ant.apache.org>\r\n" +
-        "250\r\n" +
-        "RCPT TO: <ab...@mail-abuse.org>\r\n" +
-        "250\r\n" +
-        "DATA\r\n" +
-        "354\r\n" +
-        "Subject: Test subject\r\n" +
-            "From: Mail Message <Em...@ant.apache.org>\r\n" +
-            "To: Ceki G\u00fclc\u00fc <ab...@mail-abuse.org>\r\n" +
-        "X-Mailer: org.apache.tools.mail.MailMessage (ant.apache.org)\r\n" +
-        "\r\n" +
-        "\r\n" +
-        "\r\n" +
-        ".\r\n" +
-        "250\r\n" +
-        "QUIT\r\n" +
-        "221\r\n";
-        ByteArrayOutputStream baos1 = new ByteArrayOutputStream();
-        ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
-        PrintStream bos1 = new PrintStream(baos1, true);
-        PrintStream bos2 = new PrintStream(baos2, true);
-
-        bos1.print(expectedResult);
-        bos2.print(result);
-
-        assertEquals( "expected message length != actual message length "
-            + "in testAsciiCharset()", expectedResult.length(), result.length() );
-        assertEquals( "baos1 and baos2 should be the same in testAsciiCharset()",
-            baos1.toString(), baos2.toString() ); // order of headers cannot be guaranteed
-        assertFalse(testMailClient.getFailMessage(), testMailClient.isFailed());
-    }
-
-
-
-
-    /**
-     * A private test class that pretends to be a mail transfer agent
-     */
-    private class ServerThread implements Runnable {
-
-        private StringBuffer sb = null;
-        private boolean loop = false;
-        ServerSocket ssock = null;
-        Socket sock = null;
-        BufferedWriter out = null;
-        BufferedReader in = null;
-        private boolean data = false;  // state engine: false=envelope, true=message
-
-        public void run() {
-
-            try {
-                ssock = new ServerSocket(TEST_PORT);
-                sock = ssock.accept(); // wait for connection
-                in = new BufferedReader( new InputStreamReader(
-                    sock.getInputStream()) );
-                out = new BufferedWriter( new OutputStreamWriter(
-                    sock.getOutputStream() ) );
-                sb = new StringBuffer();
-                send( "220 test SMTP EmailTaskTest\r\n" );
-                loop = true;
-                while ( loop ) {
-                    String response = in.readLine();
-                    if ( response == null ) {
-                        loop = false;
-                        break;
-                    }
-                    sb.append( response + "\r\n" );
-
-                    if ( !data && response.startsWith( "HELO" ) ) {
-                        send( "250 " + local + " Hello " + local + " " +
-                        "[127.0.0.1], pleased to meet you\r\n" );
-                    } else if ( !data && response.startsWith("MAIL") ) {
-                        send( "250\r\n" );
-                    } else if ( !data && response.startsWith("RCPT")) {
-                        send( "250\r\n" );
-                    } else if (!data && response.startsWith("DATA")) {
-                        send( "354\r\n" );
-                        data = true;
-                    } else if (data && response.equals(".") ) {
-                        send( "250\r\n" );
-                        data = false;
-                    } else if (!data && response.startsWith("QUIT")) {
-                        send( "221\r\n" );
-                        loop = false;
-                    } else if (!data) {
-                        //throw new IllegalStateException("Command unrecognized: "
-                        //    + response);
-                        send( "500 5.5.1 Command unrecognized: \"" +
-                            response + "\"\r\n" );
-                        loop = false;
-                    } else {
-                        // sb.append( response + "\r\n" );
-                    }
-
-                } // while
-            } catch (IOException ioe) {
-                throw new BuildException(ioe);
-            } finally {
-                disconnect();
-            }
-        }
-
-        private void send(String retmsg) throws IOException {
-            out.write( retmsg );
-            out.flush();
-            sb.append( retmsg );
-        }
-
-        private void disconnect() {
-            if (out != null) {
-                try {
-                    out.flush();
-                    out.close();
-                    out = null;
-                } catch (IOException e) {
-                    // ignore
-                }
-            }
-            if (in != null) {
-                try {
-                    in.close();
-                    in = null;
-                } catch (IOException e) {
-                    // ignore
-                }
-            }
-            if (sock != null) {
-                try {
-                    sock.close();
-                    sock = null;
-                } catch (IOException e) {
-                    // ignore
-                }
-            }
-            if (ssock != null) {
-                try {
-                    ssock.close();
-                    ssock = null;
-                } catch (IOException e) {
-                    // ignore
-                }
-            }
-        }
-
-        public synchronized String getResult() {
-            loop = false;
-            return sb.toString();
-        }
-
-    }
-
-    /**
-     *  A private test class that wraps MailMessage
-     */
-    private class ClientThread implements Runnable {
-
-        private MailMessage msg;
-        private boolean fail = false;
-        private String failMessage = null;
-
-        protected String from = null;
-        protected String subject = null;
-        protected String message = null;
-
-        protected Vector replyToList = new Vector();
-        protected Vector toList = new Vector();
-        protected Vector ccList = new Vector();
-        protected Vector bccList = new Vector();
-
-
-        public void run() {
-            for (int i = 9; i > 0; i--) {
-                try {
-                    msg = new MailMessage("localhost", TEST_PORT);
-                } catch (java.net.ConnectException ce) {
-                    try {
-                        Thread.sleep(10 * 1000);
-                    } catch (InterruptedException ie) {
-                        throw new AssumptionViolatedException("Thread interrupted", ie);
-                    }
-                } catch (IOException ioe) {
-                    fail = true;
-                    failMessage = "IOException: " + ioe;
-                    return;
-                }
-                if (msg != null) {
-                    break;
-                }
-            }
-
-            if (msg == null) {
-                fail = true;
-                failMessage = "java.net.ConnectException: Connection refused";
-                return;
-            }
-
-            try {
-                msg.from(from);
-
-                Enumeration e;
-
-                e = replyToList.elements();
-                while (e.hasMoreElements()) {
-                    msg.replyto(e.nextElement().toString());
-                }
-
-                e = toList.elements();
-                while (e.hasMoreElements()) {
-                    msg.to(e.nextElement().toString());
-                }
-
-                e = ccList.elements();
-                while (e.hasMoreElements()) {
-                    msg.cc(e.nextElement().toString());
-                }
-
-                e = bccList.elements();
-                while (e.hasMoreElements()) {
-                    msg.bcc(e.nextElement().toString());
-                }
-
-                if (subject != null) {
-                    msg.setSubject(subject);
-                }
-
-                if (message != null ) {
-                    PrintStream out = msg.getPrintStream();
-                    out.println( message );
-                }
-
-                msg.sendAndClose();
-            } catch (IOException ioe) {
-                fail = true;
-                failMessage = "IOException: " + ioe;
-                return;
-            }
-        }
-
-        public boolean isFailed() {
-            return fail;
-        }
-
-        public String getFailMessage() {
-            return failMessage;
-        }
-
-        public void replyTo(String replyTo) {
-            replyToList.add(replyTo);
-        }
-
-        public void to(String to) {
-            toList.add(to);
-        }
-
-        public void cc(String cc) {
-            ccList.add(cc);
-        }
-
-        public void bcc(String bcc) {
-            bccList.add(bcc);
-        }
-
-        public void setSubject(String subject) {
-            this.subject = subject;
-        }
-
-        public void from(String from) {
-            this.from = from;
-        }
-
-        public void setMessage(String message) {
-            this.message = message;
-        }
-
-    }
-
-}
+/*
+ *  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.mail;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PrintStream;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.util.Enumeration;
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.internal.AssumptionViolatedException;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
+/**
+ * JUnit testcases for org.apache.tools.mail.MailMessage.
+ *
+ * @since Ant 1.6
+ */
+public class MailMessageTest {
+
+    // 27224 = magic (a random port which is unlikely to be in use)
+    private static int TEST_PORT = 27224;
+
+    private String local = null;
+
+    @Before
+    public void setUp() {
+        try {
+            local = InetAddress.getLocalHost().getHostName();
+        } catch (java.net.UnknownHostException uhe) {
+            // ignore
+        }
+    }
+
+    /**
+     *  Test an example that is similar to the one given in the API
+     *  If this testcase takes >90s to complete, it is very likely that
+     *  the two threads are blocked waiting for each other and Thread.join()
+     *  timed out.
+     * @throws InterruptedException
+     */
+    @Test
+    public void testAPIExample() throws InterruptedException {
+
+        ServerThread testMailServer = new ServerThread();
+        Thread server = new Thread(testMailServer);
+        server.start();
+
+        ClientThread testMailClient = new ClientThread();
+
+        testMailClient.from("Mail Message <Em...@ant.apache.org>");
+        testMailClient.to("to@you.com");
+        testMailClient.cc("cc1@you.com");
+        testMailClient.cc("cc2@you.com");
+        testMailClient.bcc("bcc@you.com");
+        testMailClient.setSubject("Test subject");
+        testMailClient.setMessage( "test line 1\n" +
+            "test line 2" );
+
+        Thread client = new Thread(testMailClient);
+        client.start();
+
+        server.join(60 * 1000); // 60s
+        client.join(30 * 1000); // a further 30s
+
+        String result = testMailServer.getResult();
+        String expectedResult = "220 test SMTP EmailTaskTest\r\n" +
+        "HELO " + local + "\r\n" +
+        "250 " + local + " Hello " + local + " [127.0.0.1], pleased to meet you\r\n" +
+        "MAIL FROM: <Em...@ant.apache.org>\r\n" +
+        "250\r\n" +
+        "RCPT TO: <to...@you.com>\r\n" +
+        "250\r\n" +
+        "RCPT TO: <cc...@you.com>\r\n" +
+        "250\r\n" +
+        "RCPT TO: <cc...@you.com>\r\n" +
+        "250\r\n" +
+        "RCPT TO: <bc...@you.com>\r\n" +
+        "250\r\n" +
+        "DATA\r\n" +
+        "354\r\n" +
+        "Subject: Test subject\r\n" +
+        "From: Mail Message <Em...@ant.apache.org>\r\n" +
+        "To: to@you.com\r\n" +
+        "Cc: cc1@you.com, cc2@you.com\r\n" +
+        "X-Mailer: org.apache.tools.mail.MailMessage (ant.apache.org)\r\n" +
+        "\r\n" +
+        "test line 1\r\n" +
+        "test line 2\r\n" +
+        "\r\n" +
+        ".\r\n" +
+        "250\r\n" +
+        "QUIT\r\n" +
+        "221\r\n";
+        /*for (int icounter = 0; icounter<expectedResult.length(); icounter++) {
+            if (icounter < result.length()) {
+                if (expectedResult.charAt(icounter) != result.charAt(icounter)) {
+                    System.out.println("posit " + icounter + " expected "
+                        + expectedResult.charAt(icounter)
+                    + " result " + result.charAt(icounter));
+                }
+            }
+        }
+        if (expectedResult.length()>result.length()) {
+            System.out.println("excedent of expected result "
+                + expectedResult.substring(result.length()));
+        }
+        if (expectedResult.length()<result.length()) {
+            System.out.println("excedent of result "
+                + result.substring(expectedResult.length()));
+        }*/
+        assertEquals(expectedResult.length(), result.length());
+        assertEquals(expectedResult, result); // order of headers cannot be guaranteed
+        assertFalse(testMailClient.getFailMessage(), testMailClient.isFailed());
+    }
+
+    /**
+     *  Test a MailMessage with no cc or bcc lines
+     * @throws InterruptedException
+     */
+    @Test
+    public void testToOnly() throws InterruptedException {
+        ServerThread testMailServer = new ServerThread();
+        Thread server = new Thread(testMailServer);
+        server.start();
+
+        ClientThread testMailClient = new ClientThread();
+
+        testMailClient.from("Mail Message <Em...@ant.apache.org>");
+        testMailClient.to("to@you.com");
+        testMailClient.setSubject("Test subject");
+        testMailClient.setMessage( "test line 1\n" +
+            "test line 2" );
+
+        Thread client = new Thread(testMailClient);
+        client.start();
+
+        server.join(60 * 1000); // 60s
+        client.join(30 * 1000); // a further 30s
+
+        String result = testMailServer.getResult();
+        String expectedResult = "220 test SMTP EmailTaskTest\r\n" +
+        "HELO " + local + "\r\n" +
+        "250 " + local + " Hello " + local + " [127.0.0.1], pleased to meet you\r\n" +
+        "MAIL FROM: <Em...@ant.apache.org>\r\n" +
+        "250\r\n" +
+        "RCPT TO: <to...@you.com>\r\n" +
+        "250\r\n" +
+        "DATA\r\n" +
+        "354\r\n" +
+        "Subject: Test subject\r\n" +
+            "From: Mail Message <Em...@ant.apache.org>\r\n" +
+            "To: to@you.com\r\n" +
+        "X-Mailer: org.apache.tools.mail.MailMessage (ant.apache.org)\r\n" +
+        "\r\n" +
+        "test line 1\r\n" +
+        "test line 2\r\n" +
+        "\r\n" +
+        ".\r\n" +
+        "250\r\n" +
+        "QUIT\r\n" +
+        "221\r\n";
+        assertEquals(expectedResult.length(), result.length());
+        assertEquals(expectedResult, result); // order of headers cannot be guaranteed
+        assertFalse(testMailClient.getFailMessage(), testMailClient.isFailed());
+    }
+
+
+    /**
+     *  Test a MailMessage with no to or bcc lines
+     * @throws InterruptedException
+     */
+    @Test
+    public void testCcOnly() throws InterruptedException {
+        ServerThread testMailServer = new ServerThread();
+        Thread server = new Thread(testMailServer);
+        server.start();
+
+        ClientThread testMailClient = new ClientThread();
+
+        testMailClient.from("Mail Message <Em...@ant.apache.org>");
+        testMailClient.cc("cc@you.com");
+        testMailClient.setSubject("Test subject");
+        testMailClient.setMessage( "test line 1\n" +
+            "test line 2" );
+
+        Thread client = new Thread(testMailClient);
+        client.start();
+
+        server.join(60 * 1000); // 60s
+        client.join(30 * 1000); // a further 30s
+
+        String result = testMailServer.getResult();
+        String expectedResult = "220 test SMTP EmailTaskTest\r\n" +
+        "HELO " + local + "\r\n" +
+        "250 " + local + " Hello " + local + " [127.0.0.1], pleased to meet you\r\n" +
+        "MAIL FROM: <Em...@ant.apache.org>\r\n" +
+        "250\r\n" +
+        "RCPT TO: <cc...@you.com>\r\n" +
+        "250\r\n" +
+        "DATA\r\n" +
+        "354\r\n" +
+        "Subject: Test subject\r\n" +
+            "From: Mail Message <Em...@ant.apache.org>\r\n" +
+            "Cc: cc@you.com\r\n" +
+        "X-Mailer: org.apache.tools.mail.MailMessage (ant.apache.org)\r\n" +
+        "\r\n" +
+        "test line 1\r\n" +
+        "test line 2\r\n" +
+        "\r\n" +
+        ".\r\n" +
+        "250\r\n" +
+        "QUIT\r\n" +
+        "221\r\n";
+        assertEquals(expectedResult.length(), result.length());
+        assertEquals(expectedResult, result);
+        assertFalse(testMailClient.getFailMessage(), testMailClient.isFailed());
+    }
+
+
+    /**
+     *  Test a MailMessage with no to or cc lines
+     * @throws InterruptedException
+     */
+    @Test
+    public void testBccOnly() throws InterruptedException {
+        ServerThread testMailServer = new ServerThread();
+        Thread server = new Thread(testMailServer);
+        server.start();
+
+        ClientThread testMailClient = new ClientThread();
+
+        testMailClient.from("Mail Message <Em...@ant.apache.org>");
+        testMailClient.bcc("bcc@you.com");
+        testMailClient.setSubject("Test subject");
+        testMailClient.setMessage( "test line 1\n" +
+            "test line 2" );
+
+        Thread client = new Thread(testMailClient);
+        client.start();
+
+        server.join(60 * 1000); // 60s
+        client.join(30 * 1000); // a further 30s
+
+        String result = testMailServer.getResult();
+        String expectedResult = "220 test SMTP EmailTaskTest\r\n" +
+        "HELO " + local + "\r\n" +
+        "250 " + local + " Hello " + local + " [127.0.0.1], pleased to meet you\r\n" +
+        "MAIL FROM: <Em...@ant.apache.org>\r\n" +
+        "250\r\n" +
+        "RCPT TO: <bc...@you.com>\r\n" +
+        "250\r\n" +
+        "DATA\r\n" +
+        "354\r\n" +
+        "Subject: Test subject\r\n" +
+        "From: Mail Message <Em...@ant.apache.org>\r\n" +
+        "X-Mailer: org.apache.tools.mail.MailMessage (ant.apache.org)\r\n" +
+        "\r\n" +
+        "test line 1\r\n" +
+        "test line 2\r\n" +
+        "\r\n" +
+        ".\r\n" +
+        "250\r\n" +
+        "QUIT\r\n" +
+        "221\r\n";
+        assertEquals( expectedResult.length(), result.length() );
+        assertEquals( expectedResult, result );
+        assertFalse(testMailClient.getFailMessage(), testMailClient.isFailed());
+    }
+
+
+    /**
+     *  Test a MailMessage with no subject line
+     *  Subject is an optional field (RFC 822 s4.1)
+     * @throws InterruptedException
+     */
+    @Test
+    public void testNoSubject() throws InterruptedException {
+        ServerThread testMailServer = new ServerThread();
+        Thread server = new Thread(testMailServer);
+        server.start();
+
+        ClientThread testMailClient = new ClientThread();
+
+        testMailClient.from("Mail Message <Em...@ant.apache.org>");
+        testMailClient.to("to@you.com");
+        testMailClient.setMessage( "test line 1\n" +
+            "test line 2" );
+
+        Thread client = new Thread(testMailClient);
+        client.start();
+
+        server.join(60 * 1000); // 60s
+        client.join(30 * 1000); // a further 30s
+
+        String result = testMailServer.getResult();
+        String expectedResult = "220 test SMTP EmailTaskTest\r\n" +
+        "HELO " + local + "\r\n" +
+        "250 " + local + " Hello " + local + " [127.0.0.1], pleased to meet you\r\n" +
+        "MAIL FROM: <Em...@ant.apache.org>\r\n" +
+        "250\r\n" +
+        "RCPT TO: <to...@you.com>\r\n" +
+        "250\r\n" +
+        "DATA\r\n" +
+        "354\r\n" +
+        "From: Mail Message <Em...@ant.apache.org>\r\n" +
+            "To: to@you.com\r\n" +
+        "X-Mailer: org.apache.tools.mail.MailMessage (ant.apache.org)\r\n" +
+        "\r\n" +
+        "test line 1\r\n" +
+        "test line 2\r\n" +
+        "\r\n" +
+        ".\r\n" +
+        "250\r\n" +
+        "QUIT\r\n" +
+        "221\r\n";
+        assertEquals( expectedResult.length(), result.length() );
+        assertEquals( expectedResult, result );
+        assertFalse(testMailClient.getFailMessage(), testMailClient.isFailed());
+    }
+
+
+    /**
+     *  Test a MailMessage with empty body message
+     * @throws InterruptedException
+     */
+    @Test
+    public void testEmptyBody() throws InterruptedException {
+        ServerThread testMailServer = new ServerThread();
+        Thread server = new Thread(testMailServer);
+        server.start();
+
+        ClientThread testMailClient = new ClientThread();
+
+        testMailClient.from("Mail Message <Em...@ant.apache.org>");
+        testMailClient.to("to@you.com");
+        testMailClient.setSubject("Test subject");
+        testMailClient.setMessage("");
+
+        Thread client = new Thread(testMailClient);
+        client.start();
+
+        server.join(60 * 1000); // 60s
+        client.join(30 * 1000); // a further 30s
+
+        String result = testMailServer.getResult();
+        String expectedResult = "220 test SMTP EmailTaskTest\r\n" +
+        "HELO " + local + "\r\n" +
+        "250 " + local + " Hello " + local + " [127.0.0.1], pleased to meet you\r\n" +
+        "MAIL FROM: <Em...@ant.apache.org>\r\n" +
+        "250\r\n" +
+        "RCPT TO: <to...@you.com>\r\n" +
+        "250\r\n" +
+        "DATA\r\n" +
+        "354\r\n" +
+        "Subject: Test subject\r\n" +
+            "From: Mail Message <Em...@ant.apache.org>\r\n" +
+            "To: to@you.com\r\n" +
+        "X-Mailer: org.apache.tools.mail.MailMessage (ant.apache.org)\r\n" +
+        "\r\n" +
+        "\r\n" +
+        "\r\n" +
+        ".\r\n" +
+        "250\r\n" +
+        "QUIT\r\n" +
+        "221\r\n";
+        assertEquals(expectedResult.length(), result.length());
+        assertEquals(expectedResult, result);
+        assertFalse(testMailClient.getFailMessage(), testMailClient.isFailed());
+    }
+
+
+    /**
+     *  Test a MailMessage with US-ASCII character set
+     *  The next four testcase can be kinda hard to debug as Ant will often
+     *  print the junit failure in US-ASCII.
+     * @throws InterruptedException
+     */
+    @Test
+    public void testAsciiCharset() throws InterruptedException {
+
+        ServerThread testMailServer = new ServerThread();
+        Thread server = new Thread(testMailServer);
+        server.start();
+
+        ClientThread testMailClient = new ClientThread();
+
+        testMailClient.from("Mail Message <Em...@ant.apache.org>");
+        testMailClient.to("Ceki G\u00fclc\u00fc <ab...@mail-abuse.org>");
+        testMailClient.setSubject("Test subject");
+        testMailClient.setMessage("");
+
+        Thread client = new Thread(testMailClient);
+        client.start();
+
+        server.join(60 * 1000); // 60s
+        client.join(30 * 1000); // a further 30s
+
+        String result = testMailServer.getResult();
+        String expectedResult = "220 test SMTP EmailTaskTest\r\n" +
+        "HELO " + local + "\r\n" +
+        "250 " + local + " Hello " + local + " [127.0.0.1], pleased to meet you\r\n" +
+        "MAIL FROM: <Em...@ant.apache.org>\r\n" +
+        "250\r\n" +
+        "RCPT TO: <ab...@mail-abuse.org>\r\n" +
+        "250\r\n" +
+        "DATA\r\n" +
+        "354\r\n" +
+        "Subject: Test subject\r\n" +
+            "From: Mail Message <Em...@ant.apache.org>\r\n" +
+            "To: Ceki G\u00fclc\u00fc <ab...@mail-abuse.org>\r\n" +
+        "X-Mailer: org.apache.tools.mail.MailMessage (ant.apache.org)\r\n" +
+        "\r\n" +
+        "\r\n" +
+        "\r\n" +
+        ".\r\n" +
+        "250\r\n" +
+        "QUIT\r\n" +
+        "221\r\n";
+        ByteArrayOutputStream baos1 = new ByteArrayOutputStream();
+        ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
+        PrintStream bos1 = new PrintStream(baos1, true);
+        PrintStream bos2 = new PrintStream(baos2, true);
+
+        bos1.print(expectedResult);
+        bos2.print(result);
+
+        assertEquals( "expected message length != actual message length "
+            + "in testAsciiCharset()", expectedResult.length(), result.length() );
+        assertEquals( "baos1 and baos2 should be the same in testAsciiCharset()",
+            baos1.toString(), baos2.toString() ); // order of headers cannot be guaranteed
+        assertFalse(testMailClient.getFailMessage(), testMailClient.isFailed());
+    }
+
+
+
+
+    /**
+     * A private test class that pretends to be a mail transfer agent
+     */
+    private class ServerThread implements Runnable {
+
+        private StringBuffer sb = null;
+        private boolean loop = false;
+        ServerSocket ssock = null;
+        Socket sock = null;
+        BufferedWriter out = null;
+        BufferedReader in = null;
+        private boolean data = false;  // state engine: false=envelope, true=message
+
+        public void run() {
+
+            try {
+                ssock = new ServerSocket(TEST_PORT);
+                sock = ssock.accept(); // wait for connection
+                in = new BufferedReader( new InputStreamReader(
+                    sock.getInputStream()) );
+                out = new BufferedWriter( new OutputStreamWriter(
+                    sock.getOutputStream() ) );
+                sb = new StringBuffer();
+                send( "220 test SMTP EmailTaskTest\r\n" );
+                loop = true;
+                while ( loop ) {
+                    String response = in.readLine();
+                    if ( response == null ) {
+                        loop = false;
+                        break;
+                    }
+                    sb.append( response + "\r\n" );
+
+                    if ( !data && response.startsWith( "HELO" ) ) {
+                        send( "250 " + local + " Hello " + local + " " +
+                        "[127.0.0.1], pleased to meet you\r\n" );
+                    } else if ( !data && response.startsWith("MAIL") ) {
+                        send( "250\r\n" );
+                    } else if ( !data && response.startsWith("RCPT")) {
+                        send( "250\r\n" );
+                    } else if (!data && response.startsWith("DATA")) {
+                        send( "354\r\n" );
+                        data = true;
+                    } else if (data && response.equals(".") ) {
+                        send( "250\r\n" );
+                        data = false;
+                    } else if (!data && response.startsWith("QUIT")) {
+                        send( "221\r\n" );
+                        loop = false;
+                    } else if (!data) {
+                        //throw new IllegalStateException("Command unrecognized: "
+                        //    + response);
+                        send( "500 5.5.1 Command unrecognized: \"" +
+                            response + "\"\r\n" );
+                        loop = false;
+                    } else {
+                        // sb.append( response + "\r\n" );
+                    }
+
+                } // while
+            } catch (IOException ioe) {
+                throw new BuildException(ioe);
+            } finally {
+                disconnect();
+            }
+        }
+
+        private void send(String retmsg) throws IOException {
+            out.write( retmsg );
+            out.flush();
+            sb.append( retmsg );
+        }
+
+        private void disconnect() {
+            if (out != null) {
+                try {
+                    out.flush();
+                    out.close();
+                    out = null;
+                } catch (IOException e) {
+                    // ignore
+                }
+            }
+            if (in != null) {
+                try {
+                    in.close();
+                    in = null;
+                } catch (IOException e) {
+                    // ignore
+                }
+            }
+            if (sock != null) {
+                try {
+                    sock.close();
+                    sock = null;
+                } catch (IOException e) {
+                    // ignore
+                }
+            }
+            if (ssock != null) {
+                try {
+                    ssock.close();
+                    ssock = null;
+                } catch (IOException e) {
+                    // ignore
+                }
+            }
+        }
+
+        public synchronized String getResult() {
+            loop = false;
+            return sb.toString();
+        }
+
+    }
+
+    /**
+     *  A private test class that wraps MailMessage
+     */
+    private class ClientThread implements Runnable {
+
+        private MailMessage msg;
+        private boolean fail = false;
+        private String failMessage = null;
+
+        protected String from = null;
+        protected String subject = null;
+        protected String message = null;
+
+        protected Vector replyToList = new Vector();
+        protected Vector toList = new Vector();
+        protected Vector ccList = new Vector();
+        protected Vector bccList = new Vector();
+
+
+        public void run() {
+            for (int i = 9; i > 0; i--) {
+                try {
+                    msg = new MailMessage("localhost", TEST_PORT);
+                } catch (java.net.ConnectException ce) {
+                    try {
+                        Thread.sleep(10 * 1000);
+                    } catch (InterruptedException ie) {
+                        throw new AssumptionViolatedException("Thread interrupted", ie);
+                    }
+                } catch (IOException ioe) {
+                    fail = true;
+                    failMessage = "IOException: " + ioe;
+                    return;
+                }
+                if (msg != null) {
+                    break;
+                }
+            }
+
+            if (msg == null) {
+                fail = true;
+                failMessage = "java.net.ConnectException: Connection refused";
+                return;
+            }
+
+            try {
+                msg.from(from);
+
+                Enumeration e;
+
+                e = replyToList.elements();
+                while (e.hasMoreElements()) {
+                    msg.replyto(e.nextElement().toString());
+                }
+
+                e = toList.elements();
+                while (e.hasMoreElements()) {
+                    msg.to(e.nextElement().toString());
+                }
+
+                e = ccList.elements();
+                while (e.hasMoreElements()) {
+                    msg.cc(e.nextElement().toString());
+                }
+
+                e = bccList.elements();
+                while (e.hasMoreElements()) {
+                    msg.bcc(e.nextElement().toString());
+                }
+
+                if (subject != null) {
+                    msg.setSubject(subject);
+                }
+
+                if (message != null ) {
+                    PrintStream out = msg.getPrintStream();
+                    out.println( message );
+                }
+
+                msg.sendAndClose();
+            } catch (IOException ioe) {
+                fail = true;
+                failMessage = "IOException: " + ioe;
+                return;
+            }
+        }
+
+        public boolean isFailed() {
+            return fail;
+        }
+
+        public String getFailMessage() {
+            return failMessage;
+        }
+
+        public void replyTo(String replyTo) {
+            replyToList.add(replyTo);
+        }
+
+        public void to(String to) {
+            toList.add(to);
+        }
+
+        public void cc(String cc) {
+            ccList.add(cc);
+        }
+
+        public void bcc(String bcc) {
+            bccList.add(bcc);
+        }
+
+        public void setSubject(String subject) {
+            this.subject = subject;
+        }
+
+        public void from(String from) {
+            this.from = from;
+        }
+
+        public void setMessage(String message) {
+            this.message = message;
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/tar/TarEntryTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/tar/TarEntryTest.java b/src/tests/junit/org/apache/tools/tar/TarEntryTest.java
index 4c14943..e942cdb 100644
--- a/src/tests/junit/org/apache/tools/tar/TarEntryTest.java
+++ b/src/tests/junit/org/apache/tools/tar/TarEntryTest.java
@@ -1,35 +1,35 @@
-/*
- *  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.tar;
-
-import org.junit.Test;
-
-/**
- * @since Ant 1.6
- */
-public class TarEntryTest {
-
-    /**
-     * demonstrates bug 18105 on OSes with os.name shorter than 7.
-     */
-    @Test
-    public void testFileConstructor() {
-        new TarEntry(new java.io.File("/foo"));
-    }
-}
+/*
+ *  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.tar;
+
+import org.junit.Test;
+
+/**
+ * @since Ant 1.6
+ */
+public class TarEntryTest {
+
+    /**
+     * demonstrates bug 18105 on OSes with os.name shorter than 7.
+     */
+    @Test
+    public void testFileConstructor() {
+        new TarEntry(new java.io.File("/foo"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/tar/TarOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/tar/TarOutputStreamTest.java b/src/tests/junit/org/apache/tools/tar/TarOutputStreamTest.java
index fd43c35..cb65e2d 100644
--- a/src/tests/junit/org/apache/tools/tar/TarOutputStreamTest.java
+++ b/src/tests/junit/org/apache/tools/tar/TarOutputStreamTest.java
@@ -1,35 +1,35 @@
-/*
- *  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.tar;
-
-import org.junit.Test;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-public class TarOutputStreamTest {
-
-    @Test
-    public void testClose() throws IOException {
-        ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
-        TarOutputStream stream = new TarOutputStream(byteStream);
-        stream.close();
-        stream.close();
-    }
-}
+/*
+ *  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.tar;
+
+import org.junit.Test;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+public class TarOutputStreamTest {
+
+    @Test
+    public void testClose() throws IOException {
+        ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
+        TarOutputStream stream = new TarOutputStream(byteStream);
+        stream.close();
+        stream.close();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/tar/TarRoundTripTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/tar/TarRoundTripTest.java b/src/tests/junit/org/apache/tools/tar/TarRoundTripTest.java
index 64b79c8..3caba34 100644
--- a/src/tests/junit/org/apache/tools/tar/TarRoundTripTest.java
+++ b/src/tests/junit/org/apache/tools/tar/TarRoundTripTest.java
@@ -1,74 +1,72 @@
-/*
- *  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.tar;
-
-import org.junit.Test;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-public class TarRoundTripTest {
-
-    private static final String LONG_NAME
-        = "this/path/name/contains/more/than/one/hundred/characters/in/order/"
-            + "to/test/the/GNU/long/file/name/capability/round/tripped";
-
-    /**
-     * test round-tripping long (GNU) entries
-     */
-    @Test
-    public void testLongRoundTrippingGNU() throws IOException {
-        testLongRoundTripping(TarOutputStream.LONGFILE_GNU);
-    }
-
-    /**
-     * test round-tripping long (POSIX) entries
-     */
-    @Test
-    public void testLongRoundTrippingPOSIX() throws IOException {
-        testLongRoundTripping(TarOutputStream.LONGFILE_POSIX);
-    }
-
-    private void testLongRoundTripping(int mode) throws IOException {
-        TarEntry original = new TarEntry(LONG_NAME);
-        assertTrue("over 100 chars", LONG_NAME.length() > 100);
-        assertEquals("original name", LONG_NAME, original.getName());
-
-
-        ByteArrayOutputStream buff = new ByteArrayOutputStream();
-        TarOutputStream tos = new TarOutputStream(buff);
-        tos.setLongFileMode(mode);
-        tos.putNextEntry(original);
-        tos.closeEntry();
-        tos.close();
-
-        TarInputStream tis
-            = new TarInputStream(new ByteArrayInputStream(buff.toByteArray()));
-        TarEntry tripped = tis.getNextEntry();
-        assertEquals("round-tripped name", LONG_NAME, tripped.getName());
-        assertNull("no more entries", tis.getNextEntry());
-        tis.close();
-    }
-}
-
-
+/*
+ *  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.tar;
+
+import org.junit.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+public class TarRoundTripTest {
+
+    private static final String LONG_NAME
+        = "this/path/name/contains/more/than/one/hundred/characters/in/order/"
+            + "to/test/the/GNU/long/file/name/capability/round/tripped";
+
+    /**
+     * test round-tripping long (GNU) entries
+     */
+    @Test
+    public void testLongRoundTrippingGNU() throws IOException {
+        testLongRoundTripping(TarOutputStream.LONGFILE_GNU);
+    }
+
+    /**
+     * test round-tripping long (POSIX) entries
+     */
+    @Test
+    public void testLongRoundTrippingPOSIX() throws IOException {
+        testLongRoundTripping(TarOutputStream.LONGFILE_POSIX);
+    }
+
+    private void testLongRoundTripping(int mode) throws IOException {
+        TarEntry original = new TarEntry(LONG_NAME);
+        assertTrue("over 100 chars", LONG_NAME.length() > 100);
+        assertEquals("original name", LONG_NAME, original.getName());
+
+
+        ByteArrayOutputStream buff = new ByteArrayOutputStream();
+        TarOutputStream tos = new TarOutputStream(buff);
+        tos.setLongFileMode(mode);
+        tos.putNextEntry(original);
+        tos.closeEntry();
+        tos.close();
+
+        TarInputStream tis
+            = new TarInputStream(new ByteArrayInputStream(buff.toByteArray()));
+        TarEntry tripped = tis.getNextEntry();
+        assertEquals("round-tripped name", LONG_NAME, tripped.getName());
+        assertNull("no more entries", tis.getNextEntry());
+        tis.close();
+    }
+}


[02/21] ant git commit: Normalise tabulation and line breaks

Posted by gi...@apache.org.
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/zip/AsiExtraFieldTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/zip/AsiExtraFieldTest.java b/src/tests/junit/org/apache/tools/zip/AsiExtraFieldTest.java
index 9b06a6a..873b3f5 100644
--- a/src/tests/junit/org/apache/tools/zip/AsiExtraFieldTest.java
+++ b/src/tests/junit/org/apache/tools/zip/AsiExtraFieldTest.java
@@ -1,163 +1,163 @@
-/*
- *  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.zip;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-/**
- * JUnit testcases for org.apache.tools.zip.AsiExtraField.
- *
- */
-public class AsiExtraFieldTest implements UnixStat {
-
-    /**
-     * Test file mode magic.
-     */
-    @Test
-    public void testModes() {
-        AsiExtraField a = new AsiExtraField();
-        a.setMode(0123);
-        assertEquals("plain file", 0100123, a.getMode());
-        a.setDirectory(true);
-        assertEquals("directory", 040123, a.getMode());
-        a.setLinkedFile("test");
-        assertEquals("symbolic link", 0120123, a.getMode());
-    }
-
-    /**
-     * Test content.
-     */
-    @Test
-    public void testContent() {
-        AsiExtraField a = new AsiExtraField();
-        a.setMode(0123);
-        a.setUserId(5);
-        a.setGroupId(6);
-        byte[] b = a.getLocalFileDataData();
-
-        // CRC manually calculated, sorry
-        byte[] expect = {(byte)0xC6, 0x02, 0x78, (byte)0xB6, // CRC
-                         0123, (byte)0x80,                   // mode
-                         0, 0, 0, 0,                         // link length
-                         5, 0, 6, 0};                        // uid, gid
-        assertEquals("no link", expect.length, b.length);
-        for (int i=0; i<expect.length; i++) {
-            assertEquals("no link, byte "+i, expect[i], b[i]);
-        }
-
-        a.setLinkedFile("test");
-        expect = new byte[] {0x75, (byte)0x8E, 0x41, (byte)0xFD, // CRC
-                             0123, (byte)0xA0,                   // mode
-                             4, 0, 0, 0,                         // link length
-                             5, 0, 6, 0,                         // uid, gid
-                             (byte)'t', (byte)'e', (byte)'s', (byte)'t'};
-        b = a.getLocalFileDataData();
-        assertEquals("no link", expect.length, b.length);
-        for (int i=0; i<expect.length; i++) {
-            assertEquals("no link, byte "+i, expect[i], b[i]);
-        }
-
-    }
-
-    /**
-     * Test reparse
-     */
-    @Test
-    public void testReparse() throws Exception {
-        // CRC manually calculated, sorry
-        byte[] data = {(byte)0xC6, 0x02, 0x78, (byte)0xB6, // CRC
-                       0123, (byte)0x80,                   // mode
-                       0, 0, 0, 0,                         // link length
-                       5, 0, 6, 0};                        // uid, gid
-        AsiExtraField a = new AsiExtraField();
-        a.parseFromLocalFileData(data, 0, data.length);
-        assertEquals("length plain file", data.length,
-                     a.getLocalFileDataLength().getValue());
-        assertTrue("plain file, no link", !a.isLink());
-        assertTrue("plain file, no dir", !a.isDirectory());
-        assertEquals("mode plain file", FILE_FLAG | 0123, a.getMode());
-        assertEquals("uid plain file", 5, a.getUserId());
-        assertEquals("gid plain file", 6, a.getGroupId());
-
-        data = new byte[] {0x75, (byte)0x8E, 0x41, (byte)0xFD, // CRC
-                           0123, (byte)0xA0,                   // mode
-                           4, 0, 0, 0,                         // link length
-                           5, 0, 6, 0,                         // uid, gid
-                           (byte)'t', (byte)'e', (byte)'s', (byte)'t'};
-        a = new AsiExtraField();
-        a.parseFromLocalFileData(data, 0, data.length);
-        assertEquals("length link", data.length,
-                     a.getLocalFileDataLength().getValue());
-        assertTrue("link, is link", a.isLink());
-        assertTrue("link, no dir", !a.isDirectory());
-        assertEquals("mode link", LINK_FLAG | 0123, a.getMode());
-        assertEquals("uid link", 5, a.getUserId());
-        assertEquals("gid link", 6, a.getGroupId());
-        assertEquals("test", a.getLinkedFile());
-
-        data = new byte[] {(byte)0x8E, 0x01, (byte)0xBF, (byte)0x0E, // CRC
-                           0123, (byte)0x40,                         // mode
-                           0, 0, 0, 0,                               // link
-                           5, 0, 6, 0};                          // uid, gid
-        a = new AsiExtraField();
-        a.parseFromLocalFileData(data, 0, data.length);
-        assertEquals("length dir", data.length,
-                     a.getLocalFileDataLength().getValue());
-        assertTrue("dir, no link", !a.isLink());
-        assertTrue("dir, is dir", a.isDirectory());
-        assertEquals("mode dir", DIR_FLAG | 0123, a.getMode());
-        assertEquals("uid dir", 5, a.getUserId());
-        assertEquals("gid dir", 6, a.getGroupId());
-
-        data = new byte[] {0, 0, 0, 0,                           // bad CRC
-                           0123, (byte)0x40,                     // mode
-                           0, 0, 0, 0,                           // link
-                           5, 0, 6, 0};                          // uid, gid
-        a = new AsiExtraField();
-        try {
-            a.parseFromLocalFileData(data, 0, data.length);
-            fail("should raise bad CRC exception");
-        } catch (Exception e) {
-            assertEquals("bad CRC checksum 0 instead of ebf018e",
-                         e.getMessage());
-        }
-    }
-
-    @Test
-    public void testClone() {
-        AsiExtraField s1 = new AsiExtraField();
-        s1.setUserId(42);
-        s1.setGroupId(12);
-        s1.setLinkedFile("foo");
-        s1.setMode(0644);
-        s1.setDirectory(true);
-        AsiExtraField s2 = (AsiExtraField) s1.clone();
-        assertNotSame(s1, s2);
-        assertEquals(s1.getUserId(), s2.getUserId());
-        assertEquals(s1.getGroupId(), s2.getGroupId());
-        assertEquals(s1.getLinkedFile(), s2.getLinkedFile());
-        assertEquals(s1.getMode(), s2.getMode());
-        assertEquals(s1.isDirectory(), s2.isDirectory());
-    }
-}
+/*
+ *  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.zip;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * JUnit testcases for org.apache.tools.zip.AsiExtraField.
+ *
+ */
+public class AsiExtraFieldTest implements UnixStat {
+
+    /**
+     * Test file mode magic.
+     */
+    @Test
+    public void testModes() {
+        AsiExtraField a = new AsiExtraField();
+        a.setMode(0123);
+        assertEquals("plain file", 0100123, a.getMode());
+        a.setDirectory(true);
+        assertEquals("directory", 040123, a.getMode());
+        a.setLinkedFile("test");
+        assertEquals("symbolic link", 0120123, a.getMode());
+    }
+
+    /**
+     * Test content.
+     */
+    @Test
+    public void testContent() {
+        AsiExtraField a = new AsiExtraField();
+        a.setMode(0123);
+        a.setUserId(5);
+        a.setGroupId(6);
+        byte[] b = a.getLocalFileDataData();
+
+        // CRC manually calculated, sorry
+        byte[] expect = {(byte)0xC6, 0x02, 0x78, (byte)0xB6, // CRC
+                         0123, (byte)0x80,                   // mode
+                         0, 0, 0, 0,                         // link length
+                         5, 0, 6, 0};                        // uid, gid
+        assertEquals("no link", expect.length, b.length);
+        for (int i=0; i<expect.length; i++) {
+            assertEquals("no link, byte "+i, expect[i], b[i]);
+        }
+
+        a.setLinkedFile("test");
+        expect = new byte[] {0x75, (byte)0x8E, 0x41, (byte)0xFD, // CRC
+                             0123, (byte)0xA0,                   // mode
+                             4, 0, 0, 0,                         // link length
+                             5, 0, 6, 0,                         // uid, gid
+                             (byte)'t', (byte)'e', (byte)'s', (byte)'t'};
+        b = a.getLocalFileDataData();
+        assertEquals("no link", expect.length, b.length);
+        for (int i=0; i<expect.length; i++) {
+            assertEquals("no link, byte "+i, expect[i], b[i]);
+        }
+
+    }
+
+    /**
+     * Test reparse
+     */
+    @Test
+    public void testReparse() throws Exception {
+        // CRC manually calculated, sorry
+        byte[] data = {(byte)0xC6, 0x02, 0x78, (byte)0xB6, // CRC
+                       0123, (byte)0x80,                   // mode
+                       0, 0, 0, 0,                         // link length
+                       5, 0, 6, 0};                        // uid, gid
+        AsiExtraField a = new AsiExtraField();
+        a.parseFromLocalFileData(data, 0, data.length);
+        assertEquals("length plain file", data.length,
+                     a.getLocalFileDataLength().getValue());
+        assertTrue("plain file, no link", !a.isLink());
+        assertTrue("plain file, no dir", !a.isDirectory());
+        assertEquals("mode plain file", FILE_FLAG | 0123, a.getMode());
+        assertEquals("uid plain file", 5, a.getUserId());
+        assertEquals("gid plain file", 6, a.getGroupId());
+
+        data = new byte[] {0x75, (byte)0x8E, 0x41, (byte)0xFD, // CRC
+                           0123, (byte)0xA0,                   // mode
+                           4, 0, 0, 0,                         // link length
+                           5, 0, 6, 0,                         // uid, gid
+                           (byte)'t', (byte)'e', (byte)'s', (byte)'t'};
+        a = new AsiExtraField();
+        a.parseFromLocalFileData(data, 0, data.length);
+        assertEquals("length link", data.length,
+                     a.getLocalFileDataLength().getValue());
+        assertTrue("link, is link", a.isLink());
+        assertTrue("link, no dir", !a.isDirectory());
+        assertEquals("mode link", LINK_FLAG | 0123, a.getMode());
+        assertEquals("uid link", 5, a.getUserId());
+        assertEquals("gid link", 6, a.getGroupId());
+        assertEquals("test", a.getLinkedFile());
+
+        data = new byte[] {(byte)0x8E, 0x01, (byte)0xBF, (byte)0x0E, // CRC
+                           0123, (byte)0x40,                         // mode
+                           0, 0, 0, 0,                               // link
+                           5, 0, 6, 0};                          // uid, gid
+        a = new AsiExtraField();
+        a.parseFromLocalFileData(data, 0, data.length);
+        assertEquals("length dir", data.length,
+                     a.getLocalFileDataLength().getValue());
+        assertTrue("dir, no link", !a.isLink());
+        assertTrue("dir, is dir", a.isDirectory());
+        assertEquals("mode dir", DIR_FLAG | 0123, a.getMode());
+        assertEquals("uid dir", 5, a.getUserId());
+        assertEquals("gid dir", 6, a.getGroupId());
+
+        data = new byte[] {0, 0, 0, 0,                           // bad CRC
+                           0123, (byte)0x40,                     // mode
+                           0, 0, 0, 0,                           // link
+                           5, 0, 6, 0};                          // uid, gid
+        a = new AsiExtraField();
+        try {
+            a.parseFromLocalFileData(data, 0, data.length);
+            fail("should raise bad CRC exception");
+        } catch (Exception e) {
+            assertEquals("bad CRC checksum 0 instead of ebf018e",
+                         e.getMessage());
+        }
+    }
+
+    @Test
+    public void testClone() {
+        AsiExtraField s1 = new AsiExtraField();
+        s1.setUserId(42);
+        s1.setGroupId(12);
+        s1.setLinkedFile("foo");
+        s1.setMode(0644);
+        s1.setDirectory(true);
+        AsiExtraField s2 = (AsiExtraField) s1.clone();
+        assertNotSame(s1, s2);
+        assertEquals(s1.getUserId(), s2.getUserId());
+        assertEquals(s1.getGroupId(), s2.getGroupId());
+        assertEquals(s1.getLinkedFile(), s2.getLinkedFile());
+        assertEquals(s1.getMode(), s2.getMode());
+        assertEquals(s1.isDirectory(), s2.isDirectory());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/zip/ExtraFieldUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/zip/ExtraFieldUtilsTest.java b/src/tests/junit/org/apache/tools/zip/ExtraFieldUtilsTest.java
index 3d82698..95a6779 100644
--- a/src/tests/junit/org/apache/tools/zip/ExtraFieldUtilsTest.java
+++ b/src/tests/junit/org/apache/tools/zip/ExtraFieldUtilsTest.java
@@ -1,210 +1,210 @@
-/*
- *  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.zip;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-/**
- * JUnit 3 testcases for org.apache.tools.zip.ExtraFieldUtils.
- *
- */
-public class ExtraFieldUtilsTest implements UnixStat {
-
-    /**
-     * Header-ID of a ZipExtraField not supported by Ant.
-     *
-     * <p>Used to be ZipShort(1) but this is the ID of the Zip64 extra
-     * field.</p>
-     */
-    static final ZipShort UNRECOGNIZED_HEADER = new ZipShort(0x5555);
-
-    private AsiExtraField a;
-    private UnrecognizedExtraField dummy;
-    private byte[] data;
-    private byte[] aLocal;
-
-    @Before
-    public void setUp() {
-        a = new AsiExtraField();
-        a.setMode(0755);
-        a.setDirectory(true);
-        dummy = new UnrecognizedExtraField();
-        dummy.setHeaderId(UNRECOGNIZED_HEADER);
-        dummy.setLocalFileDataData(new byte[] {0});
-        dummy.setCentralDirectoryData(new byte[] {0});
-
-        aLocal = a.getLocalFileDataData();
-        byte[] dummyLocal = dummy.getLocalFileDataData();
-        data = new byte[4 + aLocal.length + 4 + dummyLocal.length];
-        System.arraycopy(a.getHeaderId().getBytes(), 0, data, 0, 2);
-        System.arraycopy(a.getLocalFileDataLength().getBytes(), 0, data, 2, 2);
-        System.arraycopy(aLocal, 0, data, 4, aLocal.length);
-        System.arraycopy(dummy.getHeaderId().getBytes(), 0, data,
-                         4+aLocal.length, 2);
-        System.arraycopy(dummy.getLocalFileDataLength().getBytes(), 0, data,
-                         4+aLocal.length+2, 2);
-        System.arraycopy(dummyLocal, 0, data,
-                         4+aLocal.length+4, dummyLocal.length);
-
-    }
-
-    /**
-     * test parser.
-     */
-    @Test
-    public void testParse() throws Exception {
-        ZipExtraField[] ze = ExtraFieldUtils.parse(data);
-        assertEquals("number of fields", 2, ze.length);
-        assertTrue("type field 1", ze[0] instanceof AsiExtraField);
-        assertEquals("mode field 1", 040755,
-                     ((AsiExtraField) ze[0]).getMode());
-        assertTrue("type field 2", ze[1] instanceof UnrecognizedExtraField);
-        assertEquals("data length field 2", 1,
-                     ze[1].getLocalFileDataLength().getValue());
-
-        byte[] data2 = new byte[data.length-1];
-        System.arraycopy(data, 0, data2, 0, data2.length);
-        try {
-            ExtraFieldUtils.parse(data2);
-            fail("data should be invalid");
-        } catch (Exception e) {
-            assertEquals("message",
-                         "bad extra field starting at "+(4 + aLocal.length)
-                         + ".  Block length of 1 bytes exceeds remaining data of 0 bytes.",
-                         e.getMessage());
-        }
-    }
-
-    @Test
-    public void testParseWithRead() throws Exception {
-        ZipExtraField[] ze =
-            ExtraFieldUtils.parse(data, true,
-                                  ExtraFieldUtils.UnparseableExtraField.READ);
-        assertEquals("number of fields", 2, ze.length);
-        assertTrue("type field 1", ze[0] instanceof AsiExtraField);
-        assertEquals("mode field 1", 040755,
-                     ((AsiExtraField) ze[0]).getMode());
-        assertTrue("type field 2", ze[1] instanceof UnrecognizedExtraField);
-        assertEquals("data length field 2", 1,
-                     ze[1].getLocalFileDataLength().getValue());
-
-        byte[] data2 = new byte[data.length-1];
-        System.arraycopy(data, 0, data2, 0, data2.length);
-        ze = ExtraFieldUtils.parse(data2, true,
-                                   ExtraFieldUtils.UnparseableExtraField.READ);
-        assertEquals("number of fields", 2, ze.length);
-        assertTrue("type field 1", ze[0] instanceof AsiExtraField);
-        assertEquals("mode field 1", 040755,
-                     ((AsiExtraField) ze[0]).getMode());
-        assertTrue("type field 2", ze[1] instanceof UnparseableExtraFieldData);
-        assertEquals("data length field 2", 4,
-                     ze[1].getLocalFileDataLength().getValue());
-        for (int i = 0; i < 4; i++) {
-            assertEquals("byte number " + i,
-                         data2[data.length - 5 + i],
-                         ze[1].getLocalFileDataData()[i]);
-        }
-    }
-
-    @Test
-    public void testParseWithSkip() throws Exception {
-        ZipExtraField[] ze =
-            ExtraFieldUtils.parse(data, true,
-                                  ExtraFieldUtils.UnparseableExtraField.SKIP);
-        assertEquals("number of fields", 2, ze.length);
-        assertTrue("type field 1", ze[0] instanceof AsiExtraField);
-        assertEquals("mode field 1", 040755,
-                     ((AsiExtraField) ze[0]).getMode());
-        assertTrue("type field 2", ze[1] instanceof UnrecognizedExtraField);
-        assertEquals("data length field 2", 1,
-                     ze[1].getLocalFileDataLength().getValue());
-
-        byte[] data2 = new byte[data.length-1];
-        System.arraycopy(data, 0, data2, 0, data2.length);
-        ze = ExtraFieldUtils.parse(data2, true,
-                                   ExtraFieldUtils.UnparseableExtraField.SKIP);
-        assertEquals("number of fields", 1, ze.length);
-        assertTrue("type field 1", ze[0] instanceof AsiExtraField);
-        assertEquals("mode field 1", 040755,
-                     ((AsiExtraField) ze[0]).getMode());
-    }
-
-    /**
-     * Test merge methods
-     */
-    @Test
-    public void testMerge() {
-        byte[] local =
-            ExtraFieldUtils.mergeLocalFileDataData(new ZipExtraField[] {a, dummy});
-        assertEquals("local length", data.length, local.length);
-        for (int i=0; i<local.length; i++) {
-            assertEquals("local byte "+i, data[i], local[i]);
-        }
-
-        byte[] dummyCentral = dummy.getCentralDirectoryData();
-        byte[] data2 = new byte[4 + aLocal.length + 4 + dummyCentral.length];
-        System.arraycopy(data, 0, data2, 0, 4 + aLocal.length + 2);
-        System.arraycopy(dummy.getCentralDirectoryLength().getBytes(), 0,
-                         data2, 4+aLocal.length+2, 2);
-        System.arraycopy(dummyCentral, 0, data2,
-                         4+aLocal.length+4, dummyCentral.length);
-
-
-        byte[] central =
-            ExtraFieldUtils.mergeCentralDirectoryData(new ZipExtraField[] {a, dummy});
-        assertEquals("central length", data2.length, central.length);
-        for (int i=0; i<central.length; i++) {
-            assertEquals("central byte "+i, data2[i], central[i]);
-        }
-
-    }
-
-    @Test
-    public void testMergeWithUnparseableData() throws Exception {
-        ZipExtraField d = new UnparseableExtraFieldData();
-        byte[] b = UNRECOGNIZED_HEADER.getBytes();
-        d.parseFromLocalFileData(new byte[] {b[0], b[1], 1, 0}, 0, 4);
-        byte[] local =
-            ExtraFieldUtils.mergeLocalFileDataData(new ZipExtraField[] {a, d});
-        assertEquals("local length", data.length - 1, local.length);
-        for (int i = 0; i < local.length; i++) {
-            assertEquals("local byte " + i, data[i], local[i]);
-        }
-
-        byte[] dCentral = d.getCentralDirectoryData();
-        byte[] data2 = new byte[4 + aLocal.length + dCentral.length];
-        System.arraycopy(data, 0, data2, 0, 4 + aLocal.length + 2);
-        System.arraycopy(dCentral, 0, data2,
-                         4 + aLocal.length, dCentral.length);
-
-
-        byte[] central =
-            ExtraFieldUtils.mergeCentralDirectoryData(new ZipExtraField[] {a, d});
-        assertEquals("central length", data2.length, central.length);
-        for (int i = 0; i < central.length; i++) {
-            assertEquals("central byte " + i, data2[i], central[i]);
-        }
-
-    }
-}
+/*
+ *  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.zip;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * JUnit 3 testcases for org.apache.tools.zip.ExtraFieldUtils.
+ *
+ */
+public class ExtraFieldUtilsTest implements UnixStat {
+
+    /**
+     * Header-ID of a ZipExtraField not supported by Ant.
+     *
+     * <p>Used to be ZipShort(1) but this is the ID of the Zip64 extra
+     * field.</p>
+     */
+    static final ZipShort UNRECOGNIZED_HEADER = new ZipShort(0x5555);
+
+    private AsiExtraField a;
+    private UnrecognizedExtraField dummy;
+    private byte[] data;
+    private byte[] aLocal;
+
+    @Before
+    public void setUp() {
+        a = new AsiExtraField();
+        a.setMode(0755);
+        a.setDirectory(true);
+        dummy = new UnrecognizedExtraField();
+        dummy.setHeaderId(UNRECOGNIZED_HEADER);
+        dummy.setLocalFileDataData(new byte[] {0});
+        dummy.setCentralDirectoryData(new byte[] {0});
+
+        aLocal = a.getLocalFileDataData();
+        byte[] dummyLocal = dummy.getLocalFileDataData();
+        data = new byte[4 + aLocal.length + 4 + dummyLocal.length];
+        System.arraycopy(a.getHeaderId().getBytes(), 0, data, 0, 2);
+        System.arraycopy(a.getLocalFileDataLength().getBytes(), 0, data, 2, 2);
+        System.arraycopy(aLocal, 0, data, 4, aLocal.length);
+        System.arraycopy(dummy.getHeaderId().getBytes(), 0, data,
+                         4+aLocal.length, 2);
+        System.arraycopy(dummy.getLocalFileDataLength().getBytes(), 0, data,
+                         4+aLocal.length+2, 2);
+        System.arraycopy(dummyLocal, 0, data,
+                         4+aLocal.length+4, dummyLocal.length);
+
+    }
+
+    /**
+     * test parser.
+     */
+    @Test
+    public void testParse() throws Exception {
+        ZipExtraField[] ze = ExtraFieldUtils.parse(data);
+        assertEquals("number of fields", 2, ze.length);
+        assertTrue("type field 1", ze[0] instanceof AsiExtraField);
+        assertEquals("mode field 1", 040755,
+                     ((AsiExtraField) ze[0]).getMode());
+        assertTrue("type field 2", ze[1] instanceof UnrecognizedExtraField);
+        assertEquals("data length field 2", 1,
+                     ze[1].getLocalFileDataLength().getValue());
+
+        byte[] data2 = new byte[data.length-1];
+        System.arraycopy(data, 0, data2, 0, data2.length);
+        try {
+            ExtraFieldUtils.parse(data2);
+            fail("data should be invalid");
+        } catch (Exception e) {
+            assertEquals("message",
+                         "bad extra field starting at "+(4 + aLocal.length)
+                         + ".  Block length of 1 bytes exceeds remaining data of 0 bytes.",
+                         e.getMessage());
+        }
+    }
+
+    @Test
+    public void testParseWithRead() throws Exception {
+        ZipExtraField[] ze =
+            ExtraFieldUtils.parse(data, true,
+                                  ExtraFieldUtils.UnparseableExtraField.READ);
+        assertEquals("number of fields", 2, ze.length);
+        assertTrue("type field 1", ze[0] instanceof AsiExtraField);
+        assertEquals("mode field 1", 040755,
+                     ((AsiExtraField) ze[0]).getMode());
+        assertTrue("type field 2", ze[1] instanceof UnrecognizedExtraField);
+        assertEquals("data length field 2", 1,
+                     ze[1].getLocalFileDataLength().getValue());
+
+        byte[] data2 = new byte[data.length-1];
+        System.arraycopy(data, 0, data2, 0, data2.length);
+        ze = ExtraFieldUtils.parse(data2, true,
+                                   ExtraFieldUtils.UnparseableExtraField.READ);
+        assertEquals("number of fields", 2, ze.length);
+        assertTrue("type field 1", ze[0] instanceof AsiExtraField);
+        assertEquals("mode field 1", 040755,
+                     ((AsiExtraField) ze[0]).getMode());
+        assertTrue("type field 2", ze[1] instanceof UnparseableExtraFieldData);
+        assertEquals("data length field 2", 4,
+                     ze[1].getLocalFileDataLength().getValue());
+        for (int i = 0; i < 4; i++) {
+            assertEquals("byte number " + i,
+                         data2[data.length - 5 + i],
+                         ze[1].getLocalFileDataData()[i]);
+        }
+    }
+
+    @Test
+    public void testParseWithSkip() throws Exception {
+        ZipExtraField[] ze =
+            ExtraFieldUtils.parse(data, true,
+                                  ExtraFieldUtils.UnparseableExtraField.SKIP);
+        assertEquals("number of fields", 2, ze.length);
+        assertTrue("type field 1", ze[0] instanceof AsiExtraField);
+        assertEquals("mode field 1", 040755,
+                     ((AsiExtraField) ze[0]).getMode());
+        assertTrue("type field 2", ze[1] instanceof UnrecognizedExtraField);
+        assertEquals("data length field 2", 1,
+                     ze[1].getLocalFileDataLength().getValue());
+
+        byte[] data2 = new byte[data.length-1];
+        System.arraycopy(data, 0, data2, 0, data2.length);
+        ze = ExtraFieldUtils.parse(data2, true,
+                                   ExtraFieldUtils.UnparseableExtraField.SKIP);
+        assertEquals("number of fields", 1, ze.length);
+        assertTrue("type field 1", ze[0] instanceof AsiExtraField);
+        assertEquals("mode field 1", 040755,
+                     ((AsiExtraField) ze[0]).getMode());
+    }
+
+    /**
+     * Test merge methods
+     */
+    @Test
+    public void testMerge() {
+        byte[] local =
+            ExtraFieldUtils.mergeLocalFileDataData(new ZipExtraField[] {a, dummy});
+        assertEquals("local length", data.length, local.length);
+        for (int i=0; i<local.length; i++) {
+            assertEquals("local byte "+i, data[i], local[i]);
+        }
+
+        byte[] dummyCentral = dummy.getCentralDirectoryData();
+        byte[] data2 = new byte[4 + aLocal.length + 4 + dummyCentral.length];
+        System.arraycopy(data, 0, data2, 0, 4 + aLocal.length + 2);
+        System.arraycopy(dummy.getCentralDirectoryLength().getBytes(), 0,
+                         data2, 4+aLocal.length+2, 2);
+        System.arraycopy(dummyCentral, 0, data2,
+                         4+aLocal.length+4, dummyCentral.length);
+
+
+        byte[] central =
+            ExtraFieldUtils.mergeCentralDirectoryData(new ZipExtraField[] {a, dummy});
+        assertEquals("central length", data2.length, central.length);
+        for (int i=0; i<central.length; i++) {
+            assertEquals("central byte "+i, data2[i], central[i]);
+        }
+
+    }
+
+    @Test
+    public void testMergeWithUnparseableData() throws Exception {
+        ZipExtraField d = new UnparseableExtraFieldData();
+        byte[] b = UNRECOGNIZED_HEADER.getBytes();
+        d.parseFromLocalFileData(new byte[] {b[0], b[1], 1, 0}, 0, 4);
+        byte[] local =
+            ExtraFieldUtils.mergeLocalFileDataData(new ZipExtraField[] {a, d});
+        assertEquals("local length", data.length - 1, local.length);
+        for (int i = 0; i < local.length; i++) {
+            assertEquals("local byte " + i, data[i], local[i]);
+        }
+
+        byte[] dCentral = d.getCentralDirectoryData();
+        byte[] data2 = new byte[4 + aLocal.length + dCentral.length];
+        System.arraycopy(data, 0, data2, 0, 4 + aLocal.length + 2);
+        System.arraycopy(dCentral, 0, data2,
+                         4 + aLocal.length, dCentral.length);
+
+
+        byte[] central =
+            ExtraFieldUtils.mergeCentralDirectoryData(new ZipExtraField[] {a, d});
+        assertEquals("central length", data2.length, central.length);
+        for (int i = 0; i < central.length; i++) {
+            assertEquals("central byte " + i, data2[i], central[i]);
+        }
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/zip/UTF8ZipFilesTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/zip/UTF8ZipFilesTest.java b/src/tests/junit/org/apache/tools/zip/UTF8ZipFilesTest.java
index 564bdaf..0e51e6b 100644
--- a/src/tests/junit/org/apache/tools/zip/UTF8ZipFilesTest.java
+++ b/src/tests/junit/org/apache/tools/zip/UTF8ZipFilesTest.java
@@ -1,260 +1,259 @@
-/*
- *  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.zip;
-
-import java.io.File;
-import java.io.InputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.Enumeration;
-import java.util.zip.CRC32;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-public class UTF8ZipFilesTest {
-
-    private static final String UTF_8 = "utf-8";
-    private static final String CP437 = "cp437";
-    private static final String US_ASCII = "US-ASCII";
-    private static final String ASCII_TXT = "ascii.txt";
-    private static final String EURO_FOR_DOLLAR_TXT = "\u20AC_for_Dollar.txt";
-    private static final String OIL_BARREL_TXT = "\u00D6lf\u00E4sser.txt";
-
-    @Test
-    public void testUtf8FileRoundtripExplicitUnicodeExtra()
-        throws IOException {
-        testFileRoundtrip(UTF_8, true, true);
-    }
-
-    @Test
-    public void testUtf8FileRoundtripNoEFSExplicitUnicodeExtra()
-        throws IOException {
-        testFileRoundtrip(UTF_8, false, true);
-    }
-
-    @Test
-    public void testCP437FileRoundtripExplicitUnicodeExtra()
-        throws IOException {
-        testFileRoundtrip(CP437, false, true);
-    }
-
-    @Test
-    public void testASCIIFileRoundtripExplicitUnicodeExtra()
-        throws IOException {
-        testFileRoundtrip(US_ASCII, false, true);
-    }
-
-    @Test
-    public void testUtf8FileRoundtripImplicitUnicodeExtra()
-        throws IOException {
-        testFileRoundtrip(UTF_8, true, false);
-    }
-
-    @Test
-    public void testUtf8FileRoundtripNoEFSImplicitUnicodeExtra()
-        throws IOException {
-        testFileRoundtrip(UTF_8, false, false);
-    }
-
-    @Test
-    public void testCP437FileRoundtripImplicitUnicodeExtra()
-        throws IOException {
-        testFileRoundtrip(CP437, false, false);
-    }
-
-    @Test
-    public void testASCIIFileRoundtripImplicitUnicodeExtra()
-        throws IOException {
-        testFileRoundtrip(US_ASCII, false, false);
-    }
-
-    @Test
-    public void testZipFileReadsUnicodeFields() throws IOException {
-        File file = File.createTempFile("unicode-test", ".zip");
-        ZipFile zf = null;
-        try {
-            createTestFile(file, US_ASCII, false, true);
-            zf = new ZipFile(file, US_ASCII, true);
-            assertCanRead(zf, ASCII_TXT);
-            assertCanRead(zf, EURO_FOR_DOLLAR_TXT);
-            assertCanRead(zf, OIL_BARREL_TXT);
-        } finally {
-            ZipFile.closeQuietly(zf);
-            if (file.exists()) {
-                file.delete();
-            }
-        }
-    }
-
-    private static void testFileRoundtrip(String encoding, boolean withEFS,
-                                          boolean withExplicitUnicodeExtra)
-        throws IOException {
-
-        File file = File.createTempFile(encoding + "-test", ".zip");
-        try {
-            createTestFile(file, encoding, withEFS, withExplicitUnicodeExtra);
-            testFile(file, encoding);
-        } finally {
-            if (file.exists()) {
-                file.delete();
-            }
-        }
-    }
-
-    private static void createTestFile(File file, String encoding,
-                                       boolean withEFS,
-                                       boolean withExplicitUnicodeExtra)
-        throws IOException {
-
-        ZipEncoding zipEncoding = ZipEncodingHelper.getZipEncoding(encoding);
-
-        ZipOutputStream zos = null;
-        try {
-            zos = new ZipOutputStream(file);
-            zos.setEncoding(encoding);
-            zos.setUseLanguageEncodingFlag(withEFS);
-            zos.setCreateUnicodeExtraFields(withExplicitUnicodeExtra ? 
-                                            ZipOutputStream
-                                            .UnicodeExtraFieldPolicy.NEVER
-                                            : ZipOutputStream
-                                            .UnicodeExtraFieldPolicy.ALWAYS);
-
-            ZipEntry ze = new ZipEntry(OIL_BARREL_TXT);
-            if (withExplicitUnicodeExtra
-                && !zipEncoding.canEncode(ze.getName())) {
-
-                ByteBuffer en = zipEncoding.encode(ze.getName());
-
-                ze.addExtraField(new UnicodePathExtraField(ze.getName(),
-                                                           en.array(),
-                                                           en.arrayOffset(),
-                                                           en.limit()));
-            }
-
-            zos.putNextEntry(ze);
-            zos.write("Hello, world!".getBytes("US-ASCII"));
-            zos.closeEntry();
-
-            ze = new ZipEntry(EURO_FOR_DOLLAR_TXT);
-            if (withExplicitUnicodeExtra
-                && !zipEncoding.canEncode(ze.getName())) {
-
-                ByteBuffer en = zipEncoding.encode(ze.getName());
-
-                ze.addExtraField(new UnicodePathExtraField(ze.getName(),
-                                                           en.array(),
-                                                           en.arrayOffset(),
-                                                           en.limit()));
-            }
-
-            zos.putNextEntry(ze);
-            zos.write("Give me your money!".getBytes("US-ASCII"));
-            zos.closeEntry();
-
-            ze = new ZipEntry(ASCII_TXT);
-
-            if (withExplicitUnicodeExtra
-                && !zipEncoding.canEncode(ze.getName())) {
-
-                ByteBuffer en = zipEncoding.encode(ze.getName());
-
-                ze.addExtraField(new UnicodePathExtraField(ze.getName(),
-                                                           en.array(),
-                                                           en.arrayOffset(),
-                                                           en.limit()));
-            }
-
-            zos.putNextEntry(ze);
-            zos.write("ascii".getBytes("US-ASCII"));
-            zos.closeEntry();
-        } finally {
-            if (zos != null) {
-                try {
-                    zos.close();
-                } catch (IOException e) { /* swallow */ }
-            }
-        }
-    }
-
-    private static void testFile(File file, String encoding)
-        throws IOException {
-        ZipFile zf = null;
-        try {
-            zf = new ZipFile(file, encoding, false);
-
-            Enumeration e = zf.getEntries();
-            while (e.hasMoreElements()) {
-                ZipEntry ze = (ZipEntry) e.nextElement();
-
-                if (ze.getName().endsWith("sser.txt")) {
-                    assertUnicodeName(ze, OIL_BARREL_TXT, encoding);
-
-                } else if (ze.getName().endsWith("_for_Dollar.txt")) {
-                    assertUnicodeName(ze, EURO_FOR_DOLLAR_TXT, encoding);
-                } else if (!ze.getName().equals(ASCII_TXT)) {
-                    throw new AssertionError("Urecognized ZIP entry with name ["
-                                             + ze.getName() + "] found.");
-                }
-            }
-        } finally {
-            ZipFile.closeQuietly(zf);
-        }
-    }
-
-    private static UnicodePathExtraField findUniCodePath(ZipEntry ze) {
-        return (UnicodePathExtraField)
-            ze.getExtraField(UnicodePathExtraField.UPATH_ID);
-    }
-
-    private static void assertUnicodeName(ZipEntry ze,
-                                          String expectedName,
-                                          String encoding)
-        throws IOException {
-        if (!expectedName.equals(ze.getName())) {
-            UnicodePathExtraField ucpf = findUniCodePath(ze);
-            assertNotNull(ucpf);
-
-            ZipEncoding enc = ZipEncodingHelper.getZipEncoding(encoding);
-            ByteBuffer ne = enc.encode(ze.getName());
-
-            CRC32 crc = new CRC32();
-            crc.update(ne.array(),ne.arrayOffset(),ne.limit());
-
-            assertEquals(crc.getValue(), ucpf.getNameCRC32());
-            assertEquals(expectedName, new String(ucpf.getUnicodeName(),
-                                                  UTF_8));
-        }
-    }
-
-    private static void assertCanRead(ZipFile zf, String fileName) throws IOException {
-        ZipEntry entry = zf.getEntry(fileName);
-        assertNotNull("Entry " + fileName + " doesn't exist", entry);
-        InputStream is = zf.getInputStream(entry);
-        assertNotNull("InputStream is null", is);
-        try {
-            is.read();
-        } finally {
-            is.close();
-        }
-    }
-
-}
-
+/*
+ *  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.zip;
+
+import java.io.File;
+import java.io.InputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.Enumeration;
+import java.util.zip.CRC32;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+public class UTF8ZipFilesTest {
+
+    private static final String UTF_8 = "utf-8";
+    private static final String CP437 = "cp437";
+    private static final String US_ASCII = "US-ASCII";
+    private static final String ASCII_TXT = "ascii.txt";
+    private static final String EURO_FOR_DOLLAR_TXT = "\u20AC_for_Dollar.txt";
+    private static final String OIL_BARREL_TXT = "\u00D6lf\u00E4sser.txt";
+
+    @Test
+    public void testUtf8FileRoundtripExplicitUnicodeExtra()
+        throws IOException {
+        testFileRoundtrip(UTF_8, true, true);
+    }
+
+    @Test
+    public void testUtf8FileRoundtripNoEFSExplicitUnicodeExtra()
+        throws IOException {
+        testFileRoundtrip(UTF_8, false, true);
+    }
+
+    @Test
+    public void testCP437FileRoundtripExplicitUnicodeExtra()
+        throws IOException {
+        testFileRoundtrip(CP437, false, true);
+    }
+
+    @Test
+    public void testASCIIFileRoundtripExplicitUnicodeExtra()
+        throws IOException {
+        testFileRoundtrip(US_ASCII, false, true);
+    }
+
+    @Test
+    public void testUtf8FileRoundtripImplicitUnicodeExtra()
+        throws IOException {
+        testFileRoundtrip(UTF_8, true, false);
+    }
+
+    @Test
+    public void testUtf8FileRoundtripNoEFSImplicitUnicodeExtra()
+        throws IOException {
+        testFileRoundtrip(UTF_8, false, false);
+    }
+
+    @Test
+    public void testCP437FileRoundtripImplicitUnicodeExtra()
+        throws IOException {
+        testFileRoundtrip(CP437, false, false);
+    }
+
+    @Test
+    public void testASCIIFileRoundtripImplicitUnicodeExtra()
+        throws IOException {
+        testFileRoundtrip(US_ASCII, false, false);
+    }
+
+    @Test
+    public void testZipFileReadsUnicodeFields() throws IOException {
+        File file = File.createTempFile("unicode-test", ".zip");
+        ZipFile zf = null;
+        try {
+            createTestFile(file, US_ASCII, false, true);
+            zf = new ZipFile(file, US_ASCII, true);
+            assertCanRead(zf, ASCII_TXT);
+            assertCanRead(zf, EURO_FOR_DOLLAR_TXT);
+            assertCanRead(zf, OIL_BARREL_TXT);
+        } finally {
+            ZipFile.closeQuietly(zf);
+            if (file.exists()) {
+                file.delete();
+            }
+        }
+    }
+
+    private static void testFileRoundtrip(String encoding, boolean withEFS,
+                                          boolean withExplicitUnicodeExtra)
+        throws IOException {
+
+        File file = File.createTempFile(encoding + "-test", ".zip");
+        try {
+            createTestFile(file, encoding, withEFS, withExplicitUnicodeExtra);
+            testFile(file, encoding);
+        } finally {
+            if (file.exists()) {
+                file.delete();
+            }
+        }
+    }
+
+    private static void createTestFile(File file, String encoding,
+                                       boolean withEFS,
+                                       boolean withExplicitUnicodeExtra)
+        throws IOException {
+
+        ZipEncoding zipEncoding = ZipEncodingHelper.getZipEncoding(encoding);
+
+        ZipOutputStream zos = null;
+        try {
+            zos = new ZipOutputStream(file);
+            zos.setEncoding(encoding);
+            zos.setUseLanguageEncodingFlag(withEFS);
+            zos.setCreateUnicodeExtraFields(withExplicitUnicodeExtra ?
+                                            ZipOutputStream
+                                            .UnicodeExtraFieldPolicy.NEVER
+                                            : ZipOutputStream
+                                            .UnicodeExtraFieldPolicy.ALWAYS);
+
+            ZipEntry ze = new ZipEntry(OIL_BARREL_TXT);
+            if (withExplicitUnicodeExtra
+                && !zipEncoding.canEncode(ze.getName())) {
+
+                ByteBuffer en = zipEncoding.encode(ze.getName());
+
+                ze.addExtraField(new UnicodePathExtraField(ze.getName(),
+                                                           en.array(),
+                                                           en.arrayOffset(),
+                                                           en.limit()));
+            }
+
+            zos.putNextEntry(ze);
+            zos.write("Hello, world!".getBytes("US-ASCII"));
+            zos.closeEntry();
+
+            ze = new ZipEntry(EURO_FOR_DOLLAR_TXT);
+            if (withExplicitUnicodeExtra
+                && !zipEncoding.canEncode(ze.getName())) {
+
+                ByteBuffer en = zipEncoding.encode(ze.getName());
+
+                ze.addExtraField(new UnicodePathExtraField(ze.getName(),
+                                                           en.array(),
+                                                           en.arrayOffset(),
+                                                           en.limit()));
+            }
+
+            zos.putNextEntry(ze);
+            zos.write("Give me your money!".getBytes("US-ASCII"));
+            zos.closeEntry();
+
+            ze = new ZipEntry(ASCII_TXT);
+
+            if (withExplicitUnicodeExtra
+                && !zipEncoding.canEncode(ze.getName())) {
+
+                ByteBuffer en = zipEncoding.encode(ze.getName());
+
+                ze.addExtraField(new UnicodePathExtraField(ze.getName(),
+                                                           en.array(),
+                                                           en.arrayOffset(),
+                                                           en.limit()));
+            }
+
+            zos.putNextEntry(ze);
+            zos.write("ascii".getBytes("US-ASCII"));
+            zos.closeEntry();
+        } finally {
+            if (zos != null) {
+                try {
+                    zos.close();
+                } catch (IOException e) { /* swallow */ }
+            }
+        }
+    }
+
+    private static void testFile(File file, String encoding)
+        throws IOException {
+        ZipFile zf = null;
+        try {
+            zf = new ZipFile(file, encoding, false);
+
+            Enumeration e = zf.getEntries();
+            while (e.hasMoreElements()) {
+                ZipEntry ze = (ZipEntry) e.nextElement();
+
+                if (ze.getName().endsWith("sser.txt")) {
+                    assertUnicodeName(ze, OIL_BARREL_TXT, encoding);
+
+                } else if (ze.getName().endsWith("_for_Dollar.txt")) {
+                    assertUnicodeName(ze, EURO_FOR_DOLLAR_TXT, encoding);
+                } else if (!ze.getName().equals(ASCII_TXT)) {
+                    throw new AssertionError("Urecognized ZIP entry with name ["
+                                             + ze.getName() + "] found.");
+                }
+            }
+        } finally {
+            ZipFile.closeQuietly(zf);
+        }
+    }
+
+    private static UnicodePathExtraField findUniCodePath(ZipEntry ze) {
+        return (UnicodePathExtraField)
+            ze.getExtraField(UnicodePathExtraField.UPATH_ID);
+    }
+
+    private static void assertUnicodeName(ZipEntry ze,
+                                          String expectedName,
+                                          String encoding)
+        throws IOException {
+        if (!expectedName.equals(ze.getName())) {
+            UnicodePathExtraField ucpf = findUniCodePath(ze);
+            assertNotNull(ucpf);
+
+            ZipEncoding enc = ZipEncodingHelper.getZipEncoding(encoding);
+            ByteBuffer ne = enc.encode(ze.getName());
+
+            CRC32 crc = new CRC32();
+            crc.update(ne.array(),ne.arrayOffset(),ne.limit());
+
+            assertEquals(crc.getValue(), ucpf.getNameCRC32());
+            assertEquals(expectedName, new String(ucpf.getUnicodeName(),
+                                                  UTF_8));
+        }
+    }
+
+    private static void assertCanRead(ZipFile zf, String fileName) throws IOException {
+        ZipEntry entry = zf.getEntry(fileName);
+        assertNotNull("Entry " + fileName + " doesn't exist", entry);
+        InputStream is = zf.getInputStream(entry);
+        assertNotNull("InputStream is null", is);
+        try {
+            is.read();
+        } finally {
+            is.close();
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/zip/ZipEncodingTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/zip/ZipEncodingTest.java b/src/tests/junit/org/apache/tools/zip/ZipEncodingTest.java
index b9eefd5..826e410 100644
--- a/src/tests/junit/org/apache/tools/zip/ZipEncodingTest.java
+++ b/src/tests/junit/org/apache/tools/zip/ZipEncodingTest.java
@@ -1,152 +1,152 @@
-/*
- * 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.zip;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Test zip encodings.
- */
-public class ZipEncodingTest {
-    private static final String UNENC_STRING = "\u2016";
-
-    // stress test for internal grow method.
-    private static final String BAD_STRING =
-        "\u2016\u2015\u2016\u2015\u2016\u2015\u2016\u2015\u2016\u2015\u2016";
-
-    private static final String BAD_STRING_ENC =
-        "%U2016%U2015%U2016%U2015%U2016%U2015%U2016%U2015%U2016%U2015%U2016";
-
-    @Test
-    public void testSimpleCp437Encoding() throws IOException {
-
-        doSimpleEncodingTest("Cp437", null);
-    }
-
-    @Test
-    public void testSimpleCp850Encoding() throws IOException {
-
-        doSimpleEncodingTest("Cp850", null);
-    }
-
-    @Test
-    public void testNioCp1252Encoding() throws IOException {
-        // CP1252 has some undefined code points, these are
-        // the defined ones
-        // retrieved by
-        //    awk '/^0x/ && NF>2 {print $1;}' CP1252.TXT
-        byte[] b =
-            new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
-                         0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
-                         0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
-                         0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
-                         0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
-                         0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
-                         0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
-                         0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
-                         0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
-                         0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
-                         0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
-                         0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
-                         0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
-                         0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
-                         0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
-                         0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
-                         (byte) 0x80, (byte) 0x82, (byte) 0x83, (byte) 0x84,
-                         (byte) 0x85, (byte) 0x86, (byte) 0x87, (byte) 0x88,
-                         (byte) 0x89, (byte) 0x8A, (byte) 0x8B, (byte) 0x8C,
-                         (byte) 0x8E, (byte) 0x91, (byte) 0x92, (byte) 0x93,
-                         (byte) 0x94, (byte) 0x95, (byte) 0x96, (byte) 0x97,
-                         (byte) 0x98, (byte) 0x99, (byte) 0x9A, (byte) 0x9B,
-                         (byte) 0x9C, (byte) 0x9E, (byte) 0x9F, (byte) 0xA0,
-                         (byte) 0xA1, (byte) 0xA2, (byte) 0xA3, (byte) 0xA4,
-                         (byte) 0xA5, (byte) 0xA6, (byte) 0xA7, (byte) 0xA8,
-                         (byte) 0xA9, (byte) 0xAA, (byte) 0xAB, (byte) 0xAC,
-                         (byte) 0xAD, (byte) 0xAE, (byte) 0xAF, (byte) 0xB0,
-                         (byte) 0xB1, (byte) 0xB2, (byte) 0xB3, (byte) 0xB4,
-                         (byte) 0xB5, (byte) 0xB6, (byte) 0xB7, (byte) 0xB8,
-                         (byte) 0xB9, (byte) 0xBA, (byte) 0xBB, (byte) 0xBC,
-                         (byte) 0xBD, (byte) 0xBE, (byte) 0xBF, (byte) 0xC0,
-                         (byte) 0xC1, (byte) 0xC2, (byte) 0xC3, (byte) 0xC4,
-                         (byte) 0xC5, (byte) 0xC6, (byte) 0xC7, (byte) 0xC8,
-                         (byte) 0xC9, (byte) 0xCA, (byte) 0xCB, (byte) 0xCC,
-                         (byte) 0xCD, (byte) 0xCE, (byte) 0xCF, (byte) 0xD0,
-                         (byte) 0xD1, (byte) 0xD2, (byte) 0xD3, (byte) 0xD4,
-                         (byte) 0xD5, (byte) 0xD6, (byte) 0xD7, (byte) 0xD8,
-                         (byte) 0xD9, (byte) 0xDA, (byte) 0xDB, (byte) 0xDC,
-                         (byte) 0xDD, (byte) 0xDE, (byte) 0xDF, (byte) 0xE0,
-                         (byte) 0xE1, (byte) 0xE2, (byte) 0xE3, (byte) 0xE4,
-                         (byte) 0xE5, (byte) 0xE6, (byte) 0xE7, (byte) 0xE8,
-                         (byte) 0xE9, (byte) 0xEA, (byte) 0xEB, (byte) 0xEC,
-                         (byte) 0xED, (byte) 0xEE, (byte) 0xEF, (byte) 0xF0,
-                         (byte) 0xF1, (byte) 0xF2, (byte) 0xF3, (byte) 0xF4,
-                         (byte) 0xF5, (byte) 0xF6, (byte) 0xF7, (byte) 0xF8,
-                         (byte) 0xF9, (byte) 0xFA, (byte) 0xFB, (byte) 0xFC,
-                         (byte) 0xFD, (byte) 0xFE, (byte) 0xFF };
-
-        doSimpleEncodingTest("Cp1252",b);
-    }
-
-    private static void assertByteEquals(byte[] expected, ByteBuffer actual) {
-
-        assertEquals(expected.length, actual.limit());
-
-        for (int i = 0; i < expected.length; ++i) {
-
-            byte a = actual.get();
-            assertEquals(expected[i], a);
-        }
-
-    }
-
-    private void doSimpleEncodingTest(String name, byte[] testBytes)
-        throws IOException {
-
-        ZipEncoding enc = ZipEncodingHelper.getZipEncoding(name);
-
-        if (testBytes == null) {
-
-            testBytes = new byte[256];
-            for (int i = 0; i < 256; ++i) {
-                testBytes[i] = (byte) i;
-            }
-        }
-
-        String decoded = enc.decode(testBytes);
-
-        assertEquals(true, enc.canEncode(decoded));
-
-        ByteBuffer encoded = enc.encode(decoded);
-
-        assertByteEquals(testBytes, encoded);
-
-        assertEquals(false, enc.canEncode(UNENC_STRING));
-        assertByteEquals("%U2016".getBytes("US-ASCII"), enc.encode(UNENC_STRING));
-        assertEquals(false, enc.canEncode(BAD_STRING));
-        assertByteEquals(BAD_STRING_ENC.getBytes("US-ASCII"),
-                enc.encode(BAD_STRING));
-    }
-
-}
+/*
+ * 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.zip;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Test zip encodings.
+ */
+public class ZipEncodingTest {
+    private static final String UNENC_STRING = "\u2016";
+
+    // stress test for internal grow method.
+    private static final String BAD_STRING =
+        "\u2016\u2015\u2016\u2015\u2016\u2015\u2016\u2015\u2016\u2015\u2016";
+
+    private static final String BAD_STRING_ENC =
+        "%U2016%U2015%U2016%U2015%U2016%U2015%U2016%U2015%U2016%U2015%U2016";
+
+    @Test
+    public void testSimpleCp437Encoding() throws IOException {
+
+        doSimpleEncodingTest("Cp437", null);
+    }
+
+    @Test
+    public void testSimpleCp850Encoding() throws IOException {
+
+        doSimpleEncodingTest("Cp850", null);
+    }
+
+    @Test
+    public void testNioCp1252Encoding() throws IOException {
+        // CP1252 has some undefined code points, these are
+        // the defined ones
+        // retrieved by
+        //    awk '/^0x/ && NF>2 {print $1;}' CP1252.TXT
+        byte[] b =
+            new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+                         0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+                         0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+                         0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
+                         0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+                         0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
+                         0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
+                         0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
+                         0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
+                         0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
+                         0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
+                         0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
+                         0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+                         0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
+                         0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+                         0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
+                         (byte) 0x80, (byte) 0x82, (byte) 0x83, (byte) 0x84,
+                         (byte) 0x85, (byte) 0x86, (byte) 0x87, (byte) 0x88,
+                         (byte) 0x89, (byte) 0x8A, (byte) 0x8B, (byte) 0x8C,
+                         (byte) 0x8E, (byte) 0x91, (byte) 0x92, (byte) 0x93,
+                         (byte) 0x94, (byte) 0x95, (byte) 0x96, (byte) 0x97,
+                         (byte) 0x98, (byte) 0x99, (byte) 0x9A, (byte) 0x9B,
+                         (byte) 0x9C, (byte) 0x9E, (byte) 0x9F, (byte) 0xA0,
+                         (byte) 0xA1, (byte) 0xA2, (byte) 0xA3, (byte) 0xA4,
+                         (byte) 0xA5, (byte) 0xA6, (byte) 0xA7, (byte) 0xA8,
+                         (byte) 0xA9, (byte) 0xAA, (byte) 0xAB, (byte) 0xAC,
+                         (byte) 0xAD, (byte) 0xAE, (byte) 0xAF, (byte) 0xB0,
+                         (byte) 0xB1, (byte) 0xB2, (byte) 0xB3, (byte) 0xB4,
+                         (byte) 0xB5, (byte) 0xB6, (byte) 0xB7, (byte) 0xB8,
+                         (byte) 0xB9, (byte) 0xBA, (byte) 0xBB, (byte) 0xBC,
+                         (byte) 0xBD, (byte) 0xBE, (byte) 0xBF, (byte) 0xC0,
+                         (byte) 0xC1, (byte) 0xC2, (byte) 0xC3, (byte) 0xC4,
+                         (byte) 0xC5, (byte) 0xC6, (byte) 0xC7, (byte) 0xC8,
+                         (byte) 0xC9, (byte) 0xCA, (byte) 0xCB, (byte) 0xCC,
+                         (byte) 0xCD, (byte) 0xCE, (byte) 0xCF, (byte) 0xD0,
+                         (byte) 0xD1, (byte) 0xD2, (byte) 0xD3, (byte) 0xD4,
+                         (byte) 0xD5, (byte) 0xD6, (byte) 0xD7, (byte) 0xD8,
+                         (byte) 0xD9, (byte) 0xDA, (byte) 0xDB, (byte) 0xDC,
+                         (byte) 0xDD, (byte) 0xDE, (byte) 0xDF, (byte) 0xE0,
+                         (byte) 0xE1, (byte) 0xE2, (byte) 0xE3, (byte) 0xE4,
+                         (byte) 0xE5, (byte) 0xE6, (byte) 0xE7, (byte) 0xE8,
+                         (byte) 0xE9, (byte) 0xEA, (byte) 0xEB, (byte) 0xEC,
+                         (byte) 0xED, (byte) 0xEE, (byte) 0xEF, (byte) 0xF0,
+                         (byte) 0xF1, (byte) 0xF2, (byte) 0xF3, (byte) 0xF4,
+                         (byte) 0xF5, (byte) 0xF6, (byte) 0xF7, (byte) 0xF8,
+                         (byte) 0xF9, (byte) 0xFA, (byte) 0xFB, (byte) 0xFC,
+                         (byte) 0xFD, (byte) 0xFE, (byte) 0xFF };
+
+        doSimpleEncodingTest("Cp1252",b);
+    }
+
+    private static void assertByteEquals(byte[] expected, ByteBuffer actual) {
+
+        assertEquals(expected.length, actual.limit());
+
+        for (int i = 0; i < expected.length; ++i) {
+
+            byte a = actual.get();
+            assertEquals(expected[i], a);
+        }
+
+    }
+
+    private void doSimpleEncodingTest(String name, byte[] testBytes)
+        throws IOException {
+
+        ZipEncoding enc = ZipEncodingHelper.getZipEncoding(name);
+
+        if (testBytes == null) {
+
+            testBytes = new byte[256];
+            for (int i = 0; i < 256; ++i) {
+                testBytes[i] = (byte) i;
+            }
+        }
+
+        String decoded = enc.decode(testBytes);
+
+        assertEquals(true, enc.canEncode(decoded));
+
+        ByteBuffer encoded = enc.encode(decoded);
+
+        assertByteEquals(testBytes, encoded);
+
+        assertEquals(false, enc.canEncode(UNENC_STRING));
+        assertByteEquals("%U2016".getBytes("US-ASCII"), enc.encode(UNENC_STRING));
+        assertEquals(false, enc.canEncode(BAD_STRING));
+        assertByteEquals(BAD_STRING_ENC.getBytes("US-ASCII"),
+                enc.encode(BAD_STRING));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/zip/ZipEntryTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/zip/ZipEntryTest.java b/src/tests/junit/org/apache/tools/zip/ZipEntryTest.java
index 804547a..3c21f6f 100644
--- a/src/tests/junit/org/apache/tools/zip/ZipEntryTest.java
+++ b/src/tests/junit/org/apache/tools/zip/ZipEntryTest.java
@@ -1,228 +1,228 @@
-/*
- *  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.zip;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.fail;
-
-/**
- * JUnit 3 testcases for org.apache.tools.zip.ZipEntry.
- *
- */
-public class ZipEntryTest {
-
-
-    /**
-     * test handling of extra fields
-     */
-    @Test
-    public void testExtraFields() {
-        AsiExtraField a = new AsiExtraField();
-        a.setDirectory(true);
-        a.setMode(0755);
-        UnrecognizedExtraField u = new UnrecognizedExtraField();
-        u.setHeaderId(ExtraFieldUtilsTest.UNRECOGNIZED_HEADER);
-        u.setLocalFileDataData(new byte[0]);
-
-        ZipEntry ze = new ZipEntry("test/");
-        ze.setExtraFields(new ZipExtraField[] {a, u});
-        byte[] data1 = ze.getExtra();
-        ZipExtraField[] result = ze.getExtraFields();
-        assertEquals("first pass", 2, result.length);
-        assertSame(a, result[0]);
-        assertSame(u, result[1]);
-
-        UnrecognizedExtraField u2 = new UnrecognizedExtraField();
-        u2.setHeaderId(ExtraFieldUtilsTest.UNRECOGNIZED_HEADER);
-        u2.setLocalFileDataData(new byte[] {1});
-
-        ze.addExtraField(u2);
-        byte[] data2 = ze.getExtra();
-        result = ze.getExtraFields();
-        assertEquals("second pass", 2, result.length);
-        assertSame(a, result[0]);
-        assertSame(u2, result[1]);
-        assertEquals("length second pass", data1.length+1, data2.length);
-
-        UnrecognizedExtraField u3 = new UnrecognizedExtraField();
-        u3.setHeaderId(new ZipShort(2));
-        u3.setLocalFileDataData(new byte[] {1});
-        ze.addExtraField(u3);
-        result = ze.getExtraFields();
-        assertEquals("third pass", 3, result.length);
-
-        ze.removeExtraField(ExtraFieldUtilsTest.UNRECOGNIZED_HEADER);
-        byte[] data3 = ze.getExtra();
-        result = ze.getExtraFields();
-        assertEquals("fourth pass", 2, result.length);
-        assertSame(a, result[0]);
-        assertSame(u3, result[1]);
-        assertEquals("length fourth pass", data2.length, data3.length);
-
-        try {
-            ze.removeExtraField(ExtraFieldUtilsTest.UNRECOGNIZED_HEADER);
-            fail("should be no such element");
-        } catch (java.util.NoSuchElementException nse) {
-            //TODO assert exception values
-        }
-    }
-
-    /**
-     * test handling of extra fields via central directory
-     */
-    @Test
-    public void testExtraFieldMerging() {
-        AsiExtraField a = new AsiExtraField();
-        a.setDirectory(true);
-        a.setMode(0755);
-        UnrecognizedExtraField u = new UnrecognizedExtraField();
-        u.setHeaderId(ExtraFieldUtilsTest.UNRECOGNIZED_HEADER);
-        u.setLocalFileDataData(new byte[0]);
-
-        ZipEntry ze = new ZipEntry("test/");
-        ze.setExtraFields(new ZipExtraField[] {a, u});
-
-        // merge
-        // Header-ID 1 + length 1 + one byte of data
-        byte[] b = ExtraFieldUtilsTest.UNRECOGNIZED_HEADER.getBytes();
-        ze.setCentralDirectoryExtra(new byte[] {b[0], b[1], 1, 0, 127});
-
-        ZipExtraField[] result = ze.getExtraFields();
-        assertEquals("first pass", 2, result.length);
-        assertSame(a, result[0]);
-        assertEquals(ExtraFieldUtilsTest.UNRECOGNIZED_HEADER,
-                     result[1].getHeaderId());
-        assertEquals(new ZipShort(0), result[1].getLocalFileDataLength());
-        assertEquals(new ZipShort(1), result[1].getCentralDirectoryLength());
-
-        // add new
-        // Header-ID 2 + length 0
-        ze.setCentralDirectoryExtra(new byte[] {2, 0, 0, 0});
-
-        result = ze.getExtraFields();
-        assertEquals("second pass", 3, result.length);
-
-        // merge
-        // Header-ID 2 + length 1 + one byte of data
-        ze.setExtra(new byte[] {2, 0, 1, 0, 127});
-
-        result = ze.getExtraFields();
-        assertEquals("third pass", 3, result.length);
-        assertSame(a, result[0]);
-        assertEquals(new ZipShort(2), result[2].getHeaderId());
-        assertEquals(new ZipShort(1), result[2].getLocalFileDataLength());
-        assertEquals(new ZipShort(0), result[2].getCentralDirectoryLength());
-    }
-
-    /**
-     * test handling of extra fields
-     */
-    @Test
-    public void testAddAsFirstExtraField() {
-        AsiExtraField a = new AsiExtraField();
-        a.setDirectory(true);
-        a.setMode(0755);
-        UnrecognizedExtraField u = new UnrecognizedExtraField();
-        u.setHeaderId(ExtraFieldUtilsTest.UNRECOGNIZED_HEADER);
-        u.setLocalFileDataData(new byte[0]);
-
-        ZipEntry ze = new ZipEntry("test/");
-        ze.setExtraFields(new ZipExtraField[] {a, u});
-        byte[] data1 = ze.getExtra();
-
-        UnrecognizedExtraField u2 = new UnrecognizedExtraField();
-        u2.setHeaderId(ExtraFieldUtilsTest.UNRECOGNIZED_HEADER);
-        u2.setLocalFileDataData(new byte[] {1});
-
-        ze.addAsFirstExtraField(u2);
-        byte[] data2 = ze.getExtra();
-        ZipExtraField[] result = ze.getExtraFields();
-        assertEquals("second pass", 2, result.length);
-        assertSame(u2, result[0]);
-        assertSame(a, result[1]);
-        assertEquals("length second pass", data1.length + 1, data2.length);
-
-        UnrecognizedExtraField u3 = new UnrecognizedExtraField();
-        u3.setHeaderId(new ZipShort(2));
-        u3.setLocalFileDataData(new byte[] {1});
-        ze.addAsFirstExtraField(u3);
-        result = ze.getExtraFields();
-        assertEquals("third pass", 3, result.length);
-        assertSame(u3, result[0]);
-        assertSame(u2, result[1]);
-        assertSame(a, result[2]);
-    }
-
-    @Test
-    public void testUnixMode() {
-        ZipEntry ze = new ZipEntry("foo");
-        assertEquals(0, ze.getPlatform());
-        ze.setUnixMode(0755);
-        assertEquals(3, ze.getPlatform());
-        assertEquals(0755,
-                     (ze.getExternalAttributes() >> 16) & 0xFFFF);
-        assertEquals(0, ze.getExternalAttributes()  & 0xFFFF);
-
-        ze.setUnixMode(0444);
-        assertEquals(3, ze.getPlatform());
-        assertEquals(0444,
-                     (ze.getExternalAttributes() >> 16) & 0xFFFF);
-        assertEquals(1, ze.getExternalAttributes()  & 0xFFFF);
-
-        ze = new ZipEntry("foo/");
-        assertEquals(0, ze.getPlatform());
-        ze.setUnixMode(0777);
-        assertEquals(3, ze.getPlatform());
-        assertEquals(0777,
-                     (ze.getExternalAttributes() >> 16) & 0xFFFF);
-        assertEquals(0x10, ze.getExternalAttributes()  & 0xFFFF);
-
-        ze.setUnixMode(0577);
-        assertEquals(3, ze.getPlatform());
-        assertEquals(0577,
-                     (ze.getExternalAttributes() >> 16) & 0xFFFF);
-        assertEquals(0x11, ze.getExternalAttributes()  & 0xFFFF);
-    }
-
-    /**
-     * Test case for
-     * <a href="https://issues.apache.org/jira/browse/COMPRESS-94"
-     * >COMPRESS-94</a>.
-     */
-    @Test
-    public void testNotEquals() {
-        ZipEntry entry1 = new ZipEntry("foo");
-        ZipEntry entry2 = new ZipEntry("bar");
-        assertFalse(entry1.equals(entry2));
-    }
-
-    @Test
-    public void testCopyConstructor() throws Exception {
-        ZipEntry archiveEntry = new ZipEntry("fred");
-        archiveEntry.setUnixMode(0664);
-        archiveEntry.setMethod(ZipEntry.DEFLATED);
-        archiveEntry.getGeneralPurposeBit().useStrongEncryption(true);
-        ZipEntry copy = new ZipEntry(archiveEntry);
-        assertEquals(archiveEntry, copy);
-    }
-}
+/*
+ *  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.zip;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.fail;
+
+/**
+ * JUnit 3 testcases for org.apache.tools.zip.ZipEntry.
+ *
+ */
+public class ZipEntryTest {
+
+
+    /**
+     * test handling of extra fields
+     */
+    @Test
+    public void testExtraFields() {
+        AsiExtraField a = new AsiExtraField();
+        a.setDirectory(true);
+        a.setMode(0755);
+        UnrecognizedExtraField u = new UnrecognizedExtraField();
+        u.setHeaderId(ExtraFieldUtilsTest.UNRECOGNIZED_HEADER);
+        u.setLocalFileDataData(new byte[0]);
+
+        ZipEntry ze = new ZipEntry("test/");
+        ze.setExtraFields(new ZipExtraField[] {a, u});
+        byte[] data1 = ze.getExtra();
+        ZipExtraField[] result = ze.getExtraFields();
+        assertEquals("first pass", 2, result.length);
+        assertSame(a, result[0]);
+        assertSame(u, result[1]);
+
+        UnrecognizedExtraField u2 = new UnrecognizedExtraField();
+        u2.setHeaderId(ExtraFieldUtilsTest.UNRECOGNIZED_HEADER);
+        u2.setLocalFileDataData(new byte[] {1});
+
+        ze.addExtraField(u2);
+        byte[] data2 = ze.getExtra();
+        result = ze.getExtraFields();
+        assertEquals("second pass", 2, result.length);
+        assertSame(a, result[0]);
+        assertSame(u2, result[1]);
+        assertEquals("length second pass", data1.length+1, data2.length);
+
+        UnrecognizedExtraField u3 = new UnrecognizedExtraField();
+        u3.setHeaderId(new ZipShort(2));
+        u3.setLocalFileDataData(new byte[] {1});
+        ze.addExtraField(u3);
+        result = ze.getExtraFields();
+        assertEquals("third pass", 3, result.length);
+
+        ze.removeExtraField(ExtraFieldUtilsTest.UNRECOGNIZED_HEADER);
+        byte[] data3 = ze.getExtra();
+        result = ze.getExtraFields();
+        assertEquals("fourth pass", 2, result.length);
+        assertSame(a, result[0]);
+        assertSame(u3, result[1]);
+        assertEquals("length fourth pass", data2.length, data3.length);
+
+        try {
+            ze.removeExtraField(ExtraFieldUtilsTest.UNRECOGNIZED_HEADER);
+            fail("should be no such element");
+        } catch (java.util.NoSuchElementException nse) {
+            //TODO assert exception values
+        }
+    }
+
+    /**
+     * test handling of extra fields via central directory
+     */
+    @Test
+    public void testExtraFieldMerging() {
+        AsiExtraField a = new AsiExtraField();
+        a.setDirectory(true);
+        a.setMode(0755);
+        UnrecognizedExtraField u = new UnrecognizedExtraField();
+        u.setHeaderId(ExtraFieldUtilsTest.UNRECOGNIZED_HEADER);
+        u.setLocalFileDataData(new byte[0]);
+
+        ZipEntry ze = new ZipEntry("test/");
+        ze.setExtraFields(new ZipExtraField[] {a, u});
+
+        // merge
+        // Header-ID 1 + length 1 + one byte of data
+        byte[] b = ExtraFieldUtilsTest.UNRECOGNIZED_HEADER.getBytes();
+        ze.setCentralDirectoryExtra(new byte[] {b[0], b[1], 1, 0, 127});
+
+        ZipExtraField[] result = ze.getExtraFields();
+        assertEquals("first pass", 2, result.length);
+        assertSame(a, result[0]);
+        assertEquals(ExtraFieldUtilsTest.UNRECOGNIZED_HEADER,
+                     result[1].getHeaderId());
+        assertEquals(new ZipShort(0), result[1].getLocalFileDataLength());
+        assertEquals(new ZipShort(1), result[1].getCentralDirectoryLength());
+
+        // add new
+        // Header-ID 2 + length 0
+        ze.setCentralDirectoryExtra(new byte[] {2, 0, 0, 0});
+
+        result = ze.getExtraFields();
+        assertEquals("second pass", 3, result.length);
+
+        // merge
+        // Header-ID 2 + length 1 + one byte of data
+        ze.setExtra(new byte[] {2, 0, 1, 0, 127});
+
+        result = ze.getExtraFields();
+        assertEquals("third pass", 3, result.length);
+        assertSame(a, result[0]);
+        assertEquals(new ZipShort(2), result[2].getHeaderId());
+        assertEquals(new ZipShort(1), result[2].getLocalFileDataLength());
+        assertEquals(new ZipShort(0), result[2].getCentralDirectoryLength());
+    }
+
+    /**
+     * test handling of extra fields
+     */
+    @Test
+    public void testAddAsFirstExtraField() {
+        AsiExtraField a = new AsiExtraField();
+        a.setDirectory(true);
+        a.setMode(0755);
+        UnrecognizedExtraField u = new UnrecognizedExtraField();
+        u.setHeaderId(ExtraFieldUtilsTest.UNRECOGNIZED_HEADER);
+        u.setLocalFileDataData(new byte[0]);
+
+        ZipEntry ze = new ZipEntry("test/");
+        ze.setExtraFields(new ZipExtraField[] {a, u});
+        byte[] data1 = ze.getExtra();
+
+        UnrecognizedExtraField u2 = new UnrecognizedExtraField();
+        u2.setHeaderId(ExtraFieldUtilsTest.UNRECOGNIZED_HEADER);
+        u2.setLocalFileDataData(new byte[] {1});
+
+        ze.addAsFirstExtraField(u2);
+        byte[] data2 = ze.getExtra();
+        ZipExtraField[] result = ze.getExtraFields();
+        assertEquals("second pass", 2, result.length);
+        assertSame(u2, result[0]);
+        assertSame(a, result[1]);
+        assertEquals("length second pass", data1.length + 1, data2.length);
+
+        UnrecognizedExtraField u3 = new UnrecognizedExtraField();
+        u3.setHeaderId(new ZipShort(2));
+        u3.setLocalFileDataData(new byte[] {1});
+        ze.addAsFirstExtraField(u3);
+        result = ze.getExtraFields();
+        assertEquals("third pass", 3, result.length);
+        assertSame(u3, result[0]);
+        assertSame(u2, result[1]);
+        assertSame(a, result[2]);
+    }
+
+    @Test
+    public void testUnixMode() {
+        ZipEntry ze = new ZipEntry("foo");
+        assertEquals(0, ze.getPlatform());
+        ze.setUnixMode(0755);
+        assertEquals(3, ze.getPlatform());
+        assertEquals(0755,
+                     (ze.getExternalAttributes() >> 16) & 0xFFFF);
+        assertEquals(0, ze.getExternalAttributes()  & 0xFFFF);
+
+        ze.setUnixMode(0444);
+        assertEquals(3, ze.getPlatform());
+        assertEquals(0444,
+                     (ze.getExternalAttributes() >> 16) & 0xFFFF);
+        assertEquals(1, ze.getExternalAttributes()  & 0xFFFF);
+
+        ze = new ZipEntry("foo/");
+        assertEquals(0, ze.getPlatform());
+        ze.setUnixMode(0777);
+        assertEquals(3, ze.getPlatform());
+        assertEquals(0777,
+                     (ze.getExternalAttributes() >> 16) & 0xFFFF);
+        assertEquals(0x10, ze.getExternalAttributes()  & 0xFFFF);
+
+        ze.setUnixMode(0577);
+        assertEquals(3, ze.getPlatform());
+        assertEquals(0577,
+                     (ze.getExternalAttributes() >> 16) & 0xFFFF);
+        assertEquals(0x11, ze.getExternalAttributes()  & 0xFFFF);
+    }
+
+    /**
+     * Test case for
+     * <a href="https://issues.apache.org/jira/browse/COMPRESS-94"
+     * >COMPRESS-94</a>.
+     */
+    @Test
+    public void testNotEquals() {
+        ZipEntry entry1 = new ZipEntry("foo");
+        ZipEntry entry2 = new ZipEntry("bar");
+        assertFalse(entry1.equals(entry2));
+    }
+
+    @Test
+    public void testCopyConstructor() throws Exception {
+        ZipEntry archiveEntry = new ZipEntry("fred");
+        archiveEntry.setUnixMode(0664);
+        archiveEntry.setMethod(ZipEntry.DEFLATED);
+        archiveEntry.getGeneralPurposeBit().useStrongEncryption(true);
+        ZipEntry copy = new ZipEntry(archiveEntry);
+        assertEquals(archiveEntry, copy);
+    }
+}


Re: [01/21] ant git commit: Normalise tabulation and line breaks

Posted by Stefan Bodewig <bo...@apache.org>.
Hi Gintas

we frequently merge changes from the 1.9.x branch to master and this
will become quite a bit harder if files in the two branches differ by
whitespace.

Do you think you could run whatever tool you've used on the 1.9.x branch
as well?

Thanks

        Stefan

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


[13/21] ant git commit: Normalise tabulation and line breaks

Posted by gi...@apache.org.
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/CommandlineJavaTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/CommandlineJavaTest.java b/src/tests/junit/org/apache/tools/ant/types/CommandlineJavaTest.java
index b8ce90f..abfb70f 100644
--- a/src/tests/junit/org/apache/tools/ant/types/CommandlineJavaTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/CommandlineJavaTest.java
@@ -1,191 +1,191 @@
-/*
- *  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.types;
-
-
-import org.apache.tools.ant.MagicNames;
-import org.apache.tools.ant.Project;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-/**
- * JUnit testcases for org.apache.tools.ant.CommandlineJava
- *
- */
-public class CommandlineJavaTest {
-
-    private String cloneVm;
-
-
-    private Project project;
-
-    @Before
-    public void setUp() {
-        project = new Project();
-        project.setBasedir(System.getProperty("root"));
-        project.setProperty("build.sysclasspath", "ignore");
-        cloneVm = System.getProperty("ant.build.clonevm");
-        if (cloneVm != null) {
-            System.setProperty("ant.build.clonevm", "false");
-        }
-    }
-
-    @After
-    public void tearDown() {
-        if (cloneVm != null) {
-            System.setProperty("ant.build.clonevm", cloneVm);
-        }
-    }
-
-    @Test
-    public void testGetCommandline() throws Exception {
-        CommandlineJava c = new CommandlineJava();
-        c.createArgument().setValue("org.apache.tools.ant.CommandlineJavaTest");
-        c.setClassname("junit.textui.TestRunner");
-        c.createVmArgument().setValue("-Djava.compiler=NONE");
-        String[] s = c.getCommandline();
-        assertEquals("no classpath", 4, s.length);
-        /*
-         * After changing CommandlineJava to search for the java
-         * executable, I don't know, how to tests the value returned
-         * here without using the same logic as applied in the class
-         * itself.
-         *
-         * assertTrue("no classpath", "java", s[0]);
-         */
-        assertEquals("no classpath", "-Djava.compiler=NONE", s[1]);
-        assertEquals("no classpath", "junit.textui.TestRunner", s[2]);
-        assertEquals("no classpath",
-                     "org.apache.tools.ant.CommandlineJavaTest", s[3]);
-        try {
-            c.clone();
-        } catch (NullPointerException ex) {
-            fail("cloning should work without classpath specified");
-        }
-
-        c.createClasspath(project).setLocation(project.resolveFile("build.xml"));
-        c.createClasspath(project).setLocation(project.resolveFile(
-            System.getProperty(MagicNames.ANT_HOME)+"/lib/ant.jar"));
-        s = c.getCommandline();
-        assertEquals("with classpath", 6, s.length);
-        //        assertEquals("with classpath", "java", s[0]);
-        assertEquals("with classpath", "-Djava.compiler=NONE", s[1]);
-        assertEquals("with classpath", "-classpath", s[2]);
-        assertTrue("build.xml contained",
-               s[3].indexOf("build.xml"+java.io.File.pathSeparator) >= 0);
-        assertTrue("ant.jar contained", s[3].endsWith("ant.jar"));
-        assertEquals("with classpath", "junit.textui.TestRunner", s[4]);
-        assertEquals("with classpath",
-                     "org.apache.tools.ant.CommandlineJavaTest", s[5]);
-    }
-
-    @Test
-    public void testJarOption() throws Exception {
-        CommandlineJava c = new CommandlineJava();
-        c.createArgument().setValue("arg1");
-        c.setJar("myfile.jar");
-        c.createVmArgument().setValue("-classic");
-        c.createVmArgument().setValue("-Dx=y");
-        String[] s = c.getCommandline();
-        assertEquals("-classic", s[1]);
-        assertEquals("-Dx=y", s[2]);
-        assertEquals("-jar", s[3]);
-        assertEquals("myfile.jar", s[4]);
-        assertEquals("arg1", s[5]);
-    }
-
-    @Test
-    public void testSysproperties() {
-        String currentClasspath = System.getProperty("java.class.path");
-        assertNotNull(currentClasspath);
-        assertNull(System.getProperty("key"));
-        CommandlineJava c = new CommandlineJava();
-        Environment.Variable v = new Environment.Variable();
-        v.setKey("key");
-        v.setValue("value");
-        c.addSysproperty(v);
-
-        project.setProperty("key2", "value2");
-        PropertySet ps = new PropertySet();
-        ps.setProject(project);
-        ps.appendName("key2");
-        c.addSyspropertyset(ps);
-
-        try {
-            c.setSystemProperties();
-            String newClasspath = System.getProperty("java.class.path");
-            assertNotNull(newClasspath);
-            assertEquals(currentClasspath, newClasspath);
-            assertNotNull(System.getProperty("key"));
-            assertEquals("value", System.getProperty("key"));
-            assertTrue(System.getProperties().containsKey("java.class.path"));
-            assertNotNull(System.getProperty("key2"));
-            assertEquals("value2", System.getProperty("key2"));
-        } finally {
-            c.restoreSystemProperties();
-        }
-        assertNull(System.getProperty("key"));
-        assertNull(System.getProperty("key2"));
-    }
-
-    @Test
-    public void testAssertions() throws Exception {
-        CommandlineJava c = new CommandlineJava();
-        c.createArgument().setValue("org.apache.tools.ant.CommandlineJavaTest");
-        c.setClassname("junit.textui.TestRunner");
-        c.createVmArgument().setValue("-Djava.compiler=NONE");
-        Assertions a = new Assertions();
-        a.setProject(project);
-        Assertions.EnabledAssertion ea = new Assertions.EnabledAssertion();
-        ea.setClass("junit.textui.TestRunner");
-        a.addEnable(ea);
-        c.setAssertions(a);
-
-        String[] expected = new String[] {
-            null,
-            "-Djava.compiler=NONE",
-            "-ea:junit.textui.TestRunner",
-            "junit.textui.TestRunner",
-            "org.apache.tools.ant.CommandlineJavaTest",
-        };
-            
-        // only the second iteration would pass because of PR 27218
-        for (int i = 0; i < 3; i++) {
-            String[] s = c.getCommandline();
-            assertEquals(expected.length, s.length);
-            for (int j = 1; j < expected.length; j++) {
-                assertEquals(expected[j], s[j]);
-            }
-        }
-        CommandlineJava c2 = (CommandlineJava) c.clone();
-        String[] s = c2.getCommandline();
-        assertEquals(expected.length, s.length);
-        for (int j = 1; j < expected.length; j++) {
-            assertEquals(expected[j], s[j]);
-        }
-    }
-
-}
+/*
+ *  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.types;
+
+
+import org.apache.tools.ant.MagicNames;
+import org.apache.tools.ant.Project;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+/**
+ * JUnit testcases for org.apache.tools.ant.CommandlineJava
+ *
+ */
+public class CommandlineJavaTest {
+
+    private String cloneVm;
+
+
+    private Project project;
+
+    @Before
+    public void setUp() {
+        project = new Project();
+        project.setBasedir(System.getProperty("root"));
+        project.setProperty("build.sysclasspath", "ignore");
+        cloneVm = System.getProperty("ant.build.clonevm");
+        if (cloneVm != null) {
+            System.setProperty("ant.build.clonevm", "false");
+        }
+    }
+
+    @After
+    public void tearDown() {
+        if (cloneVm != null) {
+            System.setProperty("ant.build.clonevm", cloneVm);
+        }
+    }
+
+    @Test
+    public void testGetCommandline() throws Exception {
+        CommandlineJava c = new CommandlineJava();
+        c.createArgument().setValue("org.apache.tools.ant.CommandlineJavaTest");
+        c.setClassname("junit.textui.TestRunner");
+        c.createVmArgument().setValue("-Djava.compiler=NONE");
+        String[] s = c.getCommandline();
+        assertEquals("no classpath", 4, s.length);
+        /*
+         * After changing CommandlineJava to search for the java
+         * executable, I don't know, how to tests the value returned
+         * here without using the same logic as applied in the class
+         * itself.
+         *
+         * assertTrue("no classpath", "java", s[0]);
+         */
+        assertEquals("no classpath", "-Djava.compiler=NONE", s[1]);
+        assertEquals("no classpath", "junit.textui.TestRunner", s[2]);
+        assertEquals("no classpath",
+                     "org.apache.tools.ant.CommandlineJavaTest", s[3]);
+        try {
+            c.clone();
+        } catch (NullPointerException ex) {
+            fail("cloning should work without classpath specified");
+        }
+
+        c.createClasspath(project).setLocation(project.resolveFile("build.xml"));
+        c.createClasspath(project).setLocation(project.resolveFile(
+            System.getProperty(MagicNames.ANT_HOME)+"/lib/ant.jar"));
+        s = c.getCommandline();
+        assertEquals("with classpath", 6, s.length);
+        //        assertEquals("with classpath", "java", s[0]);
+        assertEquals("with classpath", "-Djava.compiler=NONE", s[1]);
+        assertEquals("with classpath", "-classpath", s[2]);
+        assertTrue("build.xml contained",
+               s[3].indexOf("build.xml"+java.io.File.pathSeparator) >= 0);
+        assertTrue("ant.jar contained", s[3].endsWith("ant.jar"));
+        assertEquals("with classpath", "junit.textui.TestRunner", s[4]);
+        assertEquals("with classpath",
+                     "org.apache.tools.ant.CommandlineJavaTest", s[5]);
+    }
+
+    @Test
+    public void testJarOption() throws Exception {
+        CommandlineJava c = new CommandlineJava();
+        c.createArgument().setValue("arg1");
+        c.setJar("myfile.jar");
+        c.createVmArgument().setValue("-classic");
+        c.createVmArgument().setValue("-Dx=y");
+        String[] s = c.getCommandline();
+        assertEquals("-classic", s[1]);
+        assertEquals("-Dx=y", s[2]);
+        assertEquals("-jar", s[3]);
+        assertEquals("myfile.jar", s[4]);
+        assertEquals("arg1", s[5]);
+    }
+
+    @Test
+    public void testSysproperties() {
+        String currentClasspath = System.getProperty("java.class.path");
+        assertNotNull(currentClasspath);
+        assertNull(System.getProperty("key"));
+        CommandlineJava c = new CommandlineJava();
+        Environment.Variable v = new Environment.Variable();
+        v.setKey("key");
+        v.setValue("value");
+        c.addSysproperty(v);
+
+        project.setProperty("key2", "value2");
+        PropertySet ps = new PropertySet();
+        ps.setProject(project);
+        ps.appendName("key2");
+        c.addSyspropertyset(ps);
+
+        try {
+            c.setSystemProperties();
+            String newClasspath = System.getProperty("java.class.path");
+            assertNotNull(newClasspath);
+            assertEquals(currentClasspath, newClasspath);
+            assertNotNull(System.getProperty("key"));
+            assertEquals("value", System.getProperty("key"));
+            assertTrue(System.getProperties().containsKey("java.class.path"));
+            assertNotNull(System.getProperty("key2"));
+            assertEquals("value2", System.getProperty("key2"));
+        } finally {
+            c.restoreSystemProperties();
+        }
+        assertNull(System.getProperty("key"));
+        assertNull(System.getProperty("key2"));
+    }
+
+    @Test
+    public void testAssertions() throws Exception {
+        CommandlineJava c = new CommandlineJava();
+        c.createArgument().setValue("org.apache.tools.ant.CommandlineJavaTest");
+        c.setClassname("junit.textui.TestRunner");
+        c.createVmArgument().setValue("-Djava.compiler=NONE");
+        Assertions a = new Assertions();
+        a.setProject(project);
+        Assertions.EnabledAssertion ea = new Assertions.EnabledAssertion();
+        ea.setClass("junit.textui.TestRunner");
+        a.addEnable(ea);
+        c.setAssertions(a);
+
+        String[] expected = new String[] {
+            null,
+            "-Djava.compiler=NONE",
+            "-ea:junit.textui.TestRunner",
+            "junit.textui.TestRunner",
+            "org.apache.tools.ant.CommandlineJavaTest",
+        };
+
+        // only the second iteration would pass because of PR 27218
+        for (int i = 0; i < 3; i++) {
+            String[] s = c.getCommandline();
+            assertEquals(expected.length, s.length);
+            for (int j = 1; j < expected.length; j++) {
+                assertEquals(expected[j], s[j]);
+            }
+        }
+        CommandlineJava c2 = (CommandlineJava) c.clone();
+        String[] s = c2.getCommandline();
+        assertEquals(expected.length, s.length);
+        for (int j = 1; j < expected.length; j++) {
+            assertEquals(expected[j], s[j]);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/CommandlineTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/CommandlineTest.java b/src/tests/junit/org/apache/tools/ant/types/CommandlineTest.java
index ca5fef2..e8e4442 100644
--- a/src/tests/junit/org/apache/tools/ant/types/CommandlineTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/CommandlineTest.java
@@ -1,180 +1,180 @@
-/*
- *  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.types;
-
-import org.apache.tools.ant.BuildException;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-import static org.junit.Assert.assertNotNull;
-
-/**
- * JUnit 3 testcases for org.apache.tools.ant.CommandLine
- *
- */
-public class CommandlineTest {
-
-    @Test
-    public void testTokenizer() {
-        String[] s = Commandline.translateCommandline("1 2 3");
-        assertEquals("Simple case", 3, s.length);
-        for (int i=0; i<3; i++) {
-            assertEquals(""+(i+1), s[i]);
-        }
-
-        s = Commandline.translateCommandline("");
-        assertEquals("empty string", 0, s.length);
-
-        s = Commandline.translateCommandline(null);
-        assertEquals("null", 0, s.length);
-
-        s = Commandline.translateCommandline("1 \'2\' 3");
-        assertEquals("Simple case with single quotes", 3, s.length);
-        assertEquals("Single quotes have been stripped", "2", s[1]);
-
-        s = Commandline.translateCommandline("1 \"2\" 3");
-        assertEquals("Simple case with double quotes", 3, s.length);
-        assertEquals("Double quotes have been stripped", "2", s[1]);
-
-        s = Commandline.translateCommandline("1 \"2 3\" 4");
-        assertEquals("Case with double quotes and whitespace", 3, s.length);
-        assertEquals("Double quotes stripped, space included", "2 3", s[1]);
-
-        s = Commandline.translateCommandline("1 \"2\'3\" 4");
-        assertEquals("Case with double quotes around single quote", 3, s.length);
-        assertEquals("Double quotes stripped, single quote included", "2\'3",
-                     s[1]);
-
-        s = Commandline.translateCommandline("1 \'2 3\' 4");
-        assertEquals("Case with single quotes and whitespace", 3, s.length);
-        assertEquals("Single quotes stripped, space included", "2 3", s[1]);
-
-        s = Commandline.translateCommandline("1 \'2\"3\' 4");
-        assertEquals("Case with single quotes around double quote", 3, s.length);
-        assertEquals("Single quotes stripped, double quote included", "2\"3",
-                     s[1]);
-
-        // \ doesn't have a special meaning anymore - this is different from
-        // what the Unix sh does but causes a lot of problems on DOS
-        // based platforms otherwise
-        s = Commandline.translateCommandline("1 2\\ 3 4");
-        assertEquals("case with quoted whitespace", 4, s.length);
-        assertEquals("backslash included", "2\\", s[1]);
-
-        // "" should become a single empty argument, same for ''
-        // PR 5906
-        s = Commandline.translateCommandline("\"\" a");
-        assertEquals("Doublequoted null arg prepend", 2, s.length);
-        assertEquals("Doublequoted null arg prepend", "", s[0]);
-        assertEquals("Doublequoted null arg prepend", "a", s[1]);
-        s = Commandline.translateCommandline("a \"\"");
-        assertEquals("Doublequoted null arg append", 2, s.length);
-        assertEquals("Doublequoted null arg append", "a", s[0]);
-        assertEquals("Doublequoted null arg append", "", s[1]);
-        s = Commandline.translateCommandline("\"\"");
-        assertEquals("Doublequoted null arg", 1, s.length);
-        assertEquals("Doublequoted null arg", "", s[0]);
-
-        s = Commandline.translateCommandline("\'\' a");
-        assertEquals("Singlequoted null arg prepend", 2, s.length);
-        assertEquals("Singlequoted null arg prepend", "", s[0]);
-        assertEquals("Singlequoted null arg prepend", "a", s[1]);
-        s = Commandline.translateCommandline("a \'\'");
-        assertEquals("Singlequoted null arg append", 2, s.length);
-        assertEquals("Singlequoted null arg append", "a", s[0]);
-        assertEquals("Singlequoted null arg append", "", s[1]);
-        s = Commandline.translateCommandline("\'\'");
-        assertEquals("Singlequoted null arg", 1, s.length);
-        assertEquals("Singlequoted null arg", "", s[0]);
-
-        // now to the expected failures
-
-        try {
-            Commandline.translateCommandline("a \'b c");
-            fail("unbalanced single quotes undetected");
-        } catch (BuildException be) {
-            assertEquals("unbalanced quotes in a \'b c", be.getMessage());
-        }
-
-        try {
-            Commandline.translateCommandline("a \"b c");
-            fail("unbalanced double quotes undetected");
-        } catch (BuildException be) {
-            assertEquals("unbalanced quotes in a \"b c", be.getMessage());
-        }
-    }
-
-    @Test
-    public void testToString() {
-        assertEquals("", Commandline.toString(new String[0]));
-        assertEquals("", Commandline.toString(null));
-        assertEquals("1 2 3", Commandline.toString(new String[] {"1", "2", "3"}));
-        assertEquals("1 \"2 3\"", Commandline.toString(new String[] {"1", "2 3"}));
-        assertEquals("1 \"2\'3\"", Commandline.toString(new String[] {"1", "2\'3"}));
-        assertEquals("1 \'2\"3\'", Commandline.toString(new String[] {"1", "2\"3"}));
-    }
-
-    @Test
-    public void testAwkCommand() {
-        Commandline c = new Commandline();
-        c.setExecutable("awk");
-        c.createArgument().setValue("'NR == 2 { print $NF }'");
-        String[] s = c.getCommandline();
-        assertNotNull(s);
-        assertEquals(2, s.length);
-        assertEquals("awk", s[0]);
-        assertEquals("'NR == 2 { print $NF }'", s[1]);
-    }
-
-    @Test
-    public void testPrefix() {
-        Commandline c = new Commandline();
-        Commandline.Argument a = c.createArgument();
-        a.setValue("foo");
-        a.setPrefix("-f=");
-        String[] s = c.getCommandline();
-        assertEquals(1, s.length);
-        assertEquals("-f=foo", s[0]);
-    }
-
-    @Test
-    public void testSuffix() {
-        Commandline c = new Commandline();
-        Commandline.Argument a = c.createArgument();
-        a.setValue("foo");
-        a.setSuffix(",1");
-        String[] s = c.getCommandline();
-        assertEquals(1, s.length);
-        assertEquals("foo,1", s[0]);
-    }
-
-    @Test
-    public void testPrefixSuffixLine() {
-        Commandline c = new Commandline();
-        Commandline.Argument a = c.createArgument();
-        a.setLine("one two");
-        a.setPrefix("number ");
-        a.setSuffix(".");
-        String[] s = c.getCommandline();
-        assertEquals(2, s.length);
-        assertEquals("number one.", s[0]);
-        assertEquals("number two.", s[1]);
-    }
-}
+/*
+ *  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.types;
+
+import org.apache.tools.ant.BuildException;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * JUnit 3 testcases for org.apache.tools.ant.CommandLine
+ *
+ */
+public class CommandlineTest {
+
+    @Test
+    public void testTokenizer() {
+        String[] s = Commandline.translateCommandline("1 2 3");
+        assertEquals("Simple case", 3, s.length);
+        for (int i=0; i<3; i++) {
+            assertEquals(""+(i+1), s[i]);
+        }
+
+        s = Commandline.translateCommandline("");
+        assertEquals("empty string", 0, s.length);
+
+        s = Commandline.translateCommandline(null);
+        assertEquals("null", 0, s.length);
+
+        s = Commandline.translateCommandline("1 \'2\' 3");
+        assertEquals("Simple case with single quotes", 3, s.length);
+        assertEquals("Single quotes have been stripped", "2", s[1]);
+
+        s = Commandline.translateCommandline("1 \"2\" 3");
+        assertEquals("Simple case with double quotes", 3, s.length);
+        assertEquals("Double quotes have been stripped", "2", s[1]);
+
+        s = Commandline.translateCommandline("1 \"2 3\" 4");
+        assertEquals("Case with double quotes and whitespace", 3, s.length);
+        assertEquals("Double quotes stripped, space included", "2 3", s[1]);
+
+        s = Commandline.translateCommandline("1 \"2\'3\" 4");
+        assertEquals("Case with double quotes around single quote", 3, s.length);
+        assertEquals("Double quotes stripped, single quote included", "2\'3",
+                     s[1]);
+
+        s = Commandline.translateCommandline("1 \'2 3\' 4");
+        assertEquals("Case with single quotes and whitespace", 3, s.length);
+        assertEquals("Single quotes stripped, space included", "2 3", s[1]);
+
+        s = Commandline.translateCommandline("1 \'2\"3\' 4");
+        assertEquals("Case with single quotes around double quote", 3, s.length);
+        assertEquals("Single quotes stripped, double quote included", "2\"3",
+                     s[1]);
+
+        // \ doesn't have a special meaning anymore - this is different from
+        // what the Unix sh does but causes a lot of problems on DOS
+        // based platforms otherwise
+        s = Commandline.translateCommandline("1 2\\ 3 4");
+        assertEquals("case with quoted whitespace", 4, s.length);
+        assertEquals("backslash included", "2\\", s[1]);
+
+        // "" should become a single empty argument, same for ''
+        // PR 5906
+        s = Commandline.translateCommandline("\"\" a");
+        assertEquals("Doublequoted null arg prepend", 2, s.length);
+        assertEquals("Doublequoted null arg prepend", "", s[0]);
+        assertEquals("Doublequoted null arg prepend", "a", s[1]);
+        s = Commandline.translateCommandline("a \"\"");
+        assertEquals("Doublequoted null arg append", 2, s.length);
+        assertEquals("Doublequoted null arg append", "a", s[0]);
+        assertEquals("Doublequoted null arg append", "", s[1]);
+        s = Commandline.translateCommandline("\"\"");
+        assertEquals("Doublequoted null arg", 1, s.length);
+        assertEquals("Doublequoted null arg", "", s[0]);
+
+        s = Commandline.translateCommandline("\'\' a");
+        assertEquals("Singlequoted null arg prepend", 2, s.length);
+        assertEquals("Singlequoted null arg prepend", "", s[0]);
+        assertEquals("Singlequoted null arg prepend", "a", s[1]);
+        s = Commandline.translateCommandline("a \'\'");
+        assertEquals("Singlequoted null arg append", 2, s.length);
+        assertEquals("Singlequoted null arg append", "a", s[0]);
+        assertEquals("Singlequoted null arg append", "", s[1]);
+        s = Commandline.translateCommandline("\'\'");
+        assertEquals("Singlequoted null arg", 1, s.length);
+        assertEquals("Singlequoted null arg", "", s[0]);
+
+        // now to the expected failures
+
+        try {
+            Commandline.translateCommandline("a \'b c");
+            fail("unbalanced single quotes undetected");
+        } catch (BuildException be) {
+            assertEquals("unbalanced quotes in a \'b c", be.getMessage());
+        }
+
+        try {
+            Commandline.translateCommandline("a \"b c");
+            fail("unbalanced double quotes undetected");
+        } catch (BuildException be) {
+            assertEquals("unbalanced quotes in a \"b c", be.getMessage());
+        }
+    }
+
+    @Test
+    public void testToString() {
+        assertEquals("", Commandline.toString(new String[0]));
+        assertEquals("", Commandline.toString(null));
+        assertEquals("1 2 3", Commandline.toString(new String[] {"1", "2", "3"}));
+        assertEquals("1 \"2 3\"", Commandline.toString(new String[] {"1", "2 3"}));
+        assertEquals("1 \"2\'3\"", Commandline.toString(new String[] {"1", "2\'3"}));
+        assertEquals("1 \'2\"3\'", Commandline.toString(new String[] {"1", "2\"3"}));
+    }
+
+    @Test
+    public void testAwkCommand() {
+        Commandline c = new Commandline();
+        c.setExecutable("awk");
+        c.createArgument().setValue("'NR == 2 { print $NF }'");
+        String[] s = c.getCommandline();
+        assertNotNull(s);
+        assertEquals(2, s.length);
+        assertEquals("awk", s[0]);
+        assertEquals("'NR == 2 { print $NF }'", s[1]);
+    }
+
+    @Test
+    public void testPrefix() {
+        Commandline c = new Commandline();
+        Commandline.Argument a = c.createArgument();
+        a.setValue("foo");
+        a.setPrefix("-f=");
+        String[] s = c.getCommandline();
+        assertEquals(1, s.length);
+        assertEquals("-f=foo", s[0]);
+    }
+
+    @Test
+    public void testSuffix() {
+        Commandline c = new Commandline();
+        Commandline.Argument a = c.createArgument();
+        a.setValue("foo");
+        a.setSuffix(",1");
+        String[] s = c.getCommandline();
+        assertEquals(1, s.length);
+        assertEquals("foo,1", s[0]);
+    }
+
+    @Test
+    public void testPrefixSuffixLine() {
+        Commandline c = new Commandline();
+        Commandline.Argument a = c.createArgument();
+        a.setLine("one two");
+        a.setPrefix("number ");
+        a.setSuffix(".");
+        String[] s = c.getCommandline();
+        assertEquals(2, s.length);
+        assertEquals("number one.", s[0]);
+        assertEquals("number two.", s[1]);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/DescriptionTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/DescriptionTest.java b/src/tests/junit/org/apache/tools/ant/types/DescriptionTest.java
index f021228..31b56f9 100644
--- a/src/tests/junit/org/apache/tools/ant/types/DescriptionTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/DescriptionTest.java
@@ -1,59 +1,59 @@
-/*
- *  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.types;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * FilterSet testing
- *
- */
-public class DescriptionTest {
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-    
-    @Test
-    public void test1() {
-        buildRule.configureProject("src/etc/testcases/types/description1.xml");
-        assertEquals("Single description failed", "Test Project Description", buildRule.getProject().getDescription());
-    }
-
-    @Test
-    public void test2() {
-        buildRule.configureProject("src/etc/testcases/types/description2.xml");
-        assertEquals("Multi line description failed", "Multi Line\nProject Description", buildRule.getProject().getDescription());
-    }
-
-    @Test
-    public void test3() {
-        buildRule.configureProject("src/etc/testcases/types/description3.xml");
-        assertEquals("Multi instance description failed", "Multi Instance Project Description", buildRule.getProject().getDescription());
-    }
-
-    @Test
-    public void test4() {
-        buildRule.configureProject("src/etc/testcases/types/description4.xml");
-        assertEquals("Multi instance nested description failed", "Multi Instance Nested Project Description", buildRule.getProject().getDescription());
-    }
-}
+/*
+ *  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.types;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * FilterSet testing
+ *
+ */
+public class DescriptionTest {
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Test
+    public void test1() {
+        buildRule.configureProject("src/etc/testcases/types/description1.xml");
+        assertEquals("Single description failed", "Test Project Description", buildRule.getProject().getDescription());
+    }
+
+    @Test
+    public void test2() {
+        buildRule.configureProject("src/etc/testcases/types/description2.xml");
+        assertEquals("Multi line description failed", "Multi Line\nProject Description", buildRule.getProject().getDescription());
+    }
+
+    @Test
+    public void test3() {
+        buildRule.configureProject("src/etc/testcases/types/description3.xml");
+        assertEquals("Multi instance description failed", "Multi Instance Project Description", buildRule.getProject().getDescription());
+    }
+
+    @Test
+    public void test4() {
+        buildRule.configureProject("src/etc/testcases/types/description4.xml");
+        assertEquals("Multi instance nested description failed", "Multi Instance Nested Project Description", buildRule.getProject().getDescription());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/DirSetTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/DirSetTest.java b/src/tests/junit/org/apache/tools/ant/types/DirSetTest.java
index 4fd2b5a..8c659ba 100644
--- a/src/tests/junit/org/apache/tools/ant/types/DirSetTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/DirSetTest.java
@@ -1,94 +1,94 @@
-/*
- *  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.types;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import org.apache.tools.ant.BuildException;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-/**
- * JUnit 3 testcases for org.apache.tools.ant.types.DirSet.
- *
- */
-public class DirSetTest extends AbstractFileSetTest {
-
-    protected AbstractFileSet getInstance() {
-        return new DirSet();
-    }
-
-    @Test
-    public void testFileSetIsNoDirSet() {
-        DirSet ds = (DirSet) getInstance();
-        ds.setProject(getProject());
-        FileSet fs = new FileSet();
-        fs.setProject(getProject());
-        getProject().addReference("dummy", fs);
-        ds.setRefid(new Reference(getProject(), "dummy"));
-        try {
-            ds.getDir(getProject());
-            fail("DirSet created from FileSet reference");
-        } catch (BuildException e) {
-            assertEquals("dummy doesn\'t denote a DirSet", e.getMessage());
-        }
-
-        ds = (DirSet) getInstance();
-        ds.setProject(getProject());
-        getProject().addReference("dummy2", ds);
-        fs.setRefid(new Reference(getProject(), "dummy2"));
-        try {
-            fs.getDir(getProject());
-            fail("FileSet created from DirSet reference");
-        } catch (BuildException e) {
-            assertEquals("dummy2 doesn\'t denote a FileSet", e.getMessage());
-        }
-    }
-
-    public void testToString() throws Exception {
-        File tmp = File.createTempFile("DirSetTest", "");
-        try {
-            tmp.delete();
-            File a = new File(tmp, "a");
-            a.mkdirs();
-            File b = new File(tmp, "b");
-            File bc = new File(b, "c");
-            bc.mkdirs();
-            new FileOutputStream(new File(a, "x")).close();
-            new FileOutputStream(new File(b, "x")).close();
-            new FileOutputStream(new File(bc, "x")).close();
-            DirSet ds = new DirSet();
-            ds.setProject(getProject());
-            ds.setDir(tmp);
-            ds.setIncludes("b/");
-            assertEquals("b;b" + File.separator + "c", ds.toString());
-        } finally {
-            new File(tmp, "a/x").delete();
-            new File(tmp, "a").delete();
-            new File(tmp, "b/c/x").delete();
-            new File(tmp, "b/c").delete();
-            new File(tmp, "b/x").delete();
-            new File(tmp, "b").delete();
-            tmp.delete();
-        }
-    }
-
-}
+/*
+ *  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.types;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import org.apache.tools.ant.BuildException;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * JUnit 3 testcases for org.apache.tools.ant.types.DirSet.
+ *
+ */
+public class DirSetTest extends AbstractFileSetTest {
+
+    protected AbstractFileSet getInstance() {
+        return new DirSet();
+    }
+
+    @Test
+    public void testFileSetIsNoDirSet() {
+        DirSet ds = (DirSet) getInstance();
+        ds.setProject(getProject());
+        FileSet fs = new FileSet();
+        fs.setProject(getProject());
+        getProject().addReference("dummy", fs);
+        ds.setRefid(new Reference(getProject(), "dummy"));
+        try {
+            ds.getDir(getProject());
+            fail("DirSet created from FileSet reference");
+        } catch (BuildException e) {
+            assertEquals("dummy doesn\'t denote a DirSet", e.getMessage());
+        }
+
+        ds = (DirSet) getInstance();
+        ds.setProject(getProject());
+        getProject().addReference("dummy2", ds);
+        fs.setRefid(new Reference(getProject(), "dummy2"));
+        try {
+            fs.getDir(getProject());
+            fail("FileSet created from DirSet reference");
+        } catch (BuildException e) {
+            assertEquals("dummy2 doesn\'t denote a FileSet", e.getMessage());
+        }
+    }
+
+    public void testToString() throws Exception {
+        File tmp = File.createTempFile("DirSetTest", "");
+        try {
+            tmp.delete();
+            File a = new File(tmp, "a");
+            a.mkdirs();
+            File b = new File(tmp, "b");
+            File bc = new File(b, "c");
+            bc.mkdirs();
+            new FileOutputStream(new File(a, "x")).close();
+            new FileOutputStream(new File(b, "x")).close();
+            new FileOutputStream(new File(bc, "x")).close();
+            DirSet ds = new DirSet();
+            ds.setProject(getProject());
+            ds.setDir(tmp);
+            ds.setIncludes("b/");
+            assertEquals("b;b" + File.separator + "c", ds.toString());
+        } finally {
+            new File(tmp, "a/x").delete();
+            new File(tmp, "a").delete();
+            new File(tmp, "b/c/x").delete();
+            new File(tmp, "b/c").delete();
+            new File(tmp, "b/x").delete();
+            new File(tmp, "b").delete();
+            tmp.delete();
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/EnumeratedAttributeTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/EnumeratedAttributeTest.java b/src/tests/junit/org/apache/tools/ant/types/EnumeratedAttributeTest.java
index 7961b72..dcb8a78 100644
--- a/src/tests/junit/org/apache/tools/ant/types/EnumeratedAttributeTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/EnumeratedAttributeTest.java
@@ -1,106 +1,106 @@
-/*
- *  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.types;
-
-
-import org.apache.tools.ant.BuildException;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-/**
- * JUnit testcases for org.apache.tools.ant.EnumeratedAttribute.
- */
-public class EnumeratedAttributeTest {
-
-    private static String[] expected = {"a", "b", "c"};
-
-    @Test
-    public void testContains() {
-        EnumeratedAttribute t1 = new TestNormal();
-        for (int i=0; i<expected.length; i++) {
-            assertTrue(expected[i]+" is in TestNormal",
-                   t1.containsValue(expected[i]));
-            assertTrue(expected[i].toUpperCase()+" is in TestNormal",
-                   !t1.containsValue(expected[i].toUpperCase()));
-        }
-        assertTrue("TestNormal doesn\'t have \"d\" attribute",
-               !t1.containsValue("d"));
-        assertTrue("TestNull doesn\'t have \"d\" attribute and doesn\'t die",
-               !(new TestNull()).containsValue("d"));
-    }
-
-    @Test
-    public void testFactory() {
-		Factory ea = (Factory)EnumeratedAttribute.getInstance(Factory.class, "one");
-		assertEquals("Factory did not set the right value.", ea.getValue(), "one");
-		try {
-	    	EnumeratedAttribute.getInstance(Factory.class, "illegal");
-	    	fail("Factory should fail when trying to set an illegal value.");
-		} catch (BuildException be) {
-			// was expected
-            //TODO assert exception message
-		}
-	}
-
-    @Test
-	public void testExceptions() {
-        EnumeratedAttribute t1 = new TestNormal();
-        for (int i=0; i<expected.length; i++) {
-            try {
-                t1.setValue(expected[i]);
-            } catch (BuildException be) {
-                fail("unexpected exception for value "+expected[i]);
-            }
-        }
-        try {
-            t1.setValue("d");
-            fail("expected exception for value \"d\"");
-        } catch (BuildException be) {
-         //TODO assert build exception
-        }
-        try {
-            (new TestNull()).setValue("d");
-            fail("expected exception for value \"d\" in TestNull");
-        } catch (BuildException be) {
-            //TODO assert exception message
-        }
-    }
-
-    public static class TestNormal extends EnumeratedAttribute {
-        public String[] getValues() {
-            return expected;
-        }
-    }
-
-    public static class TestNull extends EnumeratedAttribute {
-        public String[] getValues() {
-            return null;
-        }
-    }
-
-    public static class Factory extends EnumeratedAttribute {
-    	public String[] getValues() {
-    		return new String[] { "one", "two", "three" };
-    	}
-    }
-    
-}
+/*
+ *  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.types;
+
+
+import org.apache.tools.ant.BuildException;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * JUnit testcases for org.apache.tools.ant.EnumeratedAttribute.
+ */
+public class EnumeratedAttributeTest {
+
+    private static String[] expected = {"a", "b", "c"};
+
+    @Test
+    public void testContains() {
+        EnumeratedAttribute t1 = new TestNormal();
+        for (int i=0; i<expected.length; i++) {
+            assertTrue(expected[i]+" is in TestNormal",
+                   t1.containsValue(expected[i]));
+            assertTrue(expected[i].toUpperCase()+" is in TestNormal",
+                   !t1.containsValue(expected[i].toUpperCase()));
+        }
+        assertTrue("TestNormal doesn\'t have \"d\" attribute",
+               !t1.containsValue("d"));
+        assertTrue("TestNull doesn\'t have \"d\" attribute and doesn\'t die",
+               !(new TestNull()).containsValue("d"));
+    }
+
+    @Test
+    public void testFactory() {
+        Factory ea = (Factory)EnumeratedAttribute.getInstance(Factory.class, "one");
+        assertEquals("Factory did not set the right value.", ea.getValue(), "one");
+        try {
+            EnumeratedAttribute.getInstance(Factory.class, "illegal");
+            fail("Factory should fail when trying to set an illegal value.");
+        } catch (BuildException be) {
+            // was expected
+            //TODO assert exception message
+        }
+    }
+
+    @Test
+    public void testExceptions() {
+        EnumeratedAttribute t1 = new TestNormal();
+        for (int i=0; i<expected.length; i++) {
+            try {
+                t1.setValue(expected[i]);
+            } catch (BuildException be) {
+                fail("unexpected exception for value "+expected[i]);
+            }
+        }
+        try {
+            t1.setValue("d");
+            fail("expected exception for value \"d\"");
+        } catch (BuildException be) {
+         //TODO assert build exception
+        }
+        try {
+            (new TestNull()).setValue("d");
+            fail("expected exception for value \"d\" in TestNull");
+        } catch (BuildException be) {
+            //TODO assert exception message
+        }
+    }
+
+    public static class TestNormal extends EnumeratedAttribute {
+        public String[] getValues() {
+            return expected;
+        }
+    }
+
+    public static class TestNull extends EnumeratedAttribute {
+        public String[] getValues() {
+            return null;
+        }
+    }
+
+    public static class Factory extends EnumeratedAttribute {
+        public String[] getValues() {
+            return new String[] { "one", "two", "three" };
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/FileListTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/FileListTest.java b/src/tests/junit/org/apache/tools/ant/types/FileListTest.java
index 1393b00..0fe59f7 100644
--- a/src/tests/junit/org/apache/tools/ant/types/FileListTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/FileListTest.java
@@ -1,163 +1,163 @@
-/*
- *  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.types;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import java.io.File;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-/**
- * Some tests for filelist.
- */
-
-public class FileListTest {
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-    
-    @Before
-    public void setUp() {
-        buildRule.configureProject("src/etc/testcases/types/filelist.xml");
-    }
-    
-    @Test
-    public void testEmptyElementIfIsReference() {
-        FileList f = new FileList();
-        f.setDir(buildRule.getProject().resolveFile("."));
-        try {
-            f.setRefid(new Reference(buildRule.getProject(), "dummyref"));
-            fail("Can add reference to FileList with directory attribute set.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute when using refid",
-                         be.getMessage());
-        }
-
-        f = new FileList();
-        f.setFiles("foo.xml,c/d/bar.xml");
-        try {
-            f.setRefid(new Reference(buildRule.getProject(), "dummyref"));
-            fail("Can add reference to FileList with file attribute set.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute when using refid",
-                         be.getMessage());
-        }
-
-        f = new FileList();
-        f.setRefid(new Reference(buildRule.getProject(), "dummyref"));
-        try {
-            f.setFiles("a/b/foo.java");
-            fail("Can set files in FileList that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute when using refid",
-                         be.getMessage());
-        }
-        try {
-            f.setDir(buildRule.getProject().resolveFile("."));
-            fail("Can set dir in FileList that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute when using refid",
-                         be.getMessage());
-        }
-    }
-
-    @Test
-    public void testCircularReferenceCheck() {
-        FileList f = new FileList();
-        buildRule.getProject().addReference("dummy", f);
-        f.setRefid(new Reference(buildRule.getProject(), "dummy"));
-        try {
-            f.getDir(buildRule.getProject());
-            fail("Can make FileList a Reference to itself.");
-        } catch (BuildException be) {
-            assertEquals("This data type contains a circular reference.",
-                         be.getMessage());
-        }
-        try {
-            f.getFiles(buildRule.getProject());
-            fail("Can make FileList a Reference to itself.");
-        } catch (BuildException be) {
-            assertEquals("This data type contains a circular reference.",
-                         be.getMessage());
-        }
-
-        // dummy1 --> dummy2 --> dummy3 --> dummy1
-        FileList f1 = new FileList();
-        buildRule.getProject().addReference("dummy1", f1);
-        f1.setRefid(new Reference(buildRule.getProject(), "dummy2"));
-        FileList f2 = new FileList();
-        buildRule.getProject().addReference("dummy2", f2);
-        f2.setRefid(new Reference(buildRule.getProject(), "dummy3"));
-        FileList f3 = new FileList();
-        buildRule.getProject().addReference("dummy3", f3);
-        f3.setRefid(new Reference(buildRule.getProject(), "dummy1"));
-        try {
-            f1.getDir(buildRule.getProject());
-            fail("Can make circular reference.");
-        } catch (BuildException be) {
-            assertEquals("This data type contains a circular reference.",
-                         be.getMessage());
-        }
-        try {
-            f1.getFiles(buildRule.getProject());
-            fail("Can make circular reference.");
-        } catch (BuildException be) {
-            assertEquals("This data type contains a circular reference.",
-                         be.getMessage());
-        }
-
-        // dummy1 --> dummy2 --> dummy3
-        // (which has the Project's basedir as root).
-        f1 = new FileList();
-        buildRule.getProject().addReference("dummy1", f1);
-        f1.setRefid(new Reference(buildRule.getProject(), "dummy2"));
-        f2 = new FileList();
-        buildRule.getProject().addReference("dummy2", f2);
-        f2.setRefid(new Reference(buildRule.getProject(), "dummy3"));
-        f3 = new FileList();
-        buildRule.getProject().addReference("dummy3", f3);
-        f3.setDir(buildRule.getProject().resolveFile("."));
-        File dir = f1.getDir(buildRule.getProject());
-        assertEquals("Dir is basedir", dir, buildRule.getProject().getBaseDir());
-    }
-
-    @Test
-    public void testSimple() {
-        buildRule.executeTarget("simple");
-        assertEquals("/abc/a", buildRule.getLog());
-    }
-
-    @Test
-    public void testDouble() {
-        buildRule.executeTarget("double");
-        assertEquals("/abc/a:/abc/b", buildRule.getLog());
-    }
-
-    @Test
-    public void testNested() {
-        buildRule.executeTarget("nested");
-        assertEquals("/abc/a:/abc/b", buildRule.getLog());
-    }
-}
+/*
+ *  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.types;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import java.io.File;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Some tests for filelist.
+ */
+
+public class FileListTest {
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject("src/etc/testcases/types/filelist.xml");
+    }
+
+    @Test
+    public void testEmptyElementIfIsReference() {
+        FileList f = new FileList();
+        f.setDir(buildRule.getProject().resolveFile("."));
+        try {
+            f.setRefid(new Reference(buildRule.getProject(), "dummyref"));
+            fail("Can add reference to FileList with directory attribute set.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute when using refid",
+                         be.getMessage());
+        }
+
+        f = new FileList();
+        f.setFiles("foo.xml,c/d/bar.xml");
+        try {
+            f.setRefid(new Reference(buildRule.getProject(), "dummyref"));
+            fail("Can add reference to FileList with file attribute set.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute when using refid",
+                         be.getMessage());
+        }
+
+        f = new FileList();
+        f.setRefid(new Reference(buildRule.getProject(), "dummyref"));
+        try {
+            f.setFiles("a/b/foo.java");
+            fail("Can set files in FileList that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute when using refid",
+                         be.getMessage());
+        }
+        try {
+            f.setDir(buildRule.getProject().resolveFile("."));
+            fail("Can set dir in FileList that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute when using refid",
+                         be.getMessage());
+        }
+    }
+
+    @Test
+    public void testCircularReferenceCheck() {
+        FileList f = new FileList();
+        buildRule.getProject().addReference("dummy", f);
+        f.setRefid(new Reference(buildRule.getProject(), "dummy"));
+        try {
+            f.getDir(buildRule.getProject());
+            fail("Can make FileList a Reference to itself.");
+        } catch (BuildException be) {
+            assertEquals("This data type contains a circular reference.",
+                         be.getMessage());
+        }
+        try {
+            f.getFiles(buildRule.getProject());
+            fail("Can make FileList a Reference to itself.");
+        } catch (BuildException be) {
+            assertEquals("This data type contains a circular reference.",
+                         be.getMessage());
+        }
+
+        // dummy1 --> dummy2 --> dummy3 --> dummy1
+        FileList f1 = new FileList();
+        buildRule.getProject().addReference("dummy1", f1);
+        f1.setRefid(new Reference(buildRule.getProject(), "dummy2"));
+        FileList f2 = new FileList();
+        buildRule.getProject().addReference("dummy2", f2);
+        f2.setRefid(new Reference(buildRule.getProject(), "dummy3"));
+        FileList f3 = new FileList();
+        buildRule.getProject().addReference("dummy3", f3);
+        f3.setRefid(new Reference(buildRule.getProject(), "dummy1"));
+        try {
+            f1.getDir(buildRule.getProject());
+            fail("Can make circular reference.");
+        } catch (BuildException be) {
+            assertEquals("This data type contains a circular reference.",
+                         be.getMessage());
+        }
+        try {
+            f1.getFiles(buildRule.getProject());
+            fail("Can make circular reference.");
+        } catch (BuildException be) {
+            assertEquals("This data type contains a circular reference.",
+                         be.getMessage());
+        }
+
+        // dummy1 --> dummy2 --> dummy3
+        // (which has the Project's basedir as root).
+        f1 = new FileList();
+        buildRule.getProject().addReference("dummy1", f1);
+        f1.setRefid(new Reference(buildRule.getProject(), "dummy2"));
+        f2 = new FileList();
+        buildRule.getProject().addReference("dummy2", f2);
+        f2.setRefid(new Reference(buildRule.getProject(), "dummy3"));
+        f3 = new FileList();
+        buildRule.getProject().addReference("dummy3", f3);
+        f3.setDir(buildRule.getProject().resolveFile("."));
+        File dir = f1.getDir(buildRule.getProject());
+        assertEquals("Dir is basedir", dir, buildRule.getProject().getBaseDir());
+    }
+
+    @Test
+    public void testSimple() {
+        buildRule.executeTarget("simple");
+        assertEquals("/abc/a", buildRule.getLog());
+    }
+
+    @Test
+    public void testDouble() {
+        buildRule.executeTarget("double");
+        assertEquals("/abc/a:/abc/b", buildRule.getLog());
+    }
+
+    @Test
+    public void testNested() {
+        buildRule.executeTarget("nested");
+        assertEquals("/abc/a:/abc/b", buildRule.getLog());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/FileSetTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/FileSetTest.java b/src/tests/junit/org/apache/tools/ant/types/FileSetTest.java
index f58a3f0..8a1c35a 100644
--- a/src/tests/junit/org/apache/tools/ant/types/FileSetTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/FileSetTest.java
@@ -1,36 +1,36 @@
-/*
- *  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.types;
-
-
-/**
- * JUnit 3 testcases for org.apache.tools.ant.types.FileSet.
- *
- * <p>This doesn't actually test much, mainly reference handling.
- *
- */
-
-public class FileSetTest extends AbstractFileSetTest {
-
-
-    protected AbstractFileSet getInstance() {
-        return new FileSet();
-    }
-
-}
+/*
+ *  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.types;
+
+
+/**
+ * JUnit 3 testcases for org.apache.tools.ant.types.FileSet.
+ *
+ * <p>This doesn't actually test much, mainly reference handling.
+ *
+ */
+
+public class FileSetTest extends AbstractFileSetTest {
+
+
+    protected AbstractFileSet getInstance() {
+        return new FileSet();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/FilterSetTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/FilterSetTest.java b/src/tests/junit/org/apache/tools/ant/types/FilterSetTest.java
index 7122ea1..9a17687 100644
--- a/src/tests/junit/org/apache/tools/ant/types/FilterSetTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/FilterSetTest.java
@@ -1,239 +1,239 @@
-/*
- *  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.types;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.Hashtable;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-/**
- * FilterSet testing
- *
- */
-public class FilterSetTest {
-
-    static private final int BUF_SIZE = 32768;
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject("src/etc/testcases/types/filterset.xml");
-    }
-
-    @After
-    public void tearDown() {
-        buildRule.executeTarget("cleanup");
-    }
-
-    @Test
-    public void test1() throws IOException {
-        buildRule.executeTarget("test1");
-        assertTrue("Filterset 1 failed", compareFiles("src/etc/testcases/types/gold/filterset1.txt",
-                                                      "src/etc/testcases/types/dest1.txt"));
-    }
-
-    @Test
-    public void test2() throws IOException {
-        buildRule.executeTarget("test2");
-        assertTrue("Filterset 2 failed", compareFiles("src/etc/testcases/types/gold/filterset2.txt",
-                                                      "src/etc/testcases/types/dest2.txt"));
-    }
-
-    @Test
-    public void test3() throws IOException {
-        buildRule.executeTarget("test3");
-        assertTrue("Filterset 3 failed", compareFiles("src/etc/testcases/types/gold/filterset3.txt",
-                                                      "src/etc/testcases/types/dest3.txt"));
-    }
-
-    /**
-     * This will test the recursive FilterSet.  Which means that if
-     * the filter value @test@ contains another filter value, it will
-     * actually resolve.
-     */
-    @Test
-    public void testRecursive() {
-        String result = "it works line";
-        String line="@test@ line";
-        FilterSet fs = new FilterSet();
-        fs.addFilter("test", "@test1@");
-        fs.addFilter("test1","@test2@");
-        fs.addFilter("test2", "it works");
-        fs.setBeginToken("@");
-        fs.setEndToken("@");
-        assertEquals(result, fs.replaceTokens(line));
-    }
-
-    /**
-     * Test to see what happens when the resolving occurs in an
-     * infinite loop.
-     */
-    @Test
-    public void testInfinite() {
-        String result = "@test@ line testvalue";
-        String line = "@test@ line @test3@";
-        FilterSet fs = new FilterSet();
-        fs.addFilter("test", "@test1@");
-        fs.addFilter("test1","@test2@");
-        fs.addFilter("test2", "@test@");
-        fs.addFilter("test3", "testvalue");
-        fs.setBeginToken("@");
-        fs.setEndToken("@");
-        assertEquals(result, fs.replaceTokens(line));
-    }
-
-    /**
-     * Test to see what happens when the resolving occurs in
-     * what would be an infinite loop, but with recursion disabled.
-     */
-    @Test
-    public void testRecursionDisabled() {
-        String result = "@test1@ line testvalue";
-        String line = "@test@ line @test2@";
-        FilterSet fs = new FilterSet();
-        fs.addFilter("test", "@test1@");
-        fs.addFilter("test1","@test@");
-        fs.addFilter("test2", "testvalue");
-        fs.setBeginToken("@");
-        fs.setEndToken("@");
-        fs.setRecurse(false);
-        assertEquals(result, fs.replaceTokens(line));
-    }
-
-    @Test
-    public void testNonInfiniteRecursiveMultipleOnSingleLine() {
-        FilterSet filters = new FilterSet();
-
-        filters.setBeginToken("<");
-        filters.setEndToken(">");
-
-        filters.addFilter("ul", "<itemizedlist>");
-        filters.addFilter("/ul", "</itemizedList>");
-        filters.addFilter("li", "<listitem>");
-        filters.addFilter("/li", "</listitem>");
-
-        String result = "<itemizedlist><listitem>Item 1</listitem> <listitem>Item 2</listitem></itemizedList>";
-        String line = "<ul><li>Item 1</li> <li>Item 2</li></ul>";
-
-        assertEquals(result, filters.replaceTokens(line));
-    }
-    
-    @Test
-    public void testNestedFilterSets() {
-        buildRule.executeTarget("test-nested-filtersets");
-
-        FilterSet fs = (FilterSet) buildRule.getProject().getReference("1");
-        Hashtable filters = fs.getFilterHash();
-        assertEquals(1, filters.size());
-        assertEquals("value1", filters.get("token1"));
-
-        fs = (FilterSet) buildRule.getProject().getReference("2");
-        filters = fs.getFilterHash();
-        assertEquals(2, filters.size());
-        assertEquals("1111", filters.get("aaaa"));
-        assertEquals("2222", filters.get("bbbb"));
-
-        fs = (FilterSet) buildRule.getProject().getReference("3");
-        filters = fs.getFilterHash();
-        assertEquals(1, filters.size());
-        assertEquals("value4", filters.get("token4"));
-
-        fs = (FilterSet) buildRule.getProject().getReference("5");
-        filters = fs.getFilterHash();
-        assertEquals(1, filters.size());
-        assertEquals("value1", filters.get("token1"));
-    }
-
-    @Test
-    public void testFiltersFileElement() {
-        buildRule.executeTarget("testFiltersFileElement");
-    }
-
-    @Test
-    public void testFiltersFileAttribute() {
-        buildRule.executeTarget("testFiltersFileAttribute");
-    }
-
-    @Test
-    public void testMultipleFiltersFiles() {
-        buildRule.executeTarget("testMultipleFiltersFiles");
-    }
-
-    @Test
-    public void testMissingFiltersFile() {
-        try {
-            buildRule.executeTarget("testMissingFiltersFile");
-            fail("should fail due to missing  filtersfile");
-        } catch (BuildException ex) {
-            //TODO assert exception text
-        }
-    }
-
-    @Test
-    public void testAllowMissingFiltersFile() {
-        buildRule.executeTarget("testAllowMissingFiltersFile");
-    }
-
-    private boolean compareFiles(String name1, String name2) throws IOException {
-        File file1 = new File(System.getProperty("root"), name1);
-        File file2 = new File(System.getProperty("root"), name2);
-
-
-        if (!file1.exists() || !file2.exists()) {
-            return false;
-        }
-
-        if (file1.length() != file2.length()) {
-            return false;
-        }
-
-        // byte - byte compare
-        byte[] buffer1 = new byte[BUF_SIZE];
-        byte[] buffer2 = new byte[BUF_SIZE];
-
-        FileInputStream fis1 = new FileInputStream(file1);
-        FileInputStream fis2 = new FileInputStream(file2);
-        int index = 0;
-        int read = 0;
-        while ((read = fis1.read(buffer1)) != -1) {
-            fis2.read(buffer2);
-            for (int i = 0; i < read; ++i, ++index) {
-                if (buffer1[i] != buffer2[i]) {
-                    return false;
-                }
-            }
-        }
-        return true;
-
-    }
-}
+/*
+ *  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.types;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Hashtable;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * FilterSet testing
+ *
+ */
+public class FilterSetTest {
+
+    static private final int BUF_SIZE = 32768;
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject("src/etc/testcases/types/filterset.xml");
+    }
+
+    @After
+    public void tearDown() {
+        buildRule.executeTarget("cleanup");
+    }
+
+    @Test
+    public void test1() throws IOException {
+        buildRule.executeTarget("test1");
+        assertTrue("Filterset 1 failed", compareFiles("src/etc/testcases/types/gold/filterset1.txt",
+                                                      "src/etc/testcases/types/dest1.txt"));
+    }
+
+    @Test
+    public void test2() throws IOException {
+        buildRule.executeTarget("test2");
+        assertTrue("Filterset 2 failed", compareFiles("src/etc/testcases/types/gold/filterset2.txt",
+                                                      "src/etc/testcases/types/dest2.txt"));
+    }
+
+    @Test
+    public void test3() throws IOException {
+        buildRule.executeTarget("test3");
+        assertTrue("Filterset 3 failed", compareFiles("src/etc/testcases/types/gold/filterset3.txt",
+                                                      "src/etc/testcases/types/dest3.txt"));
+    }
+
+    /**
+     * This will test the recursive FilterSet.  Which means that if
+     * the filter value @test@ contains another filter value, it will
+     * actually resolve.
+     */
+    @Test
+    public void testRecursive() {
+        String result = "it works line";
+        String line="@test@ line";
+        FilterSet fs = new FilterSet();
+        fs.addFilter("test", "@test1@");
+        fs.addFilter("test1","@test2@");
+        fs.addFilter("test2", "it works");
+        fs.setBeginToken("@");
+        fs.setEndToken("@");
+        assertEquals(result, fs.replaceTokens(line));
+    }
+
+    /**
+     * Test to see what happens when the resolving occurs in an
+     * infinite loop.
+     */
+    @Test
+    public void testInfinite() {
+        String result = "@test@ line testvalue";
+        String line = "@test@ line @test3@";
+        FilterSet fs = new FilterSet();
+        fs.addFilter("test", "@test1@");
+        fs.addFilter("test1","@test2@");
+        fs.addFilter("test2", "@test@");
+        fs.addFilter("test3", "testvalue");
+        fs.setBeginToken("@");
+        fs.setEndToken("@");
+        assertEquals(result, fs.replaceTokens(line));
+    }
+
+    /**
+     * Test to see what happens when the resolving occurs in
+     * what would be an infinite loop, but with recursion disabled.
+     */
+    @Test
+    public void testRecursionDisabled() {
+        String result = "@test1@ line testvalue";
+        String line = "@test@ line @test2@";
+        FilterSet fs = new FilterSet();
+        fs.addFilter("test", "@test1@");
+        fs.addFilter("test1","@test@");
+        fs.addFilter("test2", "testvalue");
+        fs.setBeginToken("@");
+        fs.setEndToken("@");
+        fs.setRecurse(false);
+        assertEquals(result, fs.replaceTokens(line));
+    }
+
+    @Test
+    public void testNonInfiniteRecursiveMultipleOnSingleLine() {
+        FilterSet filters = new FilterSet();
+
+        filters.setBeginToken("<");
+        filters.setEndToken(">");
+
+        filters.addFilter("ul", "<itemizedlist>");
+        filters.addFilter("/ul", "</itemizedList>");
+        filters.addFilter("li", "<listitem>");
+        filters.addFilter("/li", "</listitem>");
+
+        String result = "<itemizedlist><listitem>Item 1</listitem> <listitem>Item 2</listitem></itemizedList>";
+        String line = "<ul><li>Item 1</li> <li>Item 2</li></ul>";
+
+        assertEquals(result, filters.replaceTokens(line));
+    }
+
+    @Test
+    public void testNestedFilterSets() {
+        buildRule.executeTarget("test-nested-filtersets");
+
+        FilterSet fs = (FilterSet) buildRule.getProject().getReference("1");
+        Hashtable filters = fs.getFilterHash();
+        assertEquals(1, filters.size());
+        assertEquals("value1", filters.get("token1"));
+
+        fs = (FilterSet) buildRule.getProject().getReference("2");
+        filters = fs.getFilterHash();
+        assertEquals(2, filters.size());
+        assertEquals("1111", filters.get("aaaa"));
+        assertEquals("2222", filters.get("bbbb"));
+
+        fs = (FilterSet) buildRule.getProject().getReference("3");
+        filters = fs.getFilterHash();
+        assertEquals(1, filters.size());
+        assertEquals("value4", filters.get("token4"));
+
+        fs = (FilterSet) buildRule.getProject().getReference("5");
+        filters = fs.getFilterHash();
+        assertEquals(1, filters.size());
+        assertEquals("value1", filters.get("token1"));
+    }
+
+    @Test
+    public void testFiltersFileElement() {
+        buildRule.executeTarget("testFiltersFileElement");
+    }
+
+    @Test
+    public void testFiltersFileAttribute() {
+        buildRule.executeTarget("testFiltersFileAttribute");
+    }
+
+    @Test
+    public void testMultipleFiltersFiles() {
+        buildRule.executeTarget("testMultipleFiltersFiles");
+    }
+
+    @Test
+    public void testMissingFiltersFile() {
+        try {
+            buildRule.executeTarget("testMissingFiltersFile");
+            fail("should fail due to missing  filtersfile");
+        } catch (BuildException ex) {
+            //TODO assert exception text
+        }
+    }
+
+    @Test
+    public void testAllowMissingFiltersFile() {
+        buildRule.executeTarget("testAllowMissingFiltersFile");
+    }
+
+    private boolean compareFiles(String name1, String name2) throws IOException {
+        File file1 = new File(System.getProperty("root"), name1);
+        File file2 = new File(System.getProperty("root"), name2);
+
+
+        if (!file1.exists() || !file2.exists()) {
+            return false;
+        }
+
+        if (file1.length() != file2.length()) {
+            return false;
+        }
+
+        // byte - byte compare
+        byte[] buffer1 = new byte[BUF_SIZE];
+        byte[] buffer2 = new byte[BUF_SIZE];
+
+        FileInputStream fis1 = new FileInputStream(file1);
+        FileInputStream fis2 = new FileInputStream(file2);
+        int index = 0;
+        int read = 0;
+        while ((read = fis1.read(buffer1)) != -1) {
+            fis2.read(buffer2);
+            for (int i = 0; i < read; ++i, ++index) {
+                if (buffer1[i] != buffer2[i]) {
+                    return false;
+                }
+            }
+        }
+        return true;
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/FlexIntegerTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/FlexIntegerTest.java b/src/tests/junit/org/apache/tools/ant/types/FlexIntegerTest.java
index 7435515..3e08b2c 100644
--- a/src/tests/junit/org/apache/tools/ant/types/FlexIntegerTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/FlexIntegerTest.java
@@ -1,74 +1,74 @@
-/*
- *  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.types;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.BuildException;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class FlexIntegerTest {
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject("src/etc/testcases/types/flexinteger.xml");
-    }
-
-    @Test
-    public void testFlexInteger() {
-        buildRule.executeTarget("test");
-        assertEquals(buildRule.getProject().getProperty("flexint.value1"), "10");
-        assertEquals(buildRule.getProject().getProperty("flexint.value2"), "8");
-    }
-
-    // This class acts as a custom Ant task also
-    // and uses these variables/methods in that mode
-    private Project taskProject;
-    String propName;
-    private FlexInteger value;
-
-
-
-    public void setPropName(String propName) {
-        this.propName = propName;
-    }
-
-    public void setValue(FlexInteger value) {
-        this.value = value;
-    }
-
-    public void setProject(Project project) {
-        taskProject = project;
-    }
-
-    public void execute() {
-        if (propName == null || value == null) {
-            throw new BuildException("name and value required");
-        }
-
-        taskProject.setNewProperty(propName, value.toString());
-    }
-}
+/*
+ *  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.types;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.BuildException;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class FlexIntegerTest {
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject("src/etc/testcases/types/flexinteger.xml");
+    }
+
+    @Test
+    public void testFlexInteger() {
+        buildRule.executeTarget("test");
+        assertEquals(buildRule.getProject().getProperty("flexint.value1"), "10");
+        assertEquals(buildRule.getProject().getProperty("flexint.value2"), "8");
+    }
+
+    // This class acts as a custom Ant task also
+    // and uses these variables/methods in that mode
+    private Project taskProject;
+    String propName;
+    private FlexInteger value;
+
+
+
+    public void setPropName(String propName) {
+        this.propName = propName;
+    }
+
+    public void setValue(FlexInteger value) {
+        this.value = value;
+    }
+
+    public void setProject(Project project) {
+        taskProject = project;
+    }
+
+    public void execute() {
+        if (propName == null || value == null) {
+            throw new BuildException("name and value required");
+        }
+
+        taskProject.setNewProperty(propName, value.toString());
+    }
+}


[15/21] ant git commit: Normalise tabulation and line breaks

Posted by gi...@apache.org.
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/sos/SOSTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/sos/SOSTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/sos/SOSTest.java
index aebc9e2..c45ec17 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/sos/SOSTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/sos/SOSTest.java
@@ -1,351 +1,351 @@
-/*
- *  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.sos;
-
-import java.io.File;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.BuildFileRule;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.types.Commandline;
-import org.apache.tools.ant.types.Path;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-/**
- *  Testcase to ensure that command line generation and required attributes are
- *  correct.
- *
- */
-public class SOSTest {
-
-    private Commandline commandline;
-
-    private static final String VSS_SERVER_PATH = "\\\\server\\vss\\srcsafe.ini";
-    private static final String VSS_PROJECT_PATH = "/SourceRoot/Project";
-    private static final String DS_VSS_PROJECT_PATH = "$/SourceRoot/Project";
-    private static final String SOS_SERVER_PATH = "192.168.0.1:8888";
-    private static final String SOS_USERNAME = "ant";
-    private static final String SOS_PASSWORD = "rocks";
-    private static final String LOCAL_PATH = "testdir";
-    private static final String SRC_FILE = "Class1.java";
-    private static final String SRC_LABEL = "label1";
-    private static final String SRC_COMMENT = "I fixed a bug";
-    private static final String SOS_HOME = "/home/user/.sos";
-    private static final String VERSION = "007";
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-    private Project project;
-
-    @Before
-    public void setUp() {
-        project = new Project();
-        project.init();
-        project.setBasedir(".");
-    }
-
-    @After
-    public void tearDown() {
-        File file = new File(project.getBaseDir(), LOCAL_PATH);
-        if (file.exists()) {
-            file.delete();
-        }
-    }
-
-    /**  Test SOSGetFile flags & commandline generation  */
-    @Test
-    public void testGetFileFlags() {
-        String[] sTestCmdLine = {"soscmd", "-command", "GetFile", "-file",
-                SRC_FILE, "-revision", "007", "-server", SOS_SERVER_PATH, "-name",
-                SOS_USERNAME, "-password", SOS_PASSWORD, "-database", VSS_SERVER_PATH,
-                "-project", DS_VSS_PROJECT_PATH, "-verbose", "-nocompress",
-                "-nocache", "-workdir", project.getBaseDir().getAbsolutePath()
-                 + File.separator + LOCAL_PATH};
-
-        // Set up a SOSGet task
-        SOSGet sosGet = new SOSGet();
-        sosGet.setProject(project);
-        sosGet.setVssServerPath(VSS_SERVER_PATH);
-        sosGet.setSosServerPath(SOS_SERVER_PATH);
-        sosGet.setProjectPath(VSS_PROJECT_PATH);
-        sosGet.setFile(SRC_FILE);
-        sosGet.setUsername(SOS_USERNAME);
-        sosGet.setPassword(SOS_PASSWORD);
-        sosGet.setVersion(VERSION);
-        sosGet.setLocalPath(new Path(project, LOCAL_PATH));
-        sosGet.setNoCache(true);
-        sosGet.setNoCompress(true);
-        sosGet.setVerbose(true);
-        sosGet.setRecursive(true);
-
-        commandline = sosGet.buildCmdLine();
-
-        checkCommandLines(sTestCmdLine, commandline.getCommandline());
-    }
-
-    /**  Test SOSGetProject flags & commandline generation  */
-    @Test
-    public void testGetProjectFlags() {
-        String[] sTestCmdLine = {"soscmd", "-command", "GetProject", "-recursive",
-                "-label", SRC_LABEL, "-server", SOS_SERVER_PATH, "-name", SOS_USERNAME,
-                "-password", "", "-database", VSS_SERVER_PATH, "-project",
-                DS_VSS_PROJECT_PATH, "", "", "-soshome", SOS_HOME, "-workdir",
-                project.getBaseDir().getAbsolutePath()};
-
-        // Set up a SOSGet task
-        SOSGet sosGet = new SOSGet();
-        sosGet.setProject(project);
-        sosGet.setVssServerPath(VSS_SERVER_PATH);
-        sosGet.setSosServerPath(SOS_SERVER_PATH);
-        sosGet.setProjectPath(DS_VSS_PROJECT_PATH);
-        sosGet.setLabel(SRC_LABEL);
-        sosGet.setUsername(SOS_USERNAME);
-        sosGet.setSosHome(SOS_HOME);
-        sosGet.setNoCache(true);
-        sosGet.setNoCompress(false);
-        sosGet.setVerbose(false);
-        sosGet.setRecursive(true);
-
-        commandline = sosGet.buildCmdLine();
-
-        checkCommandLines(sTestCmdLine, commandline.getCommandline());
-    }
-
-    /**  Tests SOSGet required attributes.  */
-    @Test
-    public void testGetExceptions() {
-        buildRule.configureProject("src/etc/testcases/taskdefs/optional/sos/sos.xml");
-        expectSpecificBuildException("sosget.1", "some cause", "sosserverpath attribute must be set!");
-        expectSpecificBuildException("sosget.2", "some cause", "username attribute must be set!");
-        expectSpecificBuildException("sosget.3", "some cause", "vssserverpath attribute must be set!");
-        expectSpecificBuildException("sosget.4", "some cause", "projectpath attribute must be set!");
-    }
-
-    /**  Test CheckInFile option flags  */
-    @Test
-    public void testCheckinFileFlags() {
-        String[] sTestCmdLine = {"soscmd", "-command", "CheckInFile", "-file",
-                SRC_FILE, "-server", SOS_SERVER_PATH, "-name", SOS_USERNAME,
-                "-password", SOS_PASSWORD, "-database", VSS_SERVER_PATH, "-project",
-                DS_VSS_PROJECT_PATH, "-verbose", "-nocompress", "-nocache",
-                "-workdir", project.getBaseDir().getAbsolutePath() + File.separator
-                 + LOCAL_PATH, "-log", SRC_COMMENT};
-
-        // Set up a SOSCheckin task
-        SOSCheckin sosCheckin = new SOSCheckin();
-        sosCheckin.setProject(project);
-        sosCheckin.setVssServerPath(VSS_SERVER_PATH);
-        sosCheckin.setSosServerPath(SOS_SERVER_PATH);
-        sosCheckin.setProjectPath(VSS_PROJECT_PATH);
-        sosCheckin.setFile(SRC_FILE);
-        sosCheckin.setComment(SRC_COMMENT);
-        sosCheckin.setUsername(SOS_USERNAME);
-        sosCheckin.setPassword(SOS_PASSWORD);
-        sosCheckin.setLocalPath(new Path(project, LOCAL_PATH));
-        sosCheckin.setNoCache(true);
-        sosCheckin.setNoCompress(true);
-        sosCheckin.setVerbose(true);
-        sosCheckin.setRecursive(true);
-
-        commandline = sosCheckin.buildCmdLine();
-
-        checkCommandLines(sTestCmdLine, commandline.getCommandline());
-    }
-
-    /**  Test CheckInProject option flags  */
-    @Test
-    public void testCheckinProjectFlags() {
-        String[] sTestCmdLine = {"soscmd", "-command", "CheckInProject",
-                "-recursive", "-server", SOS_SERVER_PATH, "-name", SOS_USERNAME,
-                "-password", "", "-database", VSS_SERVER_PATH, "-project",
-                DS_VSS_PROJECT_PATH, "", "", "-soshome", SOS_HOME, "-workdir",
-                project.getBaseDir().getAbsolutePath(), "-log", SRC_COMMENT,};
-
-        // Set up a SOSCheckin task
-        SOSCheckin sosCheckin = new SOSCheckin();
-        sosCheckin.setProject(project);
-        sosCheckin.setVssServerPath(VSS_SERVER_PATH);
-        sosCheckin.setSosServerPath(SOS_SERVER_PATH);
-        sosCheckin.setProjectPath(DS_VSS_PROJECT_PATH);
-        sosCheckin.setComment(SRC_COMMENT);
-        sosCheckin.setUsername(SOS_USERNAME);
-        sosCheckin.setSosHome(SOS_HOME);
-        sosCheckin.setNoCache(true);
-        sosCheckin.setNoCompress(false);
-        sosCheckin.setVerbose(false);
-        sosCheckin.setRecursive(true);
-
-        commandline = sosCheckin.buildCmdLine();
-
-        checkCommandLines(sTestCmdLine, commandline.getCommandline());
-    }
-
-    /**  Test SOSCheckIn required attributes.  */
-    @Test
-    public void testCheckinExceptions() {
-        buildRule.configureProject("src/etc/testcases/taskdefs/optional/sos/sos.xml");
-        expectSpecificBuildException("soscheckin.1", "some cause", "sosserverpath attribute must be set!");
-        expectSpecificBuildException("soscheckin.2", "some cause", "username attribute must be set!");
-        expectSpecificBuildException("soscheckin.3", "some cause", "vssserverpath attribute must be set!");
-        expectSpecificBuildException("soscheckin.4", "some cause", "projectpath attribute must be set!");
-    }
-
-    /**  Test CheckOutFile option flags  */
-    @Test
-    public void testCheckoutFileFlags() {
-        String[] sTestCmdLine = {"soscmd", "-command", "CheckOutFile", "-file",
-                SRC_FILE, "-server", SOS_SERVER_PATH, "-name", SOS_USERNAME,
-                "-password", SOS_PASSWORD, "-database", VSS_SERVER_PATH, "-project",
-                DS_VSS_PROJECT_PATH, "-verbose", "-nocompress", "-nocache",
-                "-workdir", project.getBaseDir().getAbsolutePath()
-                 + File.separator + LOCAL_PATH};
-
-        // Set up a SOSCheckout task
-        SOSCheckout sosCheckout = new SOSCheckout();
-        sosCheckout.setProject(project);
-        sosCheckout.setVssServerPath(VSS_SERVER_PATH);
-        sosCheckout.setSosServerPath(SOS_SERVER_PATH);
-        sosCheckout.setProjectPath(DS_VSS_PROJECT_PATH);
-        sosCheckout.setFile(SRC_FILE);
-        sosCheckout.setUsername(SOS_USERNAME);
-        sosCheckout.setPassword(SOS_PASSWORD);
-        sosCheckout.setLocalPath(new Path(project, LOCAL_PATH));
-        sosCheckout.setNoCache(true);
-        sosCheckout.setNoCompress(true);
-        sosCheckout.setVerbose(true);
-        sosCheckout.setRecursive(true);
-
-        commandline = sosCheckout.buildCmdLine();
-
-        checkCommandLines(sTestCmdLine, commandline.getCommandline());
-    }
-
-    /**  Test CheckOutProject option flags  */
-    @Test
-    public void testCheckoutProjectFlags() {
-        String[] sTestCmdLine = {"soscmd", "-command", "CheckOutProject",
-                "-recursive", "-server", SOS_SERVER_PATH, "-name", SOS_USERNAME,
-                "-password", "", "-database", VSS_SERVER_PATH, "-project",
-                DS_VSS_PROJECT_PATH, "", "", "-soshome", SOS_HOME, "-workdir",
-                project.getBaseDir().getAbsolutePath()};
-
-        // Set up a sosCheckout task
-        SOSCheckout sosCheckout = new SOSCheckout();
-        sosCheckout.setProject(project);
-        sosCheckout.setVssServerPath(VSS_SERVER_PATH);
-        sosCheckout.setSosServerPath(SOS_SERVER_PATH);
-        sosCheckout.setProjectPath(VSS_PROJECT_PATH);
-        sosCheckout.setUsername(SOS_USERNAME);
-        sosCheckout.setSosHome(SOS_HOME);
-        sosCheckout.setNoCache(true);
-        sosCheckout.setNoCompress(false);
-        sosCheckout.setVerbose(false);
-        sosCheckout.setRecursive(true);
-
-        commandline = sosCheckout.buildCmdLine();
-
-        checkCommandLines(sTestCmdLine, commandline.getCommandline());
-    }
-
-    /**  Test SOSCheckout required attributes.  */
-    @Test
-    public void testCheckoutExceptions() {
-        buildRule.configureProject("src/etc/testcases/taskdefs/optional/sos/sos.xml");
-        expectSpecificBuildException("soscheckout.1", "some cause", "sosserverpath attribute must be set!");
-        expectSpecificBuildException("soscheckout.2", "some cause", "username attribute must be set!");
-        expectSpecificBuildException("soscheckout.3", "some cause", "vssserverpath attribute must be set!");
-        expectSpecificBuildException("soscheckout.4", "some cause", "projectpath attribute must be set!");
-    }
-
-    /**  Test Label option flags  */
-    @Test
-    public void testLabelFlags() {
-        String[] sTestCmdLine = {"soscmd", "-command", "AddLabel", "-server",
-                SOS_SERVER_PATH, "-name", SOS_USERNAME, "-password", "", "-database",
-                VSS_SERVER_PATH, "-project", DS_VSS_PROJECT_PATH, "-label",
-                SRC_LABEL, "-verbose", "-log", SRC_COMMENT};
-
-        // Set up a sosCheckout task
-        SOSLabel sosLabel = new SOSLabel();
-        sosLabel.setVssServerPath(VSS_SERVER_PATH);
-        sosLabel.setSosServerPath(SOS_SERVER_PATH);
-        sosLabel.setProjectPath(DS_VSS_PROJECT_PATH);
-        sosLabel.setUsername(SOS_USERNAME);
-        sosLabel.setSosHome(SOS_HOME);
-        sosLabel.setComment(SRC_COMMENT);
-        sosLabel.setLabel(SRC_LABEL);
-        sosLabel.setNoCache(true);
-        sosLabel.setNoCompress(false);
-        sosLabel.setVerbose(true);
-
-        commandline = sosLabel.buildCmdLine();
-
-        checkCommandLines(sTestCmdLine, commandline.getCommandline());
-    }
-
-    /**  Test SOSLabel required attributes.  */
-    @Test
-    public void testLabelExceptions() {
-        buildRule.configureProject("src/etc/testcases/taskdefs/optional/sos/sos.xml");
-        expectSpecificBuildException("soslabel.1", "some cause", "sosserverpath attribute must be set!");
-        expectSpecificBuildException("soslabel.2", "some cause", "username attribute must be set!");
-        expectSpecificBuildException("soslabel.3", "some cause", "vssserverpath attribute must be set!");
-        expectSpecificBuildException("soslabel.4", "some cause", "projectpath attribute must be set!");
-        expectSpecificBuildException("soslabel.5", "some cause", "label attribute must be set!");
-    }
-
-    private void expectSpecificBuildException(String target, String errorMessage,
-                                              String exceptionMessage) {
-        try {
-            buildRule.executeTarget(target);
-            fail(errorMessage);
-        } catch(BuildException ex) {
-            assertEquals(exceptionMessage, ex.getMessage());
-        }
-    }
-
-    /**
-     *  Iterate through the generated command line comparing it to reference
-     *  one.
-     *
-     * @param  sTestCmdLine       The reference command line;
-     * @param  sGeneratedCmdLine  The generated command line;
-     */
-    private void checkCommandLines(String[] sTestCmdLine, String[] sGeneratedCmdLine) {
-        int length = sTestCmdLine.length;
-        for (int i = 0; i < length; i++) {
-            try {
-                assertEquals("arg # " + String.valueOf(i),
-                        sTestCmdLine[i],
-                        sGeneratedCmdLine[i]);
-            } catch (ArrayIndexOutOfBoundsException aioob) {
-                fail("missing arg " + sTestCmdLine[i]);
-            }
-        }
-        if (sGeneratedCmdLine.length > sTestCmdLine.length) {
-            // We have extra elements
-            fail("extra args");
-        }
-    }
-}
+/*
+ *  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.sos;
+
+import java.io.File;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileRule;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.Commandline;
+import org.apache.tools.ant.types.Path;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ *  Testcase to ensure that command line generation and required attributes are
+ *  correct.
+ *
+ */
+public class SOSTest {
+
+    private Commandline commandline;
+
+    private static final String VSS_SERVER_PATH = "\\\\server\\vss\\srcsafe.ini";
+    private static final String VSS_PROJECT_PATH = "/SourceRoot/Project";
+    private static final String DS_VSS_PROJECT_PATH = "$/SourceRoot/Project";
+    private static final String SOS_SERVER_PATH = "192.168.0.1:8888";
+    private static final String SOS_USERNAME = "ant";
+    private static final String SOS_PASSWORD = "rocks";
+    private static final String LOCAL_PATH = "testdir";
+    private static final String SRC_FILE = "Class1.java";
+    private static final String SRC_LABEL = "label1";
+    private static final String SRC_COMMENT = "I fixed a bug";
+    private static final String SOS_HOME = "/home/user/.sos";
+    private static final String VERSION = "007";
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+    private Project project;
+
+    @Before
+    public void setUp() {
+        project = new Project();
+        project.init();
+        project.setBasedir(".");
+    }
+
+    @After
+    public void tearDown() {
+        File file = new File(project.getBaseDir(), LOCAL_PATH);
+        if (file.exists()) {
+            file.delete();
+        }
+    }
+
+    /**  Test SOSGetFile flags & commandline generation  */
+    @Test
+    public void testGetFileFlags() {
+        String[] sTestCmdLine = {"soscmd", "-command", "GetFile", "-file",
+                SRC_FILE, "-revision", "007", "-server", SOS_SERVER_PATH, "-name",
+                SOS_USERNAME, "-password", SOS_PASSWORD, "-database", VSS_SERVER_PATH,
+                "-project", DS_VSS_PROJECT_PATH, "-verbose", "-nocompress",
+                "-nocache", "-workdir", project.getBaseDir().getAbsolutePath()
+                 + File.separator + LOCAL_PATH};
+
+        // Set up a SOSGet task
+        SOSGet sosGet = new SOSGet();
+        sosGet.setProject(project);
+        sosGet.setVssServerPath(VSS_SERVER_PATH);
+        sosGet.setSosServerPath(SOS_SERVER_PATH);
+        sosGet.setProjectPath(VSS_PROJECT_PATH);
+        sosGet.setFile(SRC_FILE);
+        sosGet.setUsername(SOS_USERNAME);
+        sosGet.setPassword(SOS_PASSWORD);
+        sosGet.setVersion(VERSION);
+        sosGet.setLocalPath(new Path(project, LOCAL_PATH));
+        sosGet.setNoCache(true);
+        sosGet.setNoCompress(true);
+        sosGet.setVerbose(true);
+        sosGet.setRecursive(true);
+
+        commandline = sosGet.buildCmdLine();
+
+        checkCommandLines(sTestCmdLine, commandline.getCommandline());
+    }
+
+    /**  Test SOSGetProject flags & commandline generation  */
+    @Test
+    public void testGetProjectFlags() {
+        String[] sTestCmdLine = {"soscmd", "-command", "GetProject", "-recursive",
+                "-label", SRC_LABEL, "-server", SOS_SERVER_PATH, "-name", SOS_USERNAME,
+                "-password", "", "-database", VSS_SERVER_PATH, "-project",
+                DS_VSS_PROJECT_PATH, "", "", "-soshome", SOS_HOME, "-workdir",
+                project.getBaseDir().getAbsolutePath()};
+
+        // Set up a SOSGet task
+        SOSGet sosGet = new SOSGet();
+        sosGet.setProject(project);
+        sosGet.setVssServerPath(VSS_SERVER_PATH);
+        sosGet.setSosServerPath(SOS_SERVER_PATH);
+        sosGet.setProjectPath(DS_VSS_PROJECT_PATH);
+        sosGet.setLabel(SRC_LABEL);
+        sosGet.setUsername(SOS_USERNAME);
+        sosGet.setSosHome(SOS_HOME);
+        sosGet.setNoCache(true);
+        sosGet.setNoCompress(false);
+        sosGet.setVerbose(false);
+        sosGet.setRecursive(true);
+
+        commandline = sosGet.buildCmdLine();
+
+        checkCommandLines(sTestCmdLine, commandline.getCommandline());
+    }
+
+    /**  Tests SOSGet required attributes.  */
+    @Test
+    public void testGetExceptions() {
+        buildRule.configureProject("src/etc/testcases/taskdefs/optional/sos/sos.xml");
+        expectSpecificBuildException("sosget.1", "some cause", "sosserverpath attribute must be set!");
+        expectSpecificBuildException("sosget.2", "some cause", "username attribute must be set!");
+        expectSpecificBuildException("sosget.3", "some cause", "vssserverpath attribute must be set!");
+        expectSpecificBuildException("sosget.4", "some cause", "projectpath attribute must be set!");
+    }
+
+    /**  Test CheckInFile option flags  */
+    @Test
+    public void testCheckinFileFlags() {
+        String[] sTestCmdLine = {"soscmd", "-command", "CheckInFile", "-file",
+                SRC_FILE, "-server", SOS_SERVER_PATH, "-name", SOS_USERNAME,
+                "-password", SOS_PASSWORD, "-database", VSS_SERVER_PATH, "-project",
+                DS_VSS_PROJECT_PATH, "-verbose", "-nocompress", "-nocache",
+                "-workdir", project.getBaseDir().getAbsolutePath() + File.separator
+                 + LOCAL_PATH, "-log", SRC_COMMENT};
+
+        // Set up a SOSCheckin task
+        SOSCheckin sosCheckin = new SOSCheckin();
+        sosCheckin.setProject(project);
+        sosCheckin.setVssServerPath(VSS_SERVER_PATH);
+        sosCheckin.setSosServerPath(SOS_SERVER_PATH);
+        sosCheckin.setProjectPath(VSS_PROJECT_PATH);
+        sosCheckin.setFile(SRC_FILE);
+        sosCheckin.setComment(SRC_COMMENT);
+        sosCheckin.setUsername(SOS_USERNAME);
+        sosCheckin.setPassword(SOS_PASSWORD);
+        sosCheckin.setLocalPath(new Path(project, LOCAL_PATH));
+        sosCheckin.setNoCache(true);
+        sosCheckin.setNoCompress(true);
+        sosCheckin.setVerbose(true);
+        sosCheckin.setRecursive(true);
+
+        commandline = sosCheckin.buildCmdLine();
+
+        checkCommandLines(sTestCmdLine, commandline.getCommandline());
+    }
+
+    /**  Test CheckInProject option flags  */
+    @Test
+    public void testCheckinProjectFlags() {
+        String[] sTestCmdLine = {"soscmd", "-command", "CheckInProject",
+                "-recursive", "-server", SOS_SERVER_PATH, "-name", SOS_USERNAME,
+                "-password", "", "-database", VSS_SERVER_PATH, "-project",
+                DS_VSS_PROJECT_PATH, "", "", "-soshome", SOS_HOME, "-workdir",
+                project.getBaseDir().getAbsolutePath(), "-log", SRC_COMMENT,};
+
+        // Set up a SOSCheckin task
+        SOSCheckin sosCheckin = new SOSCheckin();
+        sosCheckin.setProject(project);
+        sosCheckin.setVssServerPath(VSS_SERVER_PATH);
+        sosCheckin.setSosServerPath(SOS_SERVER_PATH);
+        sosCheckin.setProjectPath(DS_VSS_PROJECT_PATH);
+        sosCheckin.setComment(SRC_COMMENT);
+        sosCheckin.setUsername(SOS_USERNAME);
+        sosCheckin.setSosHome(SOS_HOME);
+        sosCheckin.setNoCache(true);
+        sosCheckin.setNoCompress(false);
+        sosCheckin.setVerbose(false);
+        sosCheckin.setRecursive(true);
+
+        commandline = sosCheckin.buildCmdLine();
+
+        checkCommandLines(sTestCmdLine, commandline.getCommandline());
+    }
+
+    /**  Test SOSCheckIn required attributes.  */
+    @Test
+    public void testCheckinExceptions() {
+        buildRule.configureProject("src/etc/testcases/taskdefs/optional/sos/sos.xml");
+        expectSpecificBuildException("soscheckin.1", "some cause", "sosserverpath attribute must be set!");
+        expectSpecificBuildException("soscheckin.2", "some cause", "username attribute must be set!");
+        expectSpecificBuildException("soscheckin.3", "some cause", "vssserverpath attribute must be set!");
+        expectSpecificBuildException("soscheckin.4", "some cause", "projectpath attribute must be set!");
+    }
+
+    /**  Test CheckOutFile option flags  */
+    @Test
+    public void testCheckoutFileFlags() {
+        String[] sTestCmdLine = {"soscmd", "-command", "CheckOutFile", "-file",
+                SRC_FILE, "-server", SOS_SERVER_PATH, "-name", SOS_USERNAME,
+                "-password", SOS_PASSWORD, "-database", VSS_SERVER_PATH, "-project",
+                DS_VSS_PROJECT_PATH, "-verbose", "-nocompress", "-nocache",
+                "-workdir", project.getBaseDir().getAbsolutePath()
+                 + File.separator + LOCAL_PATH};
+
+        // Set up a SOSCheckout task
+        SOSCheckout sosCheckout = new SOSCheckout();
+        sosCheckout.setProject(project);
+        sosCheckout.setVssServerPath(VSS_SERVER_PATH);
+        sosCheckout.setSosServerPath(SOS_SERVER_PATH);
+        sosCheckout.setProjectPath(DS_VSS_PROJECT_PATH);
+        sosCheckout.setFile(SRC_FILE);
+        sosCheckout.setUsername(SOS_USERNAME);
+        sosCheckout.setPassword(SOS_PASSWORD);
+        sosCheckout.setLocalPath(new Path(project, LOCAL_PATH));
+        sosCheckout.setNoCache(true);
+        sosCheckout.setNoCompress(true);
+        sosCheckout.setVerbose(true);
+        sosCheckout.setRecursive(true);
+
+        commandline = sosCheckout.buildCmdLine();
+
+        checkCommandLines(sTestCmdLine, commandline.getCommandline());
+    }
+
+    /**  Test CheckOutProject option flags  */
+    @Test
+    public void testCheckoutProjectFlags() {
+        String[] sTestCmdLine = {"soscmd", "-command", "CheckOutProject",
+                "-recursive", "-server", SOS_SERVER_PATH, "-name", SOS_USERNAME,
+                "-password", "", "-database", VSS_SERVER_PATH, "-project",
+                DS_VSS_PROJECT_PATH, "", "", "-soshome", SOS_HOME, "-workdir",
+                project.getBaseDir().getAbsolutePath()};
+
+        // Set up a sosCheckout task
+        SOSCheckout sosCheckout = new SOSCheckout();
+        sosCheckout.setProject(project);
+        sosCheckout.setVssServerPath(VSS_SERVER_PATH);
+        sosCheckout.setSosServerPath(SOS_SERVER_PATH);
+        sosCheckout.setProjectPath(VSS_PROJECT_PATH);
+        sosCheckout.setUsername(SOS_USERNAME);
+        sosCheckout.setSosHome(SOS_HOME);
+        sosCheckout.setNoCache(true);
+        sosCheckout.setNoCompress(false);
+        sosCheckout.setVerbose(false);
+        sosCheckout.setRecursive(true);
+
+        commandline = sosCheckout.buildCmdLine();
+
+        checkCommandLines(sTestCmdLine, commandline.getCommandline());
+    }
+
+    /**  Test SOSCheckout required attributes.  */
+    @Test
+    public void testCheckoutExceptions() {
+        buildRule.configureProject("src/etc/testcases/taskdefs/optional/sos/sos.xml");
+        expectSpecificBuildException("soscheckout.1", "some cause", "sosserverpath attribute must be set!");
+        expectSpecificBuildException("soscheckout.2", "some cause", "username attribute must be set!");
+        expectSpecificBuildException("soscheckout.3", "some cause", "vssserverpath attribute must be set!");
+        expectSpecificBuildException("soscheckout.4", "some cause", "projectpath attribute must be set!");
+    }
+
+    /**  Test Label option flags  */
+    @Test
+    public void testLabelFlags() {
+        String[] sTestCmdLine = {"soscmd", "-command", "AddLabel", "-server",
+                SOS_SERVER_PATH, "-name", SOS_USERNAME, "-password", "", "-database",
+                VSS_SERVER_PATH, "-project", DS_VSS_PROJECT_PATH, "-label",
+                SRC_LABEL, "-verbose", "-log", SRC_COMMENT};
+
+        // Set up a sosCheckout task
+        SOSLabel sosLabel = new SOSLabel();
+        sosLabel.setVssServerPath(VSS_SERVER_PATH);
+        sosLabel.setSosServerPath(SOS_SERVER_PATH);
+        sosLabel.setProjectPath(DS_VSS_PROJECT_PATH);
+        sosLabel.setUsername(SOS_USERNAME);
+        sosLabel.setSosHome(SOS_HOME);
+        sosLabel.setComment(SRC_COMMENT);
+        sosLabel.setLabel(SRC_LABEL);
+        sosLabel.setNoCache(true);
+        sosLabel.setNoCompress(false);
+        sosLabel.setVerbose(true);
+
+        commandline = sosLabel.buildCmdLine();
+
+        checkCommandLines(sTestCmdLine, commandline.getCommandline());
+    }
+
+    /**  Test SOSLabel required attributes.  */
+    @Test
+    public void testLabelExceptions() {
+        buildRule.configureProject("src/etc/testcases/taskdefs/optional/sos/sos.xml");
+        expectSpecificBuildException("soslabel.1", "some cause", "sosserverpath attribute must be set!");
+        expectSpecificBuildException("soslabel.2", "some cause", "username attribute must be set!");
+        expectSpecificBuildException("soslabel.3", "some cause", "vssserverpath attribute must be set!");
+        expectSpecificBuildException("soslabel.4", "some cause", "projectpath attribute must be set!");
+        expectSpecificBuildException("soslabel.5", "some cause", "label attribute must be set!");
+    }
+
+    private void expectSpecificBuildException(String target, String errorMessage,
+                                              String exceptionMessage) {
+        try {
+            buildRule.executeTarget(target);
+            fail(errorMessage);
+        } catch(BuildException ex) {
+            assertEquals(exceptionMessage, ex.getMessage());
+        }
+    }
+
+    /**
+     *  Iterate through the generated command line comparing it to reference
+     *  one.
+     *
+     * @param  sTestCmdLine       The reference command line;
+     * @param  sGeneratedCmdLine  The generated command line;
+     */
+    private void checkCommandLines(String[] sTestCmdLine, String[] sGeneratedCmdLine) {
+        int length = sTestCmdLine.length;
+        for (int i = 0; i < length; i++) {
+            try {
+                assertEquals("arg # " + String.valueOf(i),
+                        sTestCmdLine[i],
+                        sGeneratedCmdLine[i]);
+            } catch (ArrayIndexOutOfBoundsException aioob) {
+                fail("missing arg " + sTestCmdLine[i]);
+            }
+        }
+        if (sGeneratedCmdLine.length > sTestCmdLine.length) {
+            // We have extra elements
+            fail("extra args");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/splash/SplashScreenTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/splash/SplashScreenTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/splash/SplashScreenTest.java
index b9fa0b5..dfec9f5 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/splash/SplashScreenTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/splash/SplashScreenTest.java
@@ -1,50 +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.splash;
-
-import org.apache.tools.ant.Project;
-
-/**
- * This is an "interactive" test, it passes if the splash screen
- * disappears after the "finished" but before the "exiting" message.
- *
- * This even isn't a JUnit test case.
- *
- * @since Ant 1.5.2
- */
-public class SplashScreenTest {
-
-    public static void main(String[] args) throws InterruptedException {
-        Project p = new Project();
-        SplashTask t = new SplashTask();
-        t.setProject(p);
-        t.execute();
-
-        // give it some time to display
-        Thread.sleep(2000);
-
-        p.fireBuildFinished(null);
-        System.err.println("finished");
-
-        Thread.sleep(2000);
-        System.err.println("exiting");
-        System.exit(0);
-    }
-}
-
+/*
+ *  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.splash;
+
+import org.apache.tools.ant.Project;
+
+/**
+ * This is an "interactive" test, it passes if the splash screen
+ * disappears after the "finished" but before the "exiting" message.
+ *
+ * This even isn't a JUnit test case.
+ *
+ * @since Ant 1.5.2
+ */
+public class SplashScreenTest {
+
+    public static void main(String[] args) throws InterruptedException {
+        Project p = new Project();
+        SplashTask t = new SplashTask();
+        t.setProject(p);
+        t.execute();
+
+        // give it some time to display
+        Thread.sleep(2000);
+
+        p.fireBuildFinished(null);
+        System.err.println("finished");
+
+        Thread.sleep(2000);
+        System.err.println("exiting");
+        System.exit(0);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/unix/SymlinkTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/unix/SymlinkTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/unix/SymlinkTest.java
index 0ac0746..e36d683 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/unix/SymlinkTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/unix/SymlinkTest.java
@@ -1,297 +1,297 @@
-/*
- *  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.
- *
- */
-
-/*
- * Since the initial version of this file was deveolped on the clock on
- * an NSF grant I should say the following boilerplate:
- *
- * This material is based upon work supported by the National Science
- * Foundaton under Grant No. EIA-0196404. Any opinions, findings, and
- * conclusions or recommendations expressed in this material are those
- * of the author and do not necessarily reflect the views of the
- * National Science Foundation.
- */
-
-package org.apache.tools.ant.taskdefs.optional.unix;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.apache.tools.ant.taskdefs.condition.Os;
-
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.util.SymbolicLinkUtils;
-import org.junit.After;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.File;
-
-/**
- * Test cases for the Symlink task. Link creation, link deletion, recording
- * of links in multiple directories, and restoration of links recorded are
- * all tested. A separate test for the utility method Symlink.deleteSymlink
- * is not included because action="delete" only prints a message and calls
- * Symlink.deleteSymlink, making a separate test redundant.
- *
- */
-
-public class SymlinkTest {
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    private boolean supportsSymlinks = Os.isFamily("unix");
-
-    @Before
-    public void setUp() {
-        Assume.assumeTrue("Symlinks not supported on current operating system", supportsSymlinks);
-        buildRule.configureProject("src/etc/testcases/taskdefs/optional/unix/symlink.xml");
-        buildRule.executeTarget("setUp");
-    }
-
-    @Test
-    public void testSingle() {
-        buildRule.executeTarget("test-single");
-        Project p = buildRule.getProject();
-        assertNotNull("Failed to create file",
-                          p.getProperty("test.single.file.created"));
-        assertNotNull("Failed to create link",
-                          p.getProperty("test.single.link.created"));
-    }
-
-    @Test
-    public void testDelete() {
-        buildRule.executeTarget("test-delete");
-        Project p = buildRule.getProject();
-        String linkDeleted = p.getProperty("test.delete.link.still.there");
-        assertNotNull("Actual file deleted by symlink",
-                      p.getProperty("test.delete.file.still.there"));
-        if (linkDeleted != null) {
-            fail(linkDeleted);
-        }
-    }
-
-    @Test
-    public void testRecord() {
-        buildRule.executeTarget("test-record");
-        Project p = buildRule.getProject();
-
-        assertNotNull("Failed to create dir1",
-                      p.getProperty("test.record.dir1.created"));
-
-        assertNotNull("Failed to create dir2",
-                      p.getProperty("test.record.dir2.created"));
-
-        assertNotNull("Failed to create file1",
-                      p.getProperty("test.record.file1.created"));
-
-        assertNotNull("Failed to create file2",
-                      p.getProperty("test.record.file2.created"));
-
-        assertNotNull("Failed to create fileA",
-                      p.getProperty("test.record.fileA.created"));
-
-        assertNotNull("Failed to create fileB",
-                      p.getProperty("test.record.fileB.created"));
-
-        assertNotNull("Failed to create fileC",
-                      p.getProperty("test.record.fileC.created"));
-
-        assertNotNull("Failed to create link1",
-                      p.getProperty("test.record.link1.created"));
-
-        assertNotNull("Failed to create link2",
-                      p.getProperty("test.record.link2.created"));
-
-        assertNotNull("Failed to create link3",
-                      p.getProperty("test.record.link3.created"));
-
-        assertNotNull("Failed to create dirlink",
-                      p.getProperty("test.record.dirlink.created"));
-
-        assertNotNull("Failed to create dirlink2",
-                      p.getProperty("test.record.dirlink2.created"));
-
-        assertNotNull("Couldn't record links in dir1",
-                      p.getProperty("test.record.dir1.recorded"));
-
-        assertNotNull("Couldn't record links in dir2",
-                      p.getProperty("test.record.dir2.recorded"));
-
-        String dir3rec = p.getProperty("test.record.dir3.recorded");
-
-        if (dir3rec != null) {
-            fail(dir3rec);
-        }
-
-    }
-
-    @Test
-    public void testRecreate() {
-        buildRule.executeTarget("test-recreate");
-        Project p = buildRule.getProject();
-        String link1Rem = p.getProperty("test.recreate.link1.not.removed");
-        String link2Rem = p.getProperty("test.recreate.link2.not.removed");
-        String link3Rem = p.getProperty("test.recreate.link3.not.removed");
-        String dirlinkRem = p.getProperty("test.recreate.dirlink.not.removed");
-        if (link1Rem != null) {
-            fail(link1Rem);
-        }
-        if (link2Rem != null) {
-            fail(link2Rem);
-        }
-        if (link3Rem != null) {
-            fail(link3Rem);
-        }
-        if (dirlinkRem != null) {
-            fail(dirlinkRem);
-        }
-        assertNotNull("Failed to recreate link1",
-                      p.getProperty("test.recreate.link1.recreated"));
-        assertNotNull("Failed to recreate link2",
-                      p.getProperty("test.recreate.link2.recreated"));
-        assertNotNull("Failed to recreate link3",
-                      p.getProperty("test.recreate.link3.recreated"));
-        assertNotNull("Failed to recreate dirlink",
-                      p.getProperty("test.recreate.dirlink.recreated"));
-
-        String doubleRecreate = p.getProperty("test.recreate.dirlink2.recreated.twice");
-
-        if (doubleRecreate != null) {
-            fail(doubleRecreate);
-        }
-
-        assertNotNull("Failed to alter dirlink3",
-                      p.getProperty("test.recreate.dirlink3.was.altered"));
-    }
-
-    @Test
-    public void testSymbolicLinkUtilsMethods() throws Exception {
-
-        buildRule.executeTarget("test-fileutils");
-        SymbolicLinkUtils su = SymbolicLinkUtils.getSymbolicLinkUtils();
-
-        java.io.File f = new File(buildRule.getOutputDir(), "file1");
-        assertTrue(f.exists());
-        assertFalse(f.isDirectory());
-        assertTrue(f.isFile());
-        assertFalse(su.isSymbolicLink(f.getAbsolutePath()));
-        assertFalse(su.isSymbolicLink(f.getParentFile(),
-                                      f.getName()));
-        assertFalse(su.isDanglingSymbolicLink(f.getAbsolutePath()));
-        assertFalse(su.isDanglingSymbolicLink(f.getParentFile(),
-                                              f.getName()));
-
-        f = new File(buildRule.getOutputDir(), "dir1");
-        assertTrue(f.exists());
-        assertTrue(f.isDirectory());
-        assertFalse(f.isFile());
-        assertFalse(su.isSymbolicLink(f.getAbsolutePath()));
-        assertFalse(su.isSymbolicLink(f.getParentFile(),
-                                      f.getName()));
-        assertFalse(su.isDanglingSymbolicLink(f.getAbsolutePath()));
-        assertFalse(su.isDanglingSymbolicLink(f.getParentFile(),
-                                              f.getName()));
-
-        f = new File(buildRule.getOutputDir(), "file2");
-        assertFalse(f.exists());
-        assertFalse(f.isDirectory());
-        assertFalse(f.isFile());
-        assertFalse(su.isSymbolicLink(f.getAbsolutePath()));
-        assertFalse(su.isSymbolicLink(f.getParentFile(),
-                                      f.getName()));
-        assertFalse(su.isDanglingSymbolicLink(f.getAbsolutePath()));
-        assertFalse(su.isDanglingSymbolicLink(f.getParentFile(),
-                                              f.getName()));
-
-        f = new File(buildRule.getOutputDir(), "dir2");
-        assertFalse(f.exists());
-        assertFalse(f.isDirectory());
-        assertFalse(f.isFile());
-        assertFalse(su.isSymbolicLink(f.getAbsolutePath()));
-        assertFalse(su.isSymbolicLink(f.getParentFile(),
-                                      f.getName()));
-        assertFalse(su.isDanglingSymbolicLink(f.getAbsolutePath()));
-        assertFalse(su.isDanglingSymbolicLink(f.getParentFile(),
-                                              f.getName()));
-
-
-        f = new File(buildRule.getOutputDir(), "file.there");
-        assertTrue(f.exists());
-        assertFalse(f.isDirectory());
-        assertTrue(f.isFile());
-        assertTrue(su.isSymbolicLink(f.getAbsolutePath()));
-        assertTrue(su.isSymbolicLink(f.getParentFile(),
-                                     f.getName()));
-        assertFalse(su.isDanglingSymbolicLink(f.getAbsolutePath()));
-        assertFalse(su.isDanglingSymbolicLink(f.getParentFile(),
-                                              f.getName()));
-
-        f = new File(buildRule.getOutputDir(), "dir.there");
-        assertTrue(f.exists());
-        assertTrue(f.isDirectory());
-        assertFalse(f.isFile());
-        assertTrue(su.isSymbolicLink(f.getAbsolutePath()));
-        assertTrue(su.isSymbolicLink(f.getParentFile(),
-                                     f.getName()));
-        assertFalse(su.isDanglingSymbolicLink(f.getAbsolutePath()));
-        assertFalse(su.isDanglingSymbolicLink(f.getParentFile(),
-                                              f.getName()));
-
-        // it is not possible to find out that symbolic links pointing
-        // to inexistent files or directories are symbolic links
-        // it used to be possible to detect this on Mac
-        // this is not true under Snow Leopard and JDK 1.5
-        // Removing special handling of MacOS until someone shouts
-        // Antoine
-        f = new File(buildRule.getOutputDir(), "file.notthere");
-        assertFalse(f.exists());
-        assertFalse(f.isDirectory());
-        assertFalse(f.isFile());
-        assertTrue(su.isSymbolicLink(f.getAbsolutePath()) == false);
-        assertTrue(su.isSymbolicLink(f.getParentFile(), f.getName()) == false);
-        assertTrue(su.isDanglingSymbolicLink(f.getAbsolutePath()));
-        assertTrue(su.isDanglingSymbolicLink(f.getParentFile(),
-                                             f.getName()));
-
-        f = new File(buildRule.getOutputDir(), "dir.notthere");
-        assertFalse(f.exists());
-        assertFalse(f.isDirectory());
-        assertFalse(f.isFile());
-        assertTrue(su.isSymbolicLink(f.getAbsolutePath()) == false);
-        assertTrue(su.isSymbolicLink(f.getParentFile(), f.getName()) == false);
-        assertTrue(su.isDanglingSymbolicLink(f.getAbsolutePath()));
-        assertTrue(su.isDanglingSymbolicLink(f.getParentFile(),
-                                             f.getName()));
-
-    }
-
-    @After
-    public void tearDown() {
-        if (buildRule.getProject() != null) {
-            buildRule.executeTarget("tearDown");
-        }
-    }
-
-}
+/*
+ *  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.
+ *
+ */
+
+/*
+ * Since the initial version of this file was deveolped on the clock on
+ * an NSF grant I should say the following boilerplate:
+ *
+ * This material is based upon work supported by the National Science
+ * Foundaton under Grant No. EIA-0196404. Any opinions, findings, and
+ * conclusions or recommendations expressed in this material are those
+ * of the author and do not necessarily reflect the views of the
+ * National Science Foundation.
+ */
+
+package org.apache.tools.ant.taskdefs.optional.unix;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.apache.tools.ant.taskdefs.condition.Os;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.util.SymbolicLinkUtils;
+import org.junit.After;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+
+/**
+ * Test cases for the Symlink task. Link creation, link deletion, recording
+ * of links in multiple directories, and restoration of links recorded are
+ * all tested. A separate test for the utility method Symlink.deleteSymlink
+ * is not included because action="delete" only prints a message and calls
+ * Symlink.deleteSymlink, making a separate test redundant.
+ *
+ */
+
+public class SymlinkTest {
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    private boolean supportsSymlinks = Os.isFamily("unix");
+
+    @Before
+    public void setUp() {
+        Assume.assumeTrue("Symlinks not supported on current operating system", supportsSymlinks);
+        buildRule.configureProject("src/etc/testcases/taskdefs/optional/unix/symlink.xml");
+        buildRule.executeTarget("setUp");
+    }
+
+    @Test
+    public void testSingle() {
+        buildRule.executeTarget("test-single");
+        Project p = buildRule.getProject();
+        assertNotNull("Failed to create file",
+                          p.getProperty("test.single.file.created"));
+        assertNotNull("Failed to create link",
+                          p.getProperty("test.single.link.created"));
+    }
+
+    @Test
+    public void testDelete() {
+        buildRule.executeTarget("test-delete");
+        Project p = buildRule.getProject();
+        String linkDeleted = p.getProperty("test.delete.link.still.there");
+        assertNotNull("Actual file deleted by symlink",
+                      p.getProperty("test.delete.file.still.there"));
+        if (linkDeleted != null) {
+            fail(linkDeleted);
+        }
+    }
+
+    @Test
+    public void testRecord() {
+        buildRule.executeTarget("test-record");
+        Project p = buildRule.getProject();
+
+        assertNotNull("Failed to create dir1",
+                      p.getProperty("test.record.dir1.created"));
+
+        assertNotNull("Failed to create dir2",
+                      p.getProperty("test.record.dir2.created"));
+
+        assertNotNull("Failed to create file1",
+                      p.getProperty("test.record.file1.created"));
+
+        assertNotNull("Failed to create file2",
+                      p.getProperty("test.record.file2.created"));
+
+        assertNotNull("Failed to create fileA",
+                      p.getProperty("test.record.fileA.created"));
+
+        assertNotNull("Failed to create fileB",
+                      p.getProperty("test.record.fileB.created"));
+
+        assertNotNull("Failed to create fileC",
+                      p.getProperty("test.record.fileC.created"));
+
+        assertNotNull("Failed to create link1",
+                      p.getProperty("test.record.link1.created"));
+
+        assertNotNull("Failed to create link2",
+                      p.getProperty("test.record.link2.created"));
+
+        assertNotNull("Failed to create link3",
+                      p.getProperty("test.record.link3.created"));
+
+        assertNotNull("Failed to create dirlink",
+                      p.getProperty("test.record.dirlink.created"));
+
+        assertNotNull("Failed to create dirlink2",
+                      p.getProperty("test.record.dirlink2.created"));
+
+        assertNotNull("Couldn't record links in dir1",
+                      p.getProperty("test.record.dir1.recorded"));
+
+        assertNotNull("Couldn't record links in dir2",
+                      p.getProperty("test.record.dir2.recorded"));
+
+        String dir3rec = p.getProperty("test.record.dir3.recorded");
+
+        if (dir3rec != null) {
+            fail(dir3rec);
+        }
+
+    }
+
+    @Test
+    public void testRecreate() {
+        buildRule.executeTarget("test-recreate");
+        Project p = buildRule.getProject();
+        String link1Rem = p.getProperty("test.recreate.link1.not.removed");
+        String link2Rem = p.getProperty("test.recreate.link2.not.removed");
+        String link3Rem = p.getProperty("test.recreate.link3.not.removed");
+        String dirlinkRem = p.getProperty("test.recreate.dirlink.not.removed");
+        if (link1Rem != null) {
+            fail(link1Rem);
+        }
+        if (link2Rem != null) {
+            fail(link2Rem);
+        }
+        if (link3Rem != null) {
+            fail(link3Rem);
+        }
+        if (dirlinkRem != null) {
+            fail(dirlinkRem);
+        }
+        assertNotNull("Failed to recreate link1",
+                      p.getProperty("test.recreate.link1.recreated"));
+        assertNotNull("Failed to recreate link2",
+                      p.getProperty("test.recreate.link2.recreated"));
+        assertNotNull("Failed to recreate link3",
+                      p.getProperty("test.recreate.link3.recreated"));
+        assertNotNull("Failed to recreate dirlink",
+                      p.getProperty("test.recreate.dirlink.recreated"));
+
+        String doubleRecreate = p.getProperty("test.recreate.dirlink2.recreated.twice");
+
+        if (doubleRecreate != null) {
+            fail(doubleRecreate);
+        }
+
+        assertNotNull("Failed to alter dirlink3",
+                      p.getProperty("test.recreate.dirlink3.was.altered"));
+    }
+
+    @Test
+    public void testSymbolicLinkUtilsMethods() throws Exception {
+
+        buildRule.executeTarget("test-fileutils");
+        SymbolicLinkUtils su = SymbolicLinkUtils.getSymbolicLinkUtils();
+
+        java.io.File f = new File(buildRule.getOutputDir(), "file1");
+        assertTrue(f.exists());
+        assertFalse(f.isDirectory());
+        assertTrue(f.isFile());
+        assertFalse(su.isSymbolicLink(f.getAbsolutePath()));
+        assertFalse(su.isSymbolicLink(f.getParentFile(),
+                                      f.getName()));
+        assertFalse(su.isDanglingSymbolicLink(f.getAbsolutePath()));
+        assertFalse(su.isDanglingSymbolicLink(f.getParentFile(),
+                                              f.getName()));
+
+        f = new File(buildRule.getOutputDir(), "dir1");
+        assertTrue(f.exists());
+        assertTrue(f.isDirectory());
+        assertFalse(f.isFile());
+        assertFalse(su.isSymbolicLink(f.getAbsolutePath()));
+        assertFalse(su.isSymbolicLink(f.getParentFile(),
+                                      f.getName()));
+        assertFalse(su.isDanglingSymbolicLink(f.getAbsolutePath()));
+        assertFalse(su.isDanglingSymbolicLink(f.getParentFile(),
+                                              f.getName()));
+
+        f = new File(buildRule.getOutputDir(), "file2");
+        assertFalse(f.exists());
+        assertFalse(f.isDirectory());
+        assertFalse(f.isFile());
+        assertFalse(su.isSymbolicLink(f.getAbsolutePath()));
+        assertFalse(su.isSymbolicLink(f.getParentFile(),
+                                      f.getName()));
+        assertFalse(su.isDanglingSymbolicLink(f.getAbsolutePath()));
+        assertFalse(su.isDanglingSymbolicLink(f.getParentFile(),
+                                              f.getName()));
+
+        f = new File(buildRule.getOutputDir(), "dir2");
+        assertFalse(f.exists());
+        assertFalse(f.isDirectory());
+        assertFalse(f.isFile());
+        assertFalse(su.isSymbolicLink(f.getAbsolutePath()));
+        assertFalse(su.isSymbolicLink(f.getParentFile(),
+                                      f.getName()));
+        assertFalse(su.isDanglingSymbolicLink(f.getAbsolutePath()));
+        assertFalse(su.isDanglingSymbolicLink(f.getParentFile(),
+                                              f.getName()));
+
+
+        f = new File(buildRule.getOutputDir(), "file.there");
+        assertTrue(f.exists());
+        assertFalse(f.isDirectory());
+        assertTrue(f.isFile());
+        assertTrue(su.isSymbolicLink(f.getAbsolutePath()));
+        assertTrue(su.isSymbolicLink(f.getParentFile(),
+                                     f.getName()));
+        assertFalse(su.isDanglingSymbolicLink(f.getAbsolutePath()));
+        assertFalse(su.isDanglingSymbolicLink(f.getParentFile(),
+                                              f.getName()));
+
+        f = new File(buildRule.getOutputDir(), "dir.there");
+        assertTrue(f.exists());
+        assertTrue(f.isDirectory());
+        assertFalse(f.isFile());
+        assertTrue(su.isSymbolicLink(f.getAbsolutePath()));
+        assertTrue(su.isSymbolicLink(f.getParentFile(),
+                                     f.getName()));
+        assertFalse(su.isDanglingSymbolicLink(f.getAbsolutePath()));
+        assertFalse(su.isDanglingSymbolicLink(f.getParentFile(),
+                                              f.getName()));
+
+        // it is not possible to find out that symbolic links pointing
+        // to inexistent files or directories are symbolic links
+        // it used to be possible to detect this on Mac
+        // this is not true under Snow Leopard and JDK 1.5
+        // Removing special handling of MacOS until someone shouts
+        // Antoine
+        f = new File(buildRule.getOutputDir(), "file.notthere");
+        assertFalse(f.exists());
+        assertFalse(f.isDirectory());
+        assertFalse(f.isFile());
+        assertTrue(su.isSymbolicLink(f.getAbsolutePath()) == false);
+        assertTrue(su.isSymbolicLink(f.getParentFile(), f.getName()) == false);
+        assertTrue(su.isDanglingSymbolicLink(f.getAbsolutePath()));
+        assertTrue(su.isDanglingSymbolicLink(f.getParentFile(),
+                                             f.getName()));
+
+        f = new File(buildRule.getOutputDir(), "dir.notthere");
+        assertFalse(f.exists());
+        assertFalse(f.isDirectory());
+        assertFalse(f.isFile());
+        assertTrue(su.isSymbolicLink(f.getAbsolutePath()) == false);
+        assertTrue(su.isSymbolicLink(f.getParentFile(), f.getName()) == false);
+        assertTrue(su.isDanglingSymbolicLink(f.getAbsolutePath()));
+        assertTrue(su.isDanglingSymbolicLink(f.getParentFile(),
+                                             f.getName()));
+
+    }
+
+    @After
+    public void tearDown() {
+        if (buildRule.getProject() != null) {
+            buildRule.executeTarget("tearDown");
+        }
+    }
+
+}


[08/21] ant git commit: Normalise tabulation and line breaks

Posted by gi...@apache.org.
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
index e83c5b7..86108dc 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
@@ -1,1062 +1,1062 @@
-/*
- *  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.types.selectors;
-
-
-// Java
-import java.io.File;
-import java.text.RuleBasedCollator;
-import java.util.Comparator;
-import java.util.Iterator;
-
-import org.apache.tools.ant.AntAssert;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.BuildFileRule;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Target;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.types.Parameter;
-import org.apache.tools.ant.types.Path;
-import org.apache.tools.ant.types.selectors.modifiedselector.Algorithm;
-import org.apache.tools.ant.types.selectors.modifiedselector.Cache;
-import org.apache.tools.ant.types.selectors.modifiedselector.ChecksumAlgorithm;
-import org.apache.tools.ant.types.selectors.modifiedselector.DigestAlgorithm;
-import org.apache.tools.ant.types.selectors.modifiedselector.EqualComparator;
-import org.apache.tools.ant.types.selectors.modifiedselector.HashvalueAlgorithm;
-import org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector;
-import org.apache.tools.ant.types.selectors.modifiedselector.PropertiesfileCache;
-import org.apache.tools.ant.util.FileUtils;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-
-/**
- * Unit tests for ModifiedSelector.
- *
- * @since  Ant 1.6
- */
-public class ModifiedSelectorTest {
-    
-    @Rule
-    public final BaseSelectorRule selectorRule = new BaseSelectorRule();
-
-    /** Utilities used for file operations */
-    private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
-
-    //  =====================  attributes  =====================
-
-
-    /** Path where the testclasses are. */
-    private Path testclasses = null;
-
-
-
-
-    //  =====================  JUnit stuff  =====================
-
-
-    @Before
-    public void setUp() {
-        // init the testclasses path object
-        Project prj = selectorRule.getProject();
-        testclasses = new Path(prj, prj.getProperty("build.tests.value"));
-    }
-
-
-    // =======  testcases for the attributes and nested elements of the selector  =====
-
-
-    /** Test right use of cache names. */
-    @Test
-    public void testValidateWrongCache() {
-        String name = "this-is-not-a-valid-cache-name";
-        try {
-            ModifiedSelector.CacheName cacheName = new ModifiedSelector.CacheName();
-            cacheName.setValue(name);
-            fail("CacheSelector.CacheName accepted invalid value.");
-        } catch (BuildException be) {
-            assertEquals(name + " is not a legal value for this attribute",
-                         be.getMessage());
-        }
-    }
-
-
-    /** Test right use of cache names. */
-    @Test
-    public void testValidateWrongAlgorithm() {
-        String name = "this-is-not-a-valid-algorithm-name";
-        try {
-            ModifiedSelector.AlgorithmName algoName
-                = new ModifiedSelector.AlgorithmName();
-            algoName.setValue(name);
-            fail("CacheSelector.AlgorithmName accepted invalid value.");
-        } catch (BuildException be) {
-            assertEquals(name + " is not a legal value for this attribute",
-                         be.getMessage());
-        }
-    }
-
-
-    /** Test right use of comparator names. */
-    @Test
-    public void testValidateWrongComparator() {
-        String name = "this-is-not-a-valid-comparator-name";
-        try {
-            ModifiedSelector.ComparatorName compName
-                = new ModifiedSelector.ComparatorName();
-            compName.setValue(name);
-            fail("ModifiedSelector.ComparatorName accepted invalid value.");
-        } catch (BuildException be) {
-            assertEquals(name + " is not a legal value for this attribute",
-                         be.getMessage());
-        }
-    }
-
-
-    @Test
-    public void testIllegalCustomAlgorithm() {
-        try {
-            getAlgoName("java.lang.Object");
-            fail("Illegal classname used.");
-        } catch (BuildException e) {
-            assertEquals("Wrong exception message.",
-                         "Specified class (java.lang.Object) is not an Algorithm.",
-                         e.getMessage());
-
-        }
-    }
-
-
-    @Test
-    public void testNonExistentCustomAlgorithm() {
-         try {
-            getAlgoName("non.existent.custom.Algorithm");
-            fail("does 'non.existent.custom.Algorithm' really exist?");
-        } catch (BuildException e) {
-            assertEquals("Wrong exception message.",
-                         "Specified class (non.existent.custom.Algorithm) not found.",
-                         e.getMessage());
-
-        }
-    }
-
-    @Test
-    public void testCustomAlgorithm() {
-        String algo = getAlgoName("org.apache.tools.ant.types.selectors.modifiedselector.HashvalueAlgorithm");
-        assertTrue("Wrong algorithm used: "+algo, algo.startsWith("HashvalueAlgorithm"));
-    }
-
-    @Test
-    public void testCustomAlgorithm2() {
-        String algo = getAlgoName("org.apache.tools.ant.types.selectors.MockAlgorithm");
-        assertTrue("Wrong algorithm used: "+algo, algo.startsWith("MockAlgorithm"));
-    }
-
-
-    @Test
-    public void testCustomClasses() {
-        Assume.assumeNotNull("Ant home not set", selectorRule.getProject().getProperty("ant.home") );
-        BFT bft = new BFT();
-        bft.setUp();
-        try {
-            // do the actions
-            bft.doTarget("modifiedselectortest-customClasses");
-            // do the checks - the buildfile stores the fileset as property
-            String fsFullValue = bft.getProperty("fs.full.value");
-            String fsModValue  = bft.getProperty("fs.mod.value");
-
-            assertNotNull("'fs.full.value' must be set.", fsFullValue);
-            assertTrue("'fs.full.value' must not be null.", !"".equals(fsFullValue));
-            assertTrue("'fs.full.value' must contain ant.bat.", fsFullValue.indexOf("ant.bat")>-1);
-
-            assertNotNull("'fs.mod.value' must be set.", fsModValue);
-            // must be empty according to the Mock* implementations
-            assertTrue("'fs.mod.value' must be empty.", "".equals(fsModValue));
-        // don't catch the JUnit exceptions
-        } finally {
-            bft.doTarget("modifiedselectortest-scenario-clean");
-            bft.deletePropertiesfile();
-            bft.tearDown();
-        }
-    }
-
-
-    @Test
-    public void testDelayUpdateTaskFinished() {
-        doDelayUpdateTest(1);
-    }
-
-
-    @Test
-    public void testDelayUpdateTargetFinished() {
-        doDelayUpdateTest(2);
-    }
-
-
-    @Test
-    public void testDelayUpdateBuildFinished() {
-        doDelayUpdateTest(3);
-    }
-
-
-    public void doDelayUpdateTest(int kind) {
-        // no check for 1<=kind<=3 - only internal use therefore check it
-        // while development
-
-        // readable form of parameter kind
-        String[] kinds = {"task", "target", "build"};
-
-        // setup the "Ant project"
-        MockProject project = new MockProject();
-        File base  = new File("base");
-        File file1 = new File("file1");
-        File file2 = new File("file2");
-
-        // setup the selector
-        ModifiedSelector sel = new ModifiedSelector();
-        sel.setProject(project);
-        sel.setUpdate(true);
-        sel.setDelayUpdate(true);
-        // sorry - otherwise we will get a ClassCastException because the MockCache
-        // is loaded by two different classloader ...
-        sel.setClassLoader(this.getClass().getClassLoader());
-        sel.addClasspath(testclasses);
-
-        sel.setAlgorithmClass("org.apache.tools.ant.types.selectors.MockAlgorithm");
-        sel.setCacheClass("org.apache.tools.ant.types.selectors.MockCache");
-        sel.configure();
-
-        // get the cache, so we can check our things
-        MockCache cache = (MockCache)sel.getCache();
-
-        // the test
-        assertFalse("Cache must not be saved before 1st selection.", cache.saved);
-        sel.isSelected(base, "file1", file1);
-        assertFalse("Cache must not be saved after 1st selection.", cache.saved);
-        sel.isSelected(base, "file2", file2);
-        assertFalse("Cache must not be saved after 2nd selection.", cache.saved);
-        switch (kind) {
-            case 1 : project.fireTaskFinished();   break;
-            case 2 : project.fireTargetFinished(); break;
-            case 3 : project.fireBuildFinished();  break;
-        }
-        assertTrue("Cache must be saved after " + kinds[kind-1] + "Finished-Event.", cache.saved);
-
-        // MockCache doesnt create a file - therefore no cleanup needed
-    }
-
-
-    /**
-     * Extracts the real used algorithm name from the ModifiedSelector using
-     * its toString() method.
-     * @param classname  the classname from the algorithm to use
-     * @return  the algorithm part from the toString() (without brackets)
-     */
-    private String getAlgoName(String classname) {
-        ModifiedSelector sel = new ModifiedSelector();
-        sel.setProject(selectorRule.getProject());
-        // add the test classes to its classpath
-        sel.addClasspath(testclasses);
-        sel.setAlgorithmClass(classname);
-        // let the selector do its checks
-        sel.validate();
-        // extract the algorithm name (and config) from the selectors output
-        String s1 = sel.toString();
-        int posStart = s1.indexOf("algorithm=") + 10;
-        int posEnd   = s1.indexOf(" comparator=");
-        String algo  = s1.substring(posStart, posEnd);
-        // '<' and '>' are only used if the algorithm has properties
-        if (algo.startsWith("<")) algo = algo.substring(1);
-        if (algo.endsWith(">"))   algo = algo.substring(0, algo.length()-1);
-        // return the clean value
-        return algo;
-    }
-
-
-    // ================  testcases for the cache implementations  ================
-
-
-    /**
-     * Propertycache must have a set 'cachefile' attribute.
-     * The default in ModifiedSelector "cache.properties" is set by the selector.
-     */
-    @Test
-    public void testPropcacheInvalid() {
-        Cache cache = new PropertiesfileCache();
-        if (cache.isValid())
-            fail("PropertyfilesCache does not check its configuration.");
-    }
-
-
-    @Test
-    public void testPropertyfileCache() {
-        PropertiesfileCache cache = new PropertiesfileCache();
-        File cachefile = new File("cache.properties");
-        cache.setCachefile(cachefile);
-        doTest(cache);
-        assertFalse("Cache file not deleted.", cachefile.exists());
-    }
-
-
-    /** Checks whether a cache file is created. */
-    @Test
-    public void testCreatePropertiesCacheDirect() {
-        File cachefile = new File(selectorRule.getProject().getBaseDir(), "cachefile.properties");
-
-        PropertiesfileCache cache = new PropertiesfileCache();
-        cache.setCachefile(cachefile);
-
-        cache.put("key", "value");
-        cache.save();
-
-        assertTrue("Cachefile not created.", cachefile.exists());
-
-        cache.delete();
-        assertFalse("Cachefile not deleted.", cachefile.exists());
-    }
-
-
-    /** Checks whether a cache file is created. */
-    @Test
-    public void testCreatePropertiesCacheViaModifiedSelector() {
-        File cachefile = new File(selectorRule.getProject().getBaseDir(), "cachefile.properties");
-    
-        // Configure the selector
-        ModifiedSelector s = new ModifiedSelector();
-        s.setDelayUpdate(false);
-        s.addParam("cache.cachefile", cachefile);
-
-        ModifiedSelector.CacheName cacheName = new ModifiedSelector.CacheName();
-        cacheName.setValue("propertyfile");
-        s.setCache(cacheName);
-
-        s.setUpdate(true);
-
-        selectorRule.selectionString(s);
-
-        // evaluate correctness
-        assertTrue("Cache file is not created.", cachefile.exists());
-        cachefile.delete();
-        
-    }
-
-
-    /**
-     * In earlier implementations there were problems with the <i>order</i>
-     * of the <param>s. The scenario was <pre>
-     *   <custom class="ModifiedSelector">
-     *       <param name="cache.cachefile" value="mycache.properties" />
-     *       <param name="cache" value="propertyfiles" />
-     *   </custom>
-     * </pre> It was important first to set the cache and then to set
-     * the cache's configuration parameters. That results in the reorganized
-     * configure() method of ModifiedSelector. This testcase tests that.
-     */
-    @Test
-    public void testCreatePropertiesCacheViaCustomSelector() {
-        File cachefile = FILE_UTILS.createTempFile("tmp-cache-", ".properties", null, false, false);
-
-        // Configure the selector
-
-        ExtendSelector s = new ExtendSelector();
-        s.setClassname("org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector");
-        s.addParam(createParam("update", "true"));
-        s.addParam(createParam("cache.cachefile", cachefile.getAbsolutePath()));
-        s.addParam(createParam("cache", "propertyfile"));
-
-        selectorRule.selectionString(s);
-
-        // evaluate correctness
-        assertTrue("Cache file is not created.", cachefile.exists());
-        cachefile.delete();
-
-    }
-
-
-    @Test
-    @Ignore("same logic as on algorithm, no testcases created")
-    public void testCustomCache() {
-        // same logic as on algorithm, no testcases created
-    }
-
-
-    /**
-     * Test the interface semantic of Caches.
-     * This method does some common test for cache implementations.
-     * A cache must return a stored value and a valid iterator.
-     * After calling the delete() the cache must be empty.
-     *
-     * @param cache   configured test object
-     */
-    protected void doTest(Cache cache) {
-        assertTrue("Cache not proper configured.", cache.isValid());
-
-        String key1   = "key1";
-        String value1 = "value1";
-        String key2   = "key2";
-        String value2 = "value2";
-
-        // given cache must be empty
-        Iterator it1 = cache.iterator();
-        assertFalse("Cache is not empty", it1.hasNext());
-
-        // cache must return a stored value
-        cache.put(key1, value1);
-        cache.put(key2, value2);
-        assertEquals("cache returned wrong value", value1, cache.get(key1));
-        assertEquals("cache returned wrong value", value2, cache.get(key2));
-
-        // test the iterator
-        Iterator it2 = cache.iterator();
-        Object   returned = it2.next();
-        boolean ok = (key1.equals(returned) || key2.equals(returned));
-        String msg = "Iterator returned unexpected value."
-                   + "  key1.equals(returned)="+key1.equals(returned)
-                   + "  key2.equals(returned)="+key2.equals(returned)
-                   + "  returned="+returned
-                   + "  ok="+ok;
-        assertTrue(msg, ok);
-
-        // clear the cache
-        cache.delete();
-        Iterator it3 = cache.iterator();
-        assertFalse("Cache is not empty", it3.hasNext());
-    }
-
-
-    // ==============  testcases for the algorithm implementations  ==============
-
-
-    @Test
-    public void testHashvalueAlgorithm() {
-        HashvalueAlgorithm algo = new HashvalueAlgorithm();
-        doTest(algo);
-    }
-
-
-    @Test
-    public void testDigestAlgorithmMD5() {
-        DigestAlgorithm algo = new DigestAlgorithm();
-        algo.setAlgorithm("MD5");
-        doTest(algo);
-    }
-
-
-    @Test
-    public void testDigestAlgorithmSHA() {
-        DigestAlgorithm algo = new DigestAlgorithm();
-        algo.setAlgorithm("SHA");
-        doTest(algo);
-    }
-
-
-    @Test
-    public void testChecksumAlgorithm() {
-        ChecksumAlgorithm algo = new ChecksumAlgorithm();
-        doTest(algo);
-    }
-
-
-    @Test
-    public void testChecksumAlgorithmCRC() {
-        ChecksumAlgorithm algo = new ChecksumAlgorithm();
-        algo.setAlgorithm("CRC");
-        doTest(algo);
-    }
-
-
-    @Test
-    public void testChecksumAlgorithmAdler() {
-        ChecksumAlgorithm algo = new ChecksumAlgorithm();
-        algo.setAlgorithm("Adler");
-        doTest(algo);
-    }
-
-
-    /**
-     * Test the interface semantic of Algorithms.
-     * This method does some common test for algorithm implementations.
-     * An algorithm must return always the same value for the same file and
-     * it must not return <i>null</i>.
-     *
-     * @param algo   configured test object
-     */
-    protected void doTest(Algorithm algo) {
-         assertTrue("Algorithm not proper configured.", algo.isValid());
-         for (int i=0; i<selectorRule.getFiles().length; i++) {
-            File file = selectorRule.getFiles()[i];  // must not be a directory
-            if (file.isFile()) {
-                // get the Hashvalues
-                String hash1 = algo.getValue(file);
-                String hash2 = algo.getValue(file);
-                String hash3 = algo.getValue(file);
-                String hash4 = algo.getValue(file);
-                String hash5 = algo.getValue(new File(file.getAbsolutePath()));
-
-                // Assert !=null and equality
-                assertNotNull("Hashvalue was null for "+file.getAbsolutePath(), hash1);
-                assertNotNull("Hashvalue was null for "+file.getAbsolutePath(), hash2);
-                assertNotNull("Hashvalue was null for "+file.getAbsolutePath(), hash3);
-                assertNotNull("Hashvalue was null for "+file.getAbsolutePath(), hash4);
-                assertNotNull("Hashvalue was null for "+file.getAbsolutePath(), hash5);
-                assertEquals("getHashvalue() returned different value for "+file.getAbsolutePath(), hash1, hash2);
-                assertEquals("getHashvalue() returned different value for "+file.getAbsolutePath(), hash1, hash3);
-                assertEquals("getHashvalue() returned different value for "+file.getAbsolutePath(), hash1, hash4);
-                assertEquals("getHashvalue() returned different value for "+file.getAbsolutePath(), hash1, hash5);
-            }//if-isFile
-        }//for
-
-    }
-
-
-
-    // ==============  testcases for the comparator implementations  ==============
-
-
-    @Test
-    public void testEqualComparator() {
-        EqualComparator comp = new EqualComparator();
-        doTest(comp);
-    }
-
-
-    @Test
-    public void testRuleComparator() {
-        RuleBasedCollator comp = (RuleBasedCollator)RuleBasedCollator.getInstance();
-        doTest(comp);
-    }
-
-
-    @Test
-    public void testEqualComparatorViaSelector() {
-        ModifiedSelector s = new ModifiedSelector();
-        ModifiedSelector.ComparatorName compName = new ModifiedSelector.ComparatorName();
-        compName.setValue("equal");
-        s.setComparator(compName);
-        try {
-            performTests(s, "TTTTTTTTTTTT");
-        } finally {
-            s.getCache().delete();
-        }
-    }
-
-
-    @Test
-    @Ignore("not yet supported see note in selector")
-    public void testRuleComparatorViaSelector() {
-        ModifiedSelector s = new ModifiedSelector();
-        ModifiedSelector.ComparatorName compName = new ModifiedSelector.ComparatorName();
-        compName.setValue("rule");
-        s.setComparator(compName);
-        try {
-            performTests(s, "TTTTTTTTTTTT");
-        } finally {
-            s.getCache().delete();
-        }
-    }
-
-
-    @Test
-    @Ignore("same logic as on algorithm, no testcases created")
-    public void testCustomComparator() {
-        // same logic as on algorithm, no testcases created
-    }
-
-
-    @Test
-    public void testResourceSelectorSimple() {
-        BFT bft = new BFT();
-        bft.doTarget("modifiedselectortest-ResourceSimple");
-        bft.deleteCachefile();
-        //new File("src/etc/testcases/types/resources/selectors/cache.properties").delete();
-    }
-
-    @Test
-    public void testResourceSelectorSelresTrue() {
-        BFT bft = new BFT();
-        bft.doTarget("modifiedselectortest-ResourceSelresTrue");
-        AntAssert.assertContains("does not provide an InputStream", bft.getLog());
-        bft.deleteCachefile();
-    }
-
-    @Test
-    public void testResourceSelectorSelresFalse() {
-        BFT bft = new BFT();
-        bft.doTarget("modifiedselectortest-ResourceSelresFalse");
-        bft.deleteCachefile();
-    }
-
-    @Test
-    public void testResourceSelectorScenarioSimple() {
-
-        Assume.assumeNotNull("Ant home not set", selectorRule.getProject().getProperty("ant.home"));
-        BFT bft = new BFT();
-        bft.doTarget("modifiedselectortest-scenario-resourceSimple");
-        bft.doTarget("modifiedselectortest-scenario-clean");
-        bft.deleteCachefile();
-    }
-
-    /**
-     * Test the interface semantic of Comparators.
-     * This method does some common test for comparator implementations.
-     *
-     * @param comp   configured test object
-     */
-    protected void doTest(Comparator comp) {
-        Object o1 = new String("string1");
-        Object o2 = new String("string2");
-        Object o3 = new String("string2"); // really "2"
-
-        assertTrue("Comparator gave wrong value.", comp.compare(o1, o2) != 0);
-        assertTrue("Comparator gave wrong value.", comp.compare(o1, o3) != 0);
-        assertTrue("Comparator gave wrong value.", comp.compare(o2, o3) == 0);
-    }
-
-
-    // =====================  scenario tests  =====================
-
-
-    /**
-     * Tests whether the seldirs attribute is used.
-     */
-    @Test
-    public void testSeldirs() {
-        ModifiedSelector s = new ModifiedSelector();
-        StringBuffer sbTrue  = new StringBuffer();
-        StringBuffer sbFalse = new StringBuffer();
-        for (int i=0; i<selectorRule.getFiles().length; i++) {
-            if (selectorRule.getFiles()[i].isDirectory()) {
-                sbTrue.append("T");
-                sbFalse.append("F");
-            } else {
-                sbTrue.append("T");
-                sbFalse.append("T");
-            }
-        }
-
-        s.setSeldirs(true);
-        performTests(s, sbTrue.toString());
-        s.getCache().delete();
-
-        s.setSeldirs(false);
-        performTests(s, sbFalse.toString());
-        s.getCache().delete();
-
-        s.getCache().delete();
-    }
-
-
-    /**
-     * Complex test scenario using default values (DigestAlgorithm with MD5,
-     * PropertiesfileCache with file=cache.properties, EqualComparator
-     * and update=true). <ol>
-     * <li> try fist time --> should select all </li>
-     * <li> try second time --> should select no files (only directories) </li>
-     * <li> modify timestamp of one file and content of a nother one </li>
-     * <li> try third time --> should select only the file with modified
-     *      content </li>
-     */
-    @Test
-    public void testScenario1() {
-        BFT bft = null;
-        ModifiedSelector s = null;
-        try {
-
-            String results;
-
-            // Configure the selector - only defaults are used
-            s = new ModifiedSelector();
-
-            //
-            // *****  First Run  *****
-            // the first call should get all files, because nothing is in
-            // the cache
-            //
-            performTests(s, "TTTTTTTTTTTT");
-
-            //
-            // *****  Second Run  *****
-            // the second call should get no files, because no content
-            // has changed
-            //
-            performTests(s, "TFFFFFFFFFFT");
-
-            //
-            // *****  make some files dirty  *****
-            //
-
-            // these files are made dirty --> 3+4 with different content
-            String f2name = "tar/bz2/asf-logo-huge.tar.bz2";
-            String f3name = "asf-logo.gif.md5";
-            String f4name = "copy.filterset.filtered";
-
-            // AccessObject to the test-Ant-environment
-            bft = new BFT();
-            // give some values (via property file) to that environment
-            bft.writeProperties("f2name="+f2name);
-            bft.writeProperties("f3name="+f3name);
-            bft.writeProperties("f4name="+f4name);
-            // call the target for making the files dirty
-            bft.doTarget("modifiedselectortest-makeDirty");
-
-            //
-            // *****  Third Run  *****
-            // third call should get only those files, which CONTENT changed
-            // (no timestamp changes required!)
-            results = selectorRule.selectionString(s);
-
-            //
-            // *****  Check the result  *****
-            //
-
-            // Mark all files which should be selected as (T)rue and all others
-            // as (F)alse. Directories are always selected so they always are
-            // (T)rue.
-            StringBuffer expected = new StringBuffer();
-            for (int i=0; i<selectorRule.getFiles().length; i++) {
-                String ch = "F";
-                if (selectorRule.getFiles()[i].isDirectory()) ch = "T";
-                // f2name shouldn't be selected: only timestamp has changed!
-                if (selectorRule.getFilenames()[i].equalsIgnoreCase(f3name)) ch = "T";
-                if (selectorRule.getFilenames()[i].equalsIgnoreCase(f4name)) ch = "T";
-                expected.append(ch);
-            }
-
-            assertEquals(
-                "Wrong files selected. Differing files: "       // info text
-                + resolve(diff(expected.toString(), results)),  // list of files
-                expected.toString(),                            // expected result
-                results                                         // result
-            );
-
-        } finally {
-            // cleanup the environment
-            if (s!=null) s.getCache().delete();
-            if (bft!=null) bft.deletePropertiesfile();
-        }
-    }
-
-
-    /**
-     * This scenario is based on scenario 1, but does not use any
-     * default value and its based on <custom> selector. Used values are:<ul>
-     * <li><b>Cache: </b> Propertyfile,
-     *                    cachefile={java.io.tmpdir}/mycache.txt </li>
-     * <li><b>Algorithm: </b> Digest
-     *                    algorithm=SHA, Provider=null </li>
-     * <li><b>Comparator: </b> java.text.RuleBasedCollator
-     * <li><b>Update: </b> true </li>
-     */
-    @Test
-    @Ignore("RuleBasedCollator not yet supported - see Selector:375 note")
-    public void testScenario2() {
-        ExtendSelector s = new ExtendSelector();
-        BFT bft = new BFT();
-        String cachefile = System.getProperty("java.io.tmpdir")+"/mycache.txt";
-        try {
-
-            s.setClassname("org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector");
-
-            s.addParam(createParam("cache.cachefile", cachefile));
-            //s.addParam(createParam("algorithm.provider","---")); // i don't know any valid
-            s.addParam(createParam("cache","propertyfile"));
-            s.addParam(createParam("update","true"));
-            s.addParam(createParam("comparator","rule"));
-            s.addParam(createParam("algorithm.name","sha"));
-            s.addParam(createParam("algorithm","digest"));
-
-            // first and second run
-            performTests(s, "TTTTTTTTTTTT");
-            performTests(s, "TFFFFFFFFFFT");
-            // make dirty
-            String f2name = "tar/bz2/asf-logo-huge.tar.bz2";
-            String f3name = "asf-logo.gif.md5";
-            String f4name = "copy.filterset.filtered";
-            bft.writeProperties("f2name="+f2name);
-            bft.writeProperties("f3name="+f3name);
-            bft.writeProperties("f4name="+f4name);
-            bft.doTarget("modifiedselectortest-makeDirty");
-            // third run
-            String results = selectorRule.selectionString(s);
-            StringBuffer expected = new StringBuffer();
-            for (int i=0; i<selectorRule.getFilenames().length; i++) {
-                String ch = "F";
-                if (selectorRule.getFiles()[i].isDirectory()) ch = "T";
-                if (selectorRule.getFilenames()[i].equalsIgnoreCase(f3name)) ch = "T";
-                if (selectorRule.getFilenames()[i].equalsIgnoreCase(f4name)) ch = "T";
-                expected.append(ch);
-            }
-            assertEquals(
-                "Wrong files selected. Differing files: "       // info text
-                + resolve(diff(expected.toString(), results)),  // list of files
-                expected.toString(),                            // expected result
-                results                                         // result
-            );
-        } finally {
-            // cleanup the environment
-            (new java.io.File(cachefile)).delete();
-            bft.deletePropertiesfile();
-        }
-    }
-
-
-    @Test
-    public void testScenarioCoreSelectorDefaults() {
-        Assume.assumeNotNull("Ant home not set", selectorRule.getProject().getProperty("ant.home") );
-        doScenarioTest("modifiedselectortest-scenario-coreselector-defaults", "cache.properties");
-    }
-
-
-    @Test
-    public void testScenarioCoreSelectorSettings() {
-        Assume.assumeNotNull("Ant home not set", selectorRule.getProject().getProperty("ant.home") );
-        doScenarioTest("modifiedselectortest-scenario-coreselector-settings", "core.cache.properties");
-    }
-
-
-    @Test
-    public void testScenarioCustomSelectorSettings() {
-        Assume.assumeNotNull("Ant home not set", selectorRule.getProject().getProperty("ant.home") );
-        doScenarioTest("modifiedselectortest-scenario-customselector-settings", "core.cache.properties");
-    }
-
-
-    public void doScenarioTest(String target, String cachefilename) {
-        BFT bft = new BFT();
-        bft.setUp();
-        File cachefile = new File(selectorRule.getProject().getBaseDir(), cachefilename);
-        try {
-            // do the actions
-            bft.doTarget("modifiedselectortest-scenario-clean");
-            bft.doTarget(target);
-
-            // the directories to check
-            File to1 = new File(selectorRule.getOutputDir(), "selectortest/to-1");
-            File to2 = new File(selectorRule.getOutputDir(), "selectortest/to-2");
-            File to3 = new File(selectorRule.getOutputDir(), "selectortest/to-3");
-
-            // do the checks
-            assertTrue("Cache file not created.", cachefile.exists());
-            assertTrue("Not enough files copied on first time.", to1.list().length>5);
-            assertTrue("Too much files copied on second time.", to2.list().length==0);
-            assertTrue("Too much files copied on third time.", to3.list().length==2);
-        // don't catch the JUnit exceptions
-        } finally {
-            bft.doTarget("modifiedselectortest-scenario-clean");
-            bft.deletePropertiesfile();
-            bft.tearDown();
-            cachefile.delete();
-        }
-    }
-
-
-    //  =====================  helper methods and classes  ====================
-
-
-    /**
-     * Creates a configured parameter object.
-     * @param name   name of the parameter
-     * @param value  value of the parameter
-     * @return the parameter object
-     */
-    private Parameter createParam(String name, String value) {
-        Parameter p = new Parameter();
-        p.setName(name);
-        p.setValue(value);
-        return p;
-    }
-
-
-    /**
-     * The BFT class wrapps the selector test-builfile inside an
-     * ant project. It supports target execution
-     * and property transfer to that project.
-     */
-    private class BFT extends BuildFileRule {
-        String buildfile = "src/etc/testcases/types/selectors.xml";
-
-        String propfile = "ModifiedSelectorTest.properties";
-
-        boolean isConfigured = false;
-
-
-        public void setUp() {
-            super.configureProject(buildfile);
-            isConfigured = true;
-        }
-
-
-        /**
-         * This stub teardown is here because the outer class needs to call the
-         * tearDown method, and in the superclass it is protected.
-         */
-        public void tearDown() {
-            super.after();
-
-        }
-
-        public void doTarget(String target) {
-            if (!isConfigured) setUp();
-            executeTarget(target);
-        }
-
-        public String getProperty(String property) {
-            return super.getProject().getProperty(property);
-        }
-
-        public void writeProperties(String line) {
-            if (!isConfigured) setUp();
-            File dir = getProject().getBaseDir();
-            File file = new File(dir, propfile);
-            try {
-                java.io.FileWriter out =
-                    new java.io.FileWriter(file.getAbsolutePath(), true);
-                out.write(line);
-                out.write(System.getProperty("line.separator"));
-                out.flush();
-                out.close();
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        }
-
-        public void deletePropertiesfile() {
-            if (!isConfigured) setUp();
-            new File(getProject().getBaseDir(), propfile).delete();
-        }
-
-        public void deleteCachefile() {
-            File basedir = new File(buildfile).getParentFile();
-            File cacheFile = new File(basedir, "cache.properties");
-            cacheFile.delete();
-        }
-
-    }//class-BFT
-
-
-    /**
-     * MockProject wrappes a very small ant project (one target, one task)
-     * but provides public methods to fire the build events.
-     */
-    private class MockProject extends Project {
-        private Task   task;
-        private Target target;
-
-        public MockProject() {
-            task = new Task(){
-                public void execute() {
-                }
-            };
-            task.setTaskName("testTask");
-            target = new Target();
-            target.setName("testTarget");
-            target.setProject(this);
-            target.addTask(task);
-            task.setOwningTarget(target);
-        }
-
-        public void fireBuildFinished() {
-            super.fireBuildFinished(null);
-        }
-        public void fireSubBuildFinished() {
-            super.fireSubBuildFinished(null);
-        }
-        public void fireTargetStarted() {
-            super.fireTargetStarted(target);
-        }
-        public void fireTargetFinished() {
-            super.fireTargetFinished(target, null);
-        }
-        public void fireTaskStarted() {
-            super.fireTaskStarted(task);
-        }
-        public void fireTaskFinished() {
-            super.fireTaskFinished(task, null);
-        }
-    }//class-MockProject
-
-
-    /**
-     * Does the selection test for a given selector and prints the
-     * filenames of the differing files (selected but shouldn't,
-     * not selected but should).
-     * @param selector  The selector to test
-     * @param expected  The expected result
-     */
-    private void performTests(FileSelector selector, String expected) {
-        String result = selectorRule.selectionString(selector);
-        String diff = diff(expected, result);
-        String resolved = resolve(diff);
-        assertEquals("Differing files: " + resolved, result, expected);
-    }
-    /**
-     *  Checks which files are selected and shouldn't be or which
-     *  are not selected but should.
-     *  @param expected    String containing 'F's and 'T's
-     *  @param result      String containing 'F's and 'T's
-     *  @return Difference as String containing '-' (equal) and
-     *          'X' (difference).
-     */
-    private String diff(String expected, String result) {
-        int length1 = expected.length();
-        int length2 = result.length();
-        int min = (length1 > length2) ? length2 : length1;
-        StringBuffer sb = new StringBuffer();
-        for (int i=0; i<min; i++) {
-            sb.append(
-                    (expected.charAt(i) == result.charAt(i))
-                            ? "-"
-                            : "X"
-            );
-        }
-        return sb.toString();
-    }
-
-    /**
-     * Resolves a diff-String (@see diff()) against the (inherited) filenames-
-     * and files arrays.
-     * @param filelist    Diff-String
-     * @return String containing the filenames for all differing files,
-     *         separated with semicolons ';'
-     */
-    private String resolve(String filelist) {
-        StringBuffer sb = new StringBuffer();
-        int min = (selectorRule.getFilenames().length > filelist.length())
-                ? filelist.length()
-                : selectorRule.getFilenames().length;
-        for (int i=0; i<min; i++) {
-            if ('X'==filelist.charAt(i)) {
-                sb.append(selectorRule.getFilenames()[i]);
-                sb.append(";");
-            }
-        }
-        return sb.toString();
-    }
-
-
-}//class-ModifiedSelectorTest
+/*
+ *  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.types.selectors;
+
+
+// Java
+import java.io.File;
+import java.text.RuleBasedCollator;
+import java.util.Comparator;
+import java.util.Iterator;
+
+import org.apache.tools.ant.AntAssert;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileRule;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Target;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.Parameter;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.selectors.modifiedselector.Algorithm;
+import org.apache.tools.ant.types.selectors.modifiedselector.Cache;
+import org.apache.tools.ant.types.selectors.modifiedselector.ChecksumAlgorithm;
+import org.apache.tools.ant.types.selectors.modifiedselector.DigestAlgorithm;
+import org.apache.tools.ant.types.selectors.modifiedselector.EqualComparator;
+import org.apache.tools.ant.types.selectors.modifiedselector.HashvalueAlgorithm;
+import org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector;
+import org.apache.tools.ant.types.selectors.modifiedselector.PropertiesfileCache;
+import org.apache.tools.ant.util.FileUtils;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+
+/**
+ * Unit tests for ModifiedSelector.
+ *
+ * @since  Ant 1.6
+ */
+public class ModifiedSelectorTest {
+    
+    @Rule
+    public final BaseSelectorRule selectorRule = new BaseSelectorRule();
+
+    /** Utilities used for file operations */
+    private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
+
+    //  =====================  attributes  =====================
+
+
+    /** Path where the testclasses are. */
+    private Path testclasses = null;
+
+
+
+
+    //  =====================  JUnit stuff  =====================
+
+
+    @Before
+    public void setUp() {
+        // init the testclasses path object
+        Project prj = selectorRule.getProject();
+        testclasses = new Path(prj, prj.getProperty("build.tests.value"));
+    }
+
+
+    // =======  testcases for the attributes and nested elements of the selector  =====
+
+
+    /** Test right use of cache names. */
+    @Test
+    public void testValidateWrongCache() {
+        String name = "this-is-not-a-valid-cache-name";
+        try {
+            ModifiedSelector.CacheName cacheName = new ModifiedSelector.CacheName();
+            cacheName.setValue(name);
+            fail("CacheSelector.CacheName accepted invalid value.");
+        } catch (BuildException be) {
+            assertEquals(name + " is not a legal value for this attribute",
+                         be.getMessage());
+        }
+    }
+
+
+    /** Test right use of cache names. */
+    @Test
+    public void testValidateWrongAlgorithm() {
+        String name = "this-is-not-a-valid-algorithm-name";
+        try {
+            ModifiedSelector.AlgorithmName algoName
+                = new ModifiedSelector.AlgorithmName();
+            algoName.setValue(name);
+            fail("CacheSelector.AlgorithmName accepted invalid value.");
+        } catch (BuildException be) {
+            assertEquals(name + " is not a legal value for this attribute",
+                         be.getMessage());
+        }
+    }
+
+
+    /** Test right use of comparator names. */
+    @Test
+    public void testValidateWrongComparator() {
+        String name = "this-is-not-a-valid-comparator-name";
+        try {
+            ModifiedSelector.ComparatorName compName
+                = new ModifiedSelector.ComparatorName();
+            compName.setValue(name);
+            fail("ModifiedSelector.ComparatorName accepted invalid value.");
+        } catch (BuildException be) {
+            assertEquals(name + " is not a legal value for this attribute",
+                         be.getMessage());
+        }
+    }
+
+
+    @Test
+    public void testIllegalCustomAlgorithm() {
+        try {
+            getAlgoName("java.lang.Object");
+            fail("Illegal classname used.");
+        } catch (BuildException e) {
+            assertEquals("Wrong exception message.",
+                         "Specified class (java.lang.Object) is not an Algorithm.",
+                         e.getMessage());
+
+        }
+    }
+
+
+    @Test
+    public void testNonExistentCustomAlgorithm() {
+         try {
+            getAlgoName("non.existent.custom.Algorithm");
+            fail("does 'non.existent.custom.Algorithm' really exist?");
+        } catch (BuildException e) {
+            assertEquals("Wrong exception message.",
+                         "Specified class (non.existent.custom.Algorithm) not found.",
+                         e.getMessage());
+
+        }
+    }
+
+    @Test
+    public void testCustomAlgorithm() {
+        String algo = getAlgoName("org.apache.tools.ant.types.selectors.modifiedselector.HashvalueAlgorithm");
+        assertTrue("Wrong algorithm used: "+algo, algo.startsWith("HashvalueAlgorithm"));
+    }
+
+    @Test
+    public void testCustomAlgorithm2() {
+        String algo = getAlgoName("org.apache.tools.ant.types.selectors.MockAlgorithm");
+        assertTrue("Wrong algorithm used: "+algo, algo.startsWith("MockAlgorithm"));
+    }
+
+
+    @Test
+    public void testCustomClasses() {
+        Assume.assumeNotNull("Ant home not set", selectorRule.getProject().getProperty("ant.home") );
+        BFT bft = new BFT();
+        bft.setUp();
+        try {
+            // do the actions
+            bft.doTarget("modifiedselectortest-customClasses");
+            // do the checks - the buildfile stores the fileset as property
+            String fsFullValue = bft.getProperty("fs.full.value");
+            String fsModValue  = bft.getProperty("fs.mod.value");
+
+            assertNotNull("'fs.full.value' must be set.", fsFullValue);
+            assertTrue("'fs.full.value' must not be null.", !"".equals(fsFullValue));
+            assertTrue("'fs.full.value' must contain ant.bat.", fsFullValue.indexOf("ant.bat")>-1);
+
+            assertNotNull("'fs.mod.value' must be set.", fsModValue);
+            // must be empty according to the Mock* implementations
+            assertTrue("'fs.mod.value' must be empty.", "".equals(fsModValue));
+        // don't catch the JUnit exceptions
+        } finally {
+            bft.doTarget("modifiedselectortest-scenario-clean");
+            bft.deletePropertiesfile();
+            bft.tearDown();
+        }
+    }
+
+
+    @Test
+    public void testDelayUpdateTaskFinished() {
+        doDelayUpdateTest(1);
+    }
+
+
+    @Test
+    public void testDelayUpdateTargetFinished() {
+        doDelayUpdateTest(2);
+    }
+
+
+    @Test
+    public void testDelayUpdateBuildFinished() {
+        doDelayUpdateTest(3);
+    }
+
+
+    public void doDelayUpdateTest(int kind) {
+        // no check for 1<=kind<=3 - only internal use therefore check it
+        // while development
+
+        // readable form of parameter kind
+        String[] kinds = {"task", "target", "build"};
+
+        // setup the "Ant project"
+        MockProject project = new MockProject();
+        File base  = new File("base");
+        File file1 = new File("file1");
+        File file2 = new File("file2");
+
+        // setup the selector
+        ModifiedSelector sel = new ModifiedSelector();
+        sel.setProject(project);
+        sel.setUpdate(true);
+        sel.setDelayUpdate(true);
+        // sorry - otherwise we will get a ClassCastException because the MockCache
+        // is loaded by two different classloader ...
+        sel.setClassLoader(this.getClass().getClassLoader());
+        sel.addClasspath(testclasses);
+
+        sel.setAlgorithmClass("org.apache.tools.ant.types.selectors.MockAlgorithm");
+        sel.setCacheClass("org.apache.tools.ant.types.selectors.MockCache");
+        sel.configure();
+
+        // get the cache, so we can check our things
+        MockCache cache = (MockCache)sel.getCache();
+
+        // the test
+        assertFalse("Cache must not be saved before 1st selection.", cache.saved);
+        sel.isSelected(base, "file1", file1);
+        assertFalse("Cache must not be saved after 1st selection.", cache.saved);
+        sel.isSelected(base, "file2", file2);
+        assertFalse("Cache must not be saved after 2nd selection.", cache.saved);
+        switch (kind) {
+            case 1 : project.fireTaskFinished();   break;
+            case 2 : project.fireTargetFinished(); break;
+            case 3 : project.fireBuildFinished();  break;
+        }
+        assertTrue("Cache must be saved after " + kinds[kind-1] + "Finished-Event.", cache.saved);
+
+        // MockCache doesnt create a file - therefore no cleanup needed
+    }
+
+
+    /**
+     * Extracts the real used algorithm name from the ModifiedSelector using
+     * its toString() method.
+     * @param classname  the classname from the algorithm to use
+     * @return  the algorithm part from the toString() (without brackets)
+     */
+    private String getAlgoName(String classname) {
+        ModifiedSelector sel = new ModifiedSelector();
+        sel.setProject(selectorRule.getProject());
+        // add the test classes to its classpath
+        sel.addClasspath(testclasses);
+        sel.setAlgorithmClass(classname);
+        // let the selector do its checks
+        sel.validate();
+        // extract the algorithm name (and config) from the selectors output
+        String s1 = sel.toString();
+        int posStart = s1.indexOf("algorithm=") + 10;
+        int posEnd   = s1.indexOf(" comparator=");
+        String algo  = s1.substring(posStart, posEnd);
+        // '<' and '>' are only used if the algorithm has properties
+        if (algo.startsWith("<")) algo = algo.substring(1);
+        if (algo.endsWith(">"))   algo = algo.substring(0, algo.length()-1);
+        // return the clean value
+        return algo;
+    }
+
+
+    // ================  testcases for the cache implementations  ================
+
+
+    /**
+     * Propertycache must have a set 'cachefile' attribute.
+     * The default in ModifiedSelector "cache.properties" is set by the selector.
+     */
+    @Test
+    public void testPropcacheInvalid() {
+        Cache cache = new PropertiesfileCache();
+        if (cache.isValid())
+            fail("PropertyfilesCache does not check its configuration.");
+    }
+
+
+    @Test
+    public void testPropertyfileCache() {
+        PropertiesfileCache cache = new PropertiesfileCache();
+        File cachefile = new File("cache.properties");
+        cache.setCachefile(cachefile);
+        doTest(cache);
+        assertFalse("Cache file not deleted.", cachefile.exists());
+    }
+
+
+    /** Checks whether a cache file is created. */
+    @Test
+    public void testCreatePropertiesCacheDirect() {
+        File cachefile = new File(selectorRule.getProject().getBaseDir(), "cachefile.properties");
+
+        PropertiesfileCache cache = new PropertiesfileCache();
+        cache.setCachefile(cachefile);
+
+        cache.put("key", "value");
+        cache.save();
+
+        assertTrue("Cachefile not created.", cachefile.exists());
+
+        cache.delete();
+        assertFalse("Cachefile not deleted.", cachefile.exists());
+    }
+
+
+    /** Checks whether a cache file is created. */
+    @Test
+    public void testCreatePropertiesCacheViaModifiedSelector() {
+        File cachefile = new File(selectorRule.getProject().getBaseDir(), "cachefile.properties");
+    
+        // Configure the selector
+        ModifiedSelector s = new ModifiedSelector();
+        s.setDelayUpdate(false);
+        s.addParam("cache.cachefile", cachefile);
+
+        ModifiedSelector.CacheName cacheName = new ModifiedSelector.CacheName();
+        cacheName.setValue("propertyfile");
+        s.setCache(cacheName);
+
+        s.setUpdate(true);
+
+        selectorRule.selectionString(s);
+
+        // evaluate correctness
+        assertTrue("Cache file is not created.", cachefile.exists());
+        cachefile.delete();
+        
+    }
+
+
+    /**
+     * In earlier implementations there were problems with the <i>order</i>
+     * of the <param>s. The scenario was <pre>
+     *   <custom class="ModifiedSelector">
+     *       <param name="cache.cachefile" value="mycache.properties" />
+     *       <param name="cache" value="propertyfiles" />
+     *   </custom>
+     * </pre> It was important first to set the cache and then to set
+     * the cache's configuration parameters. That results in the reorganized
+     * configure() method of ModifiedSelector. This testcase tests that.
+     */
+    @Test
+    public void testCreatePropertiesCacheViaCustomSelector() {
+        File cachefile = FILE_UTILS.createTempFile("tmp-cache-", ".properties", null, false, false);
+
+        // Configure the selector
+
+        ExtendSelector s = new ExtendSelector();
+        s.setClassname("org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector");
+        s.addParam(createParam("update", "true"));
+        s.addParam(createParam("cache.cachefile", cachefile.getAbsolutePath()));
+        s.addParam(createParam("cache", "propertyfile"));
+
+        selectorRule.selectionString(s);
+
+        // evaluate correctness
+        assertTrue("Cache file is not created.", cachefile.exists());
+        cachefile.delete();
+
+    }
+
+
+    @Test
+    @Ignore("same logic as on algorithm, no testcases created")
+    public void testCustomCache() {
+        // same logic as on algorithm, no testcases created
+    }
+
+
+    /**
+     * Test the interface semantic of Caches.
+     * This method does some common test for cache implementations.
+     * A cache must return a stored value and a valid iterator.
+     * After calling the delete() the cache must be empty.
+     *
+     * @param cache   configured test object
+     */
+    protected void doTest(Cache cache) {
+        assertTrue("Cache not proper configured.", cache.isValid());
+
+        String key1   = "key1";
+        String value1 = "value1";
+        String key2   = "key2";
+        String value2 = "value2";
+
+        // given cache must be empty
+        Iterator it1 = cache.iterator();
+        assertFalse("Cache is not empty", it1.hasNext());
+
+        // cache must return a stored value
+        cache.put(key1, value1);
+        cache.put(key2, value2);
+        assertEquals("cache returned wrong value", value1, cache.get(key1));
+        assertEquals("cache returned wrong value", value2, cache.get(key2));
+
+        // test the iterator
+        Iterator it2 = cache.iterator();
+        Object   returned = it2.next();
+        boolean ok = (key1.equals(returned) || key2.equals(returned));
+        String msg = "Iterator returned unexpected value."
+                   + "  key1.equals(returned)="+key1.equals(returned)
+                   + "  key2.equals(returned)="+key2.equals(returned)
+                   + "  returned="+returned
+                   + "  ok="+ok;
+        assertTrue(msg, ok);
+
+        // clear the cache
+        cache.delete();
+        Iterator it3 = cache.iterator();
+        assertFalse("Cache is not empty", it3.hasNext());
+    }
+
+
+    // ==============  testcases for the algorithm implementations  ==============
+
+
+    @Test
+    public void testHashvalueAlgorithm() {
+        HashvalueAlgorithm algo = new HashvalueAlgorithm();
+        doTest(algo);
+    }
+
+
+    @Test
+    public void testDigestAlgorithmMD5() {
+        DigestAlgorithm algo = new DigestAlgorithm();
+        algo.setAlgorithm("MD5");
+        doTest(algo);
+    }
+
+
+    @Test
+    public void testDigestAlgorithmSHA() {
+        DigestAlgorithm algo = new DigestAlgorithm();
+        algo.setAlgorithm("SHA");
+        doTest(algo);
+    }
+
+
+    @Test
+    public void testChecksumAlgorithm() {
+        ChecksumAlgorithm algo = new ChecksumAlgorithm();
+        doTest(algo);
+    }
+
+
+    @Test
+    public void testChecksumAlgorithmCRC() {
+        ChecksumAlgorithm algo = new ChecksumAlgorithm();
+        algo.setAlgorithm("CRC");
+        doTest(algo);
+    }
+
+
+    @Test
+    public void testChecksumAlgorithmAdler() {
+        ChecksumAlgorithm algo = new ChecksumAlgorithm();
+        algo.setAlgorithm("Adler");
+        doTest(algo);
+    }
+
+
+    /**
+     * Test the interface semantic of Algorithms.
+     * This method does some common test for algorithm implementations.
+     * An algorithm must return always the same value for the same file and
+     * it must not return <i>null</i>.
+     *
+     * @param algo   configured test object
+     */
+    protected void doTest(Algorithm algo) {
+         assertTrue("Algorithm not proper configured.", algo.isValid());
+         for (int i=0; i<selectorRule.getFiles().length; i++) {
+            File file = selectorRule.getFiles()[i];  // must not be a directory
+            if (file.isFile()) {
+                // get the Hashvalues
+                String hash1 = algo.getValue(file);
+                String hash2 = algo.getValue(file);
+                String hash3 = algo.getValue(file);
+                String hash4 = algo.getValue(file);
+                String hash5 = algo.getValue(new File(file.getAbsolutePath()));
+
+                // Assert !=null and equality
+                assertNotNull("Hashvalue was null for "+file.getAbsolutePath(), hash1);
+                assertNotNull("Hashvalue was null for "+file.getAbsolutePath(), hash2);
+                assertNotNull("Hashvalue was null for "+file.getAbsolutePath(), hash3);
+                assertNotNull("Hashvalue was null for "+file.getAbsolutePath(), hash4);
+                assertNotNull("Hashvalue was null for "+file.getAbsolutePath(), hash5);
+                assertEquals("getHashvalue() returned different value for "+file.getAbsolutePath(), hash1, hash2);
+                assertEquals("getHashvalue() returned different value for "+file.getAbsolutePath(), hash1, hash3);
+                assertEquals("getHashvalue() returned different value for "+file.getAbsolutePath(), hash1, hash4);
+                assertEquals("getHashvalue() returned different value for "+file.getAbsolutePath(), hash1, hash5);
+            }//if-isFile
+        }//for
+
+    }
+
+
+
+    // ==============  testcases for the comparator implementations  ==============
+
+
+    @Test
+    public void testEqualComparator() {
+        EqualComparator comp = new EqualComparator();
+        doTest(comp);
+    }
+
+
+    @Test
+    public void testRuleComparator() {
+        RuleBasedCollator comp = (RuleBasedCollator)RuleBasedCollator.getInstance();
+        doTest(comp);
+    }
+
+
+    @Test
+    public void testEqualComparatorViaSelector() {
+        ModifiedSelector s = new ModifiedSelector();
+        ModifiedSelector.ComparatorName compName = new ModifiedSelector.ComparatorName();
+        compName.setValue("equal");
+        s.setComparator(compName);
+        try {
+            performTests(s, "TTTTTTTTTTTT");
+        } finally {
+            s.getCache().delete();
+        }
+    }
+
+
+    @Test
+    @Ignore("not yet supported see note in selector")
+    public void testRuleComparatorViaSelector() {
+        ModifiedSelector s = new ModifiedSelector();
+        ModifiedSelector.ComparatorName compName = new ModifiedSelector.ComparatorName();
+        compName.setValue("rule");
+        s.setComparator(compName);
+        try {
+            performTests(s, "TTTTTTTTTTTT");
+        } finally {
+            s.getCache().delete();
+        }
+    }
+
+
+    @Test
+    @Ignore("same logic as on algorithm, no testcases created")
+    public void testCustomComparator() {
+        // same logic as on algorithm, no testcases created
+    }
+
+
+    @Test
+    public void testResourceSelectorSimple() {
+        BFT bft = new BFT();
+        bft.doTarget("modifiedselectortest-ResourceSimple");
+        bft.deleteCachefile();
+        //new File("src/etc/testcases/types/resources/selectors/cache.properties").delete();
+    }
+
+    @Test
+    public void testResourceSelectorSelresTrue() {
+        BFT bft = new BFT();
+        bft.doTarget("modifiedselectortest-ResourceSelresTrue");
+        AntAssert.assertContains("does not provide an InputStream", bft.getLog());
+        bft.deleteCachefile();
+    }
+
+    @Test
+    public void testResourceSelectorSelresFalse() {
+        BFT bft = new BFT();
+        bft.doTarget("modifiedselectortest-ResourceSelresFalse");
+        bft.deleteCachefile();
+    }
+
+    @Test
+    public void testResourceSelectorScenarioSimple() {
+
+        Assume.assumeNotNull("Ant home not set", selectorRule.getProject().getProperty("ant.home"));
+        BFT bft = new BFT();
+        bft.doTarget("modifiedselectortest-scenario-resourceSimple");
+        bft.doTarget("modifiedselectortest-scenario-clean");
+        bft.deleteCachefile();
+    }
+
+    /**
+     * Test the interface semantic of Comparators.
+     * This method does some common test for comparator implementations.
+     *
+     * @param comp   configured test object
+     */
+    protected void doTest(Comparator comp) {
+        Object o1 = new String("string1");
+        Object o2 = new String("string2");
+        Object o3 = new String("string2"); // really "2"
+
+        assertTrue("Comparator gave wrong value.", comp.compare(o1, o2) != 0);
+        assertTrue("Comparator gave wrong value.", comp.compare(o1, o3) != 0);
+        assertTrue("Comparator gave wrong value.", comp.compare(o2, o3) == 0);
+    }
+
+
+    // =====================  scenario tests  =====================
+
+
+    /**
+     * Tests whether the seldirs attribute is used.
+     */
+    @Test
+    public void testSeldirs() {
+        ModifiedSelector s = new ModifiedSelector();
+        StringBuffer sbTrue  = new StringBuffer();
+        StringBuffer sbFalse = new StringBuffer();
+        for (int i=0; i<selectorRule.getFiles().length; i++) {
+            if (selectorRule.getFiles()[i].isDirectory()) {
+                sbTrue.append("T");
+                sbFalse.append("F");
+            } else {
+                sbTrue.append("T");
+                sbFalse.append("T");
+            }
+        }
+
+        s.setSeldirs(true);
+        performTests(s, sbTrue.toString());
+        s.getCache().delete();
+
+        s.setSeldirs(false);
+        performTests(s, sbFalse.toString());
+        s.getCache().delete();
+
+        s.getCache().delete();
+    }
+
+
+    /**
+     * Complex test scenario using default values (DigestAlgorithm with MD5,
+     * PropertiesfileCache with file=cache.properties, EqualComparator
+     * and update=true). <ol>
+     * <li> try fist time --> should select all </li>
+     * <li> try second time --> should select no files (only directories) </li>
+     * <li> modify timestamp of one file and content of a nother one </li>
+     * <li> try third time --> should select only the file with modified
+     *      content </li>
+     */
+    @Test
+    public void testScenario1() {
+        BFT bft = null;
+        ModifiedSelector s = null;
+        try {
+
+            String results;
+
+            // Configure the selector - only defaults are used
+            s = new ModifiedSelector();
+
+            //
+            // *****  First Run  *****
+            // the first call should get all files, because nothing is in
+            // the cache
+            //
+            performTests(s, "TTTTTTTTTTTT");
+
+            //
+            // *****  Second Run  *****
+            // the second call should get no files, because no content
+            // has changed
+            //
+            performTests(s, "TFFFFFFFFFFT");
+
+            //
+            // *****  make some files dirty  *****
+            //
+
+            // these files are made dirty --> 3+4 with different content
+            String f2name = "tar/bz2/asf-logo-huge.tar.bz2";
+            String f3name = "asf-logo.gif.md5";
+            String f4name = "copy.filterset.filtered";
+
+            // AccessObject to the test-Ant-environment
+            bft = new BFT();
+            // give some values (via property file) to that environment
+            bft.writeProperties("f2name="+f2name);
+            bft.writeProperties("f3name="+f3name);
+            bft.writeProperties("f4name="+f4name);
+            // call the target for making the files dirty
+            bft.doTarget("modifiedselectortest-makeDirty");
+
+            //
+            // *****  Third Run  *****
+            // third call should get only those files, which CONTENT changed
+            // (no timestamp changes required!)
+            results = selectorRule.selectionString(s);
+
+            //
+            // *****  Check the result  *****
+            //
+
+            // Mark all files which should be selected as (T)rue and all others
+            // as (F)alse. Directories are always selected so they always are
+            // (T)rue.
+            StringBuffer expected = new StringBuffer();
+            for (int i=0; i<selectorRule.getFiles().length; i++) {
+                String ch = "F";
+                if (selectorRule.getFiles()[i].isDirectory()) ch = "T";
+                // f2name shouldn't be selected: only timestamp has changed!
+                if (selectorRule.getFilenames()[i].equalsIgnoreCase(f3name)) ch = "T";
+                if (selectorRule.getFilenames()[i].equalsIgnoreCase(f4name)) ch = "T";
+                expected.append(ch);
+            }
+
+            assertEquals(
+                "Wrong files selected. Differing files: "       // info text
+                + resolve(diff(expected.toString(), results)),  // list of files
+                expected.toString(),                            // expected result
+                results                                         // result
+            );
+
+        } finally {
+            // cleanup the environment
+            if (s!=null) s.getCache().delete();
+            if (bft!=null) bft.deletePropertiesfile();
+        }
+    }
+
+
+    /**
+     * This scenario is based on scenario 1, but does not use any
+     * default value and its based on <custom> selector. Used values are:<ul>
+     * <li><b>Cache: </b> Propertyfile,
+     *                    cachefile={java.io.tmpdir}/mycache.txt </li>
+     * <li><b>Algorithm: </b> Digest
+     *                    algorithm=SHA, Provider=null </li>
+     * <li><b>Comparator: </b> java.text.RuleBasedCollator
+     * <li><b>Update: </b> true </li>
+     */
+    @Test
+    @Ignore("RuleBasedCollator not yet supported - see Selector:375 note")
+    public void testScenario2() {
+        ExtendSelector s = new ExtendSelector();
+        BFT bft = new BFT();
+        String cachefile = System.getProperty("java.io.tmpdir")+"/mycache.txt";
+        try {
+
+            s.setClassname("org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector");
+
+            s.addParam(createParam("cache.cachefile", cachefile));
+            //s.addParam(createParam("algorithm.provider","---")); // i don't know any valid
+            s.addParam(createParam("cache","propertyfile"));
+            s.addParam(createParam("update","true"));
+            s.addParam(createParam("comparator","rule"));
+            s.addParam(createParam("algorithm.name","sha"));
+            s.addParam(createParam("algorithm","digest"));
+
+            // first and second run
+            performTests(s, "TTTTTTTTTTTT");
+            performTests(s, "TFFFFFFFFFFT");
+            // make dirty
+            String f2name = "tar/bz2/asf-logo-huge.tar.bz2";
+            String f3name = "asf-logo.gif.md5";
+            String f4name = "copy.filterset.filtered";
+            bft.writeProperties("f2name="+f2name);
+            bft.writeProperties("f3name="+f3name);
+            bft.writeProperties("f4name="+f4name);
+            bft.doTarget("modifiedselectortest-makeDirty");
+            // third run
+            String results = selectorRule.selectionString(s);
+            StringBuffer expected = new StringBuffer();
+            for (int i=0; i<selectorRule.getFilenames().length; i++) {
+                String ch = "F";
+                if (selectorRule.getFiles()[i].isDirectory()) ch = "T";
+                if (selectorRule.getFilenames()[i].equalsIgnoreCase(f3name)) ch = "T";
+                if (selectorRule.getFilenames()[i].equalsIgnoreCase(f4name)) ch = "T";
+                expected.append(ch);
+            }
+            assertEquals(
+                "Wrong files selected. Differing files: "       // info text
+                + resolve(diff(expected.toString(), results)),  // list of files
+                expected.toString(),                            // expected result
+                results                                         // result
+            );
+        } finally {
+            // cleanup the environment
+            (new java.io.File(cachefile)).delete();
+            bft.deletePropertiesfile();
+        }
+    }
+
+
+    @Test
+    public void testScenarioCoreSelectorDefaults() {
+        Assume.assumeNotNull("Ant home not set", selectorRule.getProject().getProperty("ant.home") );
+        doScenarioTest("modifiedselectortest-scenario-coreselector-defaults", "cache.properties");
+    }
+
+
+    @Test
+    public void testScenarioCoreSelectorSettings() {
+        Assume.assumeNotNull("Ant home not set", selectorRule.getProject().getProperty("ant.home") );
+        doScenarioTest("modifiedselectortest-scenario-coreselector-settings", "core.cache.properties");
+    }
+
+
+    @Test
+    public void testScenarioCustomSelectorSettings() {
+        Assume.assumeNotNull("Ant home not set", selectorRule.getProject().getProperty("ant.home") );
+        doScenarioTest("modifiedselectortest-scenario-customselector-settings", "core.cache.properties");
+    }
+
+
+    public void doScenarioTest(String target, String cachefilename) {
+        BFT bft = new BFT();
+        bft.setUp();
+        File cachefile = new File(selectorRule.getProject().getBaseDir(), cachefilename);
+        try {
+            // do the actions
+            bft.doTarget("modifiedselectortest-scenario-clean");
+            bft.doTarget(target);
+
+            // the directories to check
+            File to1 = new File(selectorRule.getOutputDir(), "selectortest/to-1");
+            File to2 = new File(selectorRule.getOutputDir(), "selectortest/to-2");
+            File to3 = new File(selectorRule.getOutputDir(), "selectortest/to-3");
+
+            // do the checks
+            assertTrue("Cache file not created.", cachefile.exists());
+            assertTrue("Not enough files copied on first time.", to1.list().length>5);
+            assertTrue("Too much files copied on second time.", to2.list().length==0);
+            assertTrue("Too much files copied on third time.", to3.list().length==2);
+        // don't catch the JUnit exceptions
+        } finally {
+            bft.doTarget("modifiedselectortest-scenario-clean");
+            bft.deletePropertiesfile();
+            bft.tearDown();
+            cachefile.delete();
+        }
+    }
+
+
+    //  =====================  helper methods and classes  ====================
+
+
+    /**
+     * Creates a configured parameter object.
+     * @param name   name of the parameter
+     * @param value  value of the parameter
+     * @return the parameter object
+     */
+    private Parameter createParam(String name, String value) {
+        Parameter p = new Parameter();
+        p.setName(name);
+        p.setValue(value);
+        return p;
+    }
+
+
+    /**
+     * The BFT class wrapps the selector test-builfile inside an
+     * ant project. It supports target execution
+     * and property transfer to that project.
+     */
+    private class BFT extends BuildFileRule {
+        String buildfile = "src/etc/testcases/types/selectors.xml";
+
+        String propfile = "ModifiedSelectorTest.properties";
+
+        boolean isConfigured = false;
+
+
+        public void setUp() {
+            super.configureProject(buildfile);
+            isConfigured = true;
+        }
+
+
+        /**
+         * This stub teardown is here because the outer class needs to call the
+         * tearDown method, and in the superclass it is protected.
+         */
+        public void tearDown() {
+            super.after();
+
+        }
+
+        public void doTarget(String target) {
+            if (!isConfigured) setUp();
+            executeTarget(target);
+        }
+
+        public String getProperty(String property) {
+            return super.getProject().getProperty(property);
+        }
+
+        public void writeProperties(String line) {
+            if (!isConfigured) setUp();
+            File dir = getProject().getBaseDir();
+            File file = new File(dir, propfile);
+            try {
+                java.io.FileWriter out =
+                    new java.io.FileWriter(file.getAbsolutePath(), true);
+                out.write(line);
+                out.write(System.getProperty("line.separator"));
+                out.flush();
+                out.close();
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+
+        public void deletePropertiesfile() {
+            if (!isConfigured) setUp();
+            new File(getProject().getBaseDir(), propfile).delete();
+        }
+
+        public void deleteCachefile() {
+            File basedir = new File(buildfile).getParentFile();
+            File cacheFile = new File(basedir, "cache.properties");
+            cacheFile.delete();
+        }
+
+    }//class-BFT
+
+
+    /**
+     * MockProject wrappes a very small ant project (one target, one task)
+     * but provides public methods to fire the build events.
+     */
+    private class MockProject extends Project {
+        private Task   task;
+        private Target target;
+
+        public MockProject() {
+            task = new Task(){
+                public void execute() {
+                }
+            };
+            task.setTaskName("testTask");
+            target = new Target();
+            target.setName("testTarget");
+            target.setProject(this);
+            target.addTask(task);
+            task.setOwningTarget(target);
+        }
+
+        public void fireBuildFinished() {
+            super.fireBuildFinished(null);
+        }
+        public void fireSubBuildFinished() {
+            super.fireSubBuildFinished(null);
+        }
+        public void fireTargetStarted() {
+            super.fireTargetStarted(target);
+        }
+        public void fireTargetFinished() {
+            super.fireTargetFinished(target, null);
+        }
+        public void fireTaskStarted() {
+            super.fireTaskStarted(task);
+        }
+        public void fireTaskFinished() {
+            super.fireTaskFinished(task, null);
+        }
+    }//class-MockProject
+
+
+    /**
+     * Does the selection test for a given selector and prints the
+     * filenames of the differing files (selected but shouldn't,
+     * not selected but should).
+     * @param selector  The selector to test
+     * @param expected  The expected result
+     */
+    private void performTests(FileSelector selector, String expected) {
+        String result = selectorRule.selectionString(selector);
+        String diff = diff(expected, result);
+        String resolved = resolve(diff);
+        assertEquals("Differing files: " + resolved, result, expected);
+    }
+    /**
+     *  Checks which files are selected and shouldn't be or which
+     *  are not selected but should.
+     *  @param expected    String containing 'F's and 'T's
+     *  @param result      String containing 'F's and 'T's
+     *  @return Difference as String containing '-' (equal) and
+     *          'X' (difference).
+     */
+    private String diff(String expected, String result) {
+        int length1 = expected.length();
+        int length2 = result.length();
+        int min = (length1 > length2) ? length2 : length1;
+        StringBuffer sb = new StringBuffer();
+        for (int i=0; i<min; i++) {
+            sb.append(
+                    (expected.charAt(i) == result.charAt(i))
+                            ? "-"
+                            : "X"
+            );
+        }
+        return sb.toString();
+    }
+
+    /**
+     * Resolves a diff-String (@see diff()) against the (inherited) filenames-
+     * and files arrays.
+     * @param filelist    Diff-String
+     * @return String containing the filenames for all differing files,
+     *         separated with semicolons ';'
+     */
+    private String resolve(String filelist) {
+        StringBuffer sb = new StringBuffer();
+        int min = (selectorRule.getFilenames().length > filelist.length())
+                ? filelist.length()
+                : selectorRule.getFilenames().length;
+        for (int i=0; i<min; i++) {
+            if ('X'==filelist.charAt(i)) {
+                sb.append(selectorRule.getFilenames()[i]);
+                sb.append(";");
+            }
+        }
+        return sb.toString();
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/selectors/PresentSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/PresentSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/PresentSelectorTest.java
index f93e101..f273334 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/PresentSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/PresentSelectorTest.java
@@ -1,137 +1,137 @@
-/*
- *  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.types.selectors;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.types.Mapper;
-import org.junit.Rule;
-import org.junit.Test;
-
-import java.io.File;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-
-/**
- * Tests Present Selectors
- *
- */
-public class PresentSelectorTest {
-
-
-    @Rule
-    public final BaseSelectorRule selectorRule = new BaseSelectorRule();
-
-    /**
-     * Test the code that validates the selector.
-     */
-    @Test
-    public void testValidate() {
-        PresentSelector s = new PresentSelector();
-        try {
-            s.createMapper();
-            s.createMapper();
-            fail("PresentSelector allowed more than one nested mapper.");
-        } catch (BuildException be1) {
-            assertEquals("Cannot define more than one mapper",
-                    be1.getMessage());
-        }
-
-        s = new PresentSelector();
-        try {
-            s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
-            fail("PresentSelector did not check for required fields");
-        } catch (BuildException be2) {
-            assertEquals("The targetdir attribute is required.",
-                    be2.getMessage());
-        }
-
-    }
-
-    /**
-     * Tests to make sure that the selector is selecting files correctly.
-     */
-    @Test
-    public void testSelectionBehaviour() {
-        PresentSelector s;
-        String results;
-        Mapper m;
-        Mapper.MapperType identity = new Mapper.MapperType();
-        identity.setValue("identity");
-        Mapper.MapperType glob = new Mapper.MapperType();
-        glob.setValue("glob");
-        Mapper.MapperType merge = new Mapper.MapperType();
-        merge.setValue("merge");
-        Mapper.MapperType flatten = new Mapper.MapperType();
-        flatten.setValue("flatten");
-
-        File beddir = selectorRule.getBeddir();
-        
-        s = new PresentSelector();
-        s.setTargetdir(beddir);
-        results = selectorRule.selectionString(s);
-        assertEquals("TTTTTTTTTTTT", results);
-
-        s = new PresentSelector();
-        s.setTargetdir(beddir);
-        m = s.createMapper();
-        m.setType(identity);
-        results = selectorRule.selectionString(s);
-        assertEquals("TTTTTTTTTTTT", results);
-
-        s = new PresentSelector();
-        File subdir = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/expected");
-        s.setTargetdir(subdir);
-        m = s.createMapper();
-        m.setType(flatten);
-        results = selectorRule.selectionString(s);
-        assertEquals("TTTTTTTTTTTF", results);
-
-        s = new PresentSelector();
-        s.setTargetdir(beddir);
-        m = s.createMapper();
-        m.setType(merge);
-        m.setTo("asf-logo.gif.gz");
-        results = selectorRule.selectionString(s);
-        assertEquals("TTTTTTTTTTTT", results);
-
-        s = new PresentSelector();
-        subdir = new File(beddir, "tar/bz2");
-        s.setTargetdir(subdir);
-        m = s.createMapper();
-        m.setType(glob);
-        m.setFrom("*.bz2");
-        m.setTo("*.tar.bz2");
-        results = selectorRule.selectionString(s);
-        assertEquals("FFTFFFFFFFFF", results);
-
-            
-        s = new PresentSelector();
-        subdir = new File(selectorRule.getOutputDir(), "selectortest2");
-        s.setTargetdir(subdir);
-        results = selectorRule.selectionString(s);
-        assertEquals("TTTFFTTTTTTT", results);
-        results = selectorRule.selectionString(s);
-        assertEquals("TTTFFTTTTTTT", results);
-
-
-    }
-
-}
+/*
+ *  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.types.selectors;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.Mapper;
+import org.junit.Rule;
+import org.junit.Test;
+
+import java.io.File;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+
+/**
+ * Tests Present Selectors
+ *
+ */
+public class PresentSelectorTest {
+
+
+    @Rule
+    public final BaseSelectorRule selectorRule = new BaseSelectorRule();
+
+    /**
+     * Test the code that validates the selector.
+     */
+    @Test
+    public void testValidate() {
+        PresentSelector s = new PresentSelector();
+        try {
+            s.createMapper();
+            s.createMapper();
+            fail("PresentSelector allowed more than one nested mapper.");
+        } catch (BuildException be1) {
+            assertEquals("Cannot define more than one mapper",
+                    be1.getMessage());
+        }
+
+        s = new PresentSelector();
+        try {
+            s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+            fail("PresentSelector did not check for required fields");
+        } catch (BuildException be2) {
+            assertEquals("The targetdir attribute is required.",
+                    be2.getMessage());
+        }
+
+    }
+
+    /**
+     * Tests to make sure that the selector is selecting files correctly.
+     */
+    @Test
+    public void testSelectionBehaviour() {
+        PresentSelector s;
+        String results;
+        Mapper m;
+        Mapper.MapperType identity = new Mapper.MapperType();
+        identity.setValue("identity");
+        Mapper.MapperType glob = new Mapper.MapperType();
+        glob.setValue("glob");
+        Mapper.MapperType merge = new Mapper.MapperType();
+        merge.setValue("merge");
+        Mapper.MapperType flatten = new Mapper.MapperType();
+        flatten.setValue("flatten");
+
+        File beddir = selectorRule.getBeddir();
+
+        s = new PresentSelector();
+        s.setTargetdir(beddir);
+        results = selectorRule.selectionString(s);
+        assertEquals("TTTTTTTTTTTT", results);
+
+        s = new PresentSelector();
+        s.setTargetdir(beddir);
+        m = s.createMapper();
+        m.setType(identity);
+        results = selectorRule.selectionString(s);
+        assertEquals("TTTTTTTTTTTT", results);
+
+        s = new PresentSelector();
+        File subdir = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/expected");
+        s.setTargetdir(subdir);
+        m = s.createMapper();
+        m.setType(flatten);
+        results = selectorRule.selectionString(s);
+        assertEquals("TTTTTTTTTTTF", results);
+
+        s = new PresentSelector();
+        s.setTargetdir(beddir);
+        m = s.createMapper();
+        m.setType(merge);
+        m.setTo("asf-logo.gif.gz");
+        results = selectorRule.selectionString(s);
+        assertEquals("TTTTTTTTTTTT", results);
+
+        s = new PresentSelector();
+        subdir = new File(beddir, "tar/bz2");
+        s.setTargetdir(subdir);
+        m = s.createMapper();
+        m.setType(glob);
+        m.setFrom("*.bz2");
+        m.setTo("*.tar.bz2");
+        results = selectorRule.selectionString(s);
+        assertEquals("FFTFFFFFFFFF", results);
+
+
+        s = new PresentSelector();
+        subdir = new File(selectorRule.getOutputDir(), "selectortest2");
+        s.setTargetdir(subdir);
+        results = selectorRule.selectionString(s);
+        assertEquals("TTTFFTTTTTTT", results);
+        results = selectorRule.selectionString(s);
+        assertEquals("TTTFFTTTTTTT", results);
+
+
+    }
+
+}


[06/21] ant git commit: Normalise tabulation and line breaks

Posted by gi...@apache.org.
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java b/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java
index ae9b73b..e016657 100644
--- a/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java
@@ -1,625 +1,625 @@
-/*
- *  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.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.condition.Os;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
-
-/**
- * Tests for org.apache.tools.ant.util.FileUtils.
- *
- */
-public class FileUtilsTest {
-
-    private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
-    private File removeThis;
-    private String root;
-
-
-    @Before
-    public void setUp() {
-        // Windows adds the drive letter in uppercase, unless you run Cygwin
-        root = new File(File.separator).getAbsolutePath().toUpperCase();
-    }
-
-    @After
-    public void tearDown() {
-        if (removeThis != null && removeThis.exists()) {
-            if (!removeThis.delete())
-            {
-                removeThis.deleteOnExit();
-            }
-        }
-    }
-
-    /**
-     * test modification.
-     * Since Ant1.7, the method being tested no longer uses
-     * reflection to provide backwards support to Java1.1, so this
-     * test is not so critical. But it does explore file system
-     * behaviour and will help catch any regression in Java itself,
-     * so is worth retaining.
-     * @see FileUtils#setFileLastModified(java.io.File, long)
-     * @throws IOException
-     */
-    @Test
-    public void testSetLastModified() throws IOException {
-        removeThis = new File("dummy");
-        FileOutputStream fos = new FileOutputStream(removeThis);
-        fos.write(new byte[0]);
-        fos.close();
-        assumeTrue("Could not change file modified time", removeThis.setLastModified(removeThis.lastModified() - 2000));
-        long modTime = removeThis.lastModified();
-        assertTrue(modTime != 0);
-
-
-        FILE_UTILS.setFileLastModified(removeThis, -1);
-        long secondModTime = removeThis.lastModified();
-        assertTrue(secondModTime > modTime);
-
-        // number of milliseconds in a day
-        final int millisperday=24 * 3600 * 1000;
-        // in a previous version, the date of the file was set to 123456
-        // milliseconds since 01.01.1970
-        // it did not work on a computer running JDK 1.4.1_02 + Windows 2000
-        FILE_UTILS.setFileLastModified(removeThis, secondModTime + millisperday);
-        long thirdModTime = removeThis.lastModified();
-        /*
-         * I would love to compare this with 123456, but depending on
-         * the filesystems granularity it can take an arbitrary value.
-         *
-         * Just assert the time has changed.
-         */
-        assertTrue(thirdModTime != secondModTime);
-    }
-
-    @Test
-    public void testResolveFile() {
-        if (!(Os.isFamily("dos") || Os.isFamily("netware"))) {
-            /*
-             * Start with simple absolute file names.
-             */
-            assertEquals(File.separator,
-                         FILE_UTILS.resolveFile(null, "/").getPath());
-            assertEquals(File.separator,
-                         FILE_UTILS.resolveFile(null, "\\").getPath());
-        } else {
-            assertEqualsIgnoreDriveCase(localize(File.separator),
-                FILE_UTILS.resolveFile(null, "/").getPath());
-            assertEqualsIgnoreDriveCase(localize(File.separator),
-                FILE_UTILS.resolveFile(null, "\\").getPath());
-            /*
-             * throw in drive letters
-             */
-            String driveSpec = "C:";
-            assertEquals(driveSpec + "\\",
-                         FILE_UTILS.resolveFile(null, driveSpec + "/").getPath());
-            assertEquals(driveSpec + "\\",
-                         FILE_UTILS.resolveFile(null, driveSpec + "\\").getPath());
-            String driveSpecLower = "c:";
-            assertEquals(driveSpecLower + "\\",
-                         FILE_UTILS.resolveFile(null, driveSpecLower + "/").getPath());
-            assertEquals(driveSpecLower + "\\",
-                         FILE_UTILS.resolveFile(null, driveSpecLower + "\\").getPath());
-            /*
-             * promised to eliminate consecutive slashes after drive letter.
-             */
-            assertEquals(driveSpec + "\\",
-                         FILE_UTILS.resolveFile(null, driveSpec + "/////").getPath());
-            assertEquals(driveSpec + "\\",
-                         FILE_UTILS.resolveFile(null, driveSpec + "\\\\\\\\\\\\").getPath());
-        }
-        if (Os.isFamily("netware")) {
-            /*
-             * throw in NetWare volume names
-             */
-            String driveSpec = "SYS:";
-            assertEquals(driveSpec,
-                         FILE_UTILS.resolveFile(null, driveSpec + "/").getPath());
-            assertEquals(driveSpec,
-                         FILE_UTILS.resolveFile(null, driveSpec + "\\").getPath());
-            String driveSpecLower = "sys:";
-            assertEquals(driveSpec,
-                         FILE_UTILS.resolveFile(null, driveSpecLower + "/").getPath());
-            assertEquals(driveSpec,
-                         FILE_UTILS.resolveFile(null, driveSpecLower + "\\").getPath());
-            /*
-             * promised to eliminate consecutive slashes after drive letter.
-             */
-            assertEquals(driveSpec,
-                         FILE_UTILS.resolveFile(null, driveSpec + "/////").getPath());
-            assertEquals(driveSpec,
-                         FILE_UTILS.resolveFile(null, driveSpec + "\\\\\\\\\\\\").getPath());
-        } else if (!(Os.isFamily("dos"))) {
-            /*
-             * drive letters must be considered just normal filenames.
-             */
-            String driveSpec = "C:";
-            String udir = System.getProperty("user.dir");
-            assertEquals(udir + File.separator + driveSpec,
-                         FILE_UTILS.resolveFile(null, driveSpec + "/").getPath());
-            assertEquals(udir + File.separator + driveSpec,
-                         FILE_UTILS.resolveFile(null, driveSpec + "\\").getPath());
-            String driveSpecLower = "c:";
-            assertEquals(udir + File.separator + driveSpecLower,
-                         FILE_UTILS.resolveFile(null, driveSpecLower + "/").getPath());
-            assertEquals(udir + File.separator + driveSpecLower,
-                         FILE_UTILS.resolveFile(null, driveSpecLower + "\\").getPath());
-        }
-
-        /*
-         * Now test some relative file name magic.
-         */
-        assertEquals(localize("/1/2/3/4"),
-                     FILE_UTILS.resolveFile(new File(localize("/1/2/3")), "4").getPath());
-        assertEquals(localize("/1/2/3/4"),
-                     FILE_UTILS.resolveFile(new File(localize("/1/2/3")), "./4").getPath());
-        assertEquals(localize("/1/2/3/4"),
-                     FILE_UTILS.resolveFile(new File(localize("/1/2/3")), ".\\4").getPath());
-        assertEquals(localize("/1/2/3/4"),
-                     FILE_UTILS.resolveFile(new File(localize("/1/2/3")), "./.\\4").getPath());
-        assertEquals(localize("/1/2/3/4"),
-                     FILE_UTILS.resolveFile(new File(localize("/1/2/3")), "../3/4").getPath());
-        assertEquals(localize("/1/2/3/4"),
-                     FILE_UTILS.resolveFile(new File(localize("/1/2/3")), "..\\3\\4").getPath());
-        assertEquals(localize("/1/2/3/4"),
-                     FILE_UTILS.resolveFile(new File(localize("/1/2/3")), "../../5/.././2/./3/6/../4").getPath());
-        assertEquals(localize("/1/2/3/4"),
-                     FILE_UTILS.resolveFile(new File(localize("/1/2/3")), "..\\../5/..\\./2/./3/6\\../4").getPath());
-
-        assertEquals("meaningless result but no exception",
-                new File(localize("/1/../../b")),
-                FILE_UTILS.resolveFile(new File(localize("/1")), "../../b"));
-
-    }
-
-    @Test
-    public void testNormalize() {
-        if (!(Os.isFamily("dos") || Os.isFamily("netware"))) {
-            /*
-             * Start with simple absolute file names.
-             */
-            assertEquals(File.separator,
-                         FILE_UTILS.normalize("/").getPath());
-            assertEquals(File.separator,
-                         FILE_UTILS.normalize("\\").getPath());
-        } else {
-            try {
-                 FILE_UTILS.normalize("/").getPath();
-                 fail("normalized \"/\" on dos or netware");
-            } catch (Exception e) {
-            }
-            try {
-                 FILE_UTILS.normalize("\\").getPath();
-                 fail("normalized \"\\\" on dos or netware");
-            } catch (Exception e) {
-            }
-        }
-
-        if (Os.isFamily("dos")) {
-            /*
-             * throw in drive letters
-             */
-            String driveSpec = "C:";
-            try {
-                 FILE_UTILS.normalize(driveSpec).getPath();
-                 fail(driveSpec + " is not an absolute path");
-            } catch (Exception e) {
-            }
-            assertEquals(driveSpec + "\\",
-                         FILE_UTILS.normalize(driveSpec + "/").getPath());
-            assertEquals(driveSpec + "\\",
-                         FILE_UTILS.normalize(driveSpec + "\\").getPath());
-            String driveSpecLower = "c:";
-            assertEquals(driveSpecLower + "\\",
-                         FILE_UTILS.normalize(driveSpecLower + "/").getPath());
-            assertEquals(driveSpecLower + "\\",
-                         FILE_UTILS.normalize(driveSpecLower + "\\").getPath());
-            /*
-             * promised to eliminate consecutive slashes after drive letter.
-             */
-            assertEquals(driveSpec + "\\",
-                         FILE_UTILS.normalize(driveSpec + "/////").getPath());
-            assertEquals(driveSpec + "\\",
-                         FILE_UTILS.normalize(driveSpec + "\\\\\\\\\\\\").getPath());
-        } else if (Os.isFamily("netware")) {
-            /*
-             * throw in NetWare volume names
-             */
-            String driveSpec = "SYS:";
-            assertEquals(driveSpec,
-                         FILE_UTILS.normalize(driveSpec).getPath());
-            assertEquals(driveSpec,
-                         FILE_UTILS.normalize(driveSpec + "/").getPath());
-            assertEquals(driveSpec,
-                         FILE_UTILS.normalize(driveSpec + "\\").getPath());
-            String driveSpecLower = "sys:";
-            assertEquals(driveSpec,
-                         FILE_UTILS.normalize(driveSpecLower).getPath());
-            assertEquals(driveSpec,
-                         FILE_UTILS.normalize(driveSpecLower + "/").getPath());
-            assertEquals(driveSpec,
-                         FILE_UTILS.normalize(driveSpecLower + "\\").getPath());
-            assertEquals(driveSpec + "\\junk",
-                         FILE_UTILS.normalize(driveSpecLower + "\\junk").getPath());
-            /*
-             * promised to eliminate consecutive slashes after drive letter.
-             */
-            assertEquals(driveSpec,
-                         FILE_UTILS.normalize(driveSpec + "/////").getPath());
-            assertEquals(driveSpec,
-                         FILE_UTILS.normalize(driveSpec + "\\\\\\\\\\\\").getPath());
-        } else {
-            try {
-                String driveSpec = "C:";
-                assertEquals(driveSpec,
-                             FILE_UTILS.normalize(driveSpec).getPath());
-                fail("Expected failure, C: isn't an absolute path on other os's");
-            } catch (BuildException e) {
-                // Passed test 
-            }
-        }
-
-        /*
-         * Now test some relative file name magic.
-         */
-        assertEquals(localize("/1/2/3/4"),
-                     FILE_UTILS.normalize(localize("/1/2/3/4")).getPath());
-        assertEquals(localize("/1/2/3/4"),
-                     FILE_UTILS.normalize(localize("/1/2/3/./4")).getPath());
-        assertEquals(localize("/1/2/3/4"),
-                     FILE_UTILS.normalize(localize("/1/2/3/.\\4")).getPath());
-        assertEquals(localize("/1/2/3/4"),
-                     FILE_UTILS.normalize(localize("/1/2/3/./.\\4")).getPath());
-        assertEquals(localize("/1/2/3/4"),
-                     FILE_UTILS.normalize(localize("/1/2/3/../3/4")).getPath());
-        assertEquals(localize("/1/2/3/4"),
-                     FILE_UTILS.normalize(localize("/1/2/3/..\\3\\4")).getPath());
-        assertEquals(localize("/1/2/3/4"),
-                     FILE_UTILS.normalize(localize("/1/2/3/../../5/.././2/./3/6/../4")).getPath());
-        assertEquals(localize("/1/2/3/4"),
-                     FILE_UTILS.normalize(localize("/1/2/3/..\\../5/..\\./2/./3/6\\../4")).getPath());
-
-        try {
-            FILE_UTILS.normalize("foo");
-            fail("foo is not an absolute path");
-        } catch (BuildException e) {
-            // Expected exception caught
-        }
-
-        assertEquals("will not go outside FS root (but will not throw an exception either)",
-                new File(localize("/1/../../b")),
-                FILE_UTILS.normalize(localize("/1/../../b")));
-    }
-
-    /**
-     * Test handling of null arguments.
-     */
-    @Test
-    public void testNullArgs() {
-        try {
-            FILE_UTILS.normalize(null);
-            fail("successfully normalized a null-file");
-        } catch (NullPointerException npe) {
-            // Expected exception caught
-        }
-
-        File f = FILE_UTILS.resolveFile(null, "a");
-        assertEquals(f, new File("a").getAbsoluteFile());
-    }
-
-    
-    /**
-     * Test createTempFile
-     */
-    @Test
-    public void testCreateTempFile()
-    {
-        // null parent dir
-        File tmp1 = FILE_UTILS.createTempFile("pre", ".suf", null, false, true);
-        String tmploc = System.getProperty("java.io.tmpdir");
-        String name = tmp1.getName();
-        assertTrue("starts with pre", name.startsWith("pre"));
-        assertTrue("ends with .suf", name.endsWith(".suf"));
-        assertTrue("File was created", tmp1.exists());
-        assertEquals((new File(tmploc, tmp1.getName())).getAbsolutePath(), tmp1
-                .getAbsolutePath());
-        tmp1.delete();
-
-        File dir2 = new File(tmploc + "/ant-test");
-        dir2.mkdir();
-        removeThis = dir2;
-
-        File tmp2 = FILE_UTILS.createTempFile("pre", ".suf", dir2, true, true);
-        String name2 = tmp2.getName();
-        assertTrue("starts with pre", name2.startsWith("pre"));
-        assertTrue("ends with .suf", name2.endsWith(".suf"));
-        assertTrue("File was created", tmp2.exists());
-        assertEquals((new File(dir2, tmp2.getName())).getAbsolutePath(), tmp2
-                .getAbsolutePath());
-        tmp2.delete();
-        dir2.delete();
-
-        File parent = new File((new File("/tmp")).getAbsolutePath());
-        tmp1 = FILE_UTILS.createTempFile("pre", ".suf", parent, false);
-        assertTrue("new file", !tmp1.exists());
-
-        name = tmp1.getName();
-        assertTrue("starts with pre", name.startsWith("pre"));
-        assertTrue("ends with .suf", name.endsWith(".suf"));
-        assertEquals("is inside parent dir", parent.getAbsolutePath(), tmp1
-                .getParent());
-
-        tmp2 = FILE_UTILS.createTempFile("pre", ".suf", parent, false);
-        assertTrue("files are different", !tmp1.getAbsolutePath().equals(
-                tmp2.getAbsolutePath()));
-
-        // null parent dir
-        File tmp3 = FILE_UTILS.createTempFile("pre", ".suf", null, false);
-        tmploc = System.getProperty("java.io.tmpdir");
-        assertEquals((new File(tmploc, tmp3.getName())).getAbsolutePath(), tmp3
-                .getAbsolutePath());
-    }
-
-    /**
-     * Test contentEquals
-     */
-    @Test
-    public void testContentEquals() throws IOException {
-        assertTrue("Non existing files", FILE_UTILS.contentEquals(new File(System.getProperty("root"), "foo"),
-                                                          new File(System.getProperty("root"), "bar")));
-        assertTrue("One exists, the other one doesn\'t",
-                   !FILE_UTILS.contentEquals(new File(System.getProperty("root"), "foo"), new File(System.getProperty("root"), "build.xml")));
-        assertTrue("Don\'t compare directories",
-                   !FILE_UTILS.contentEquals(new File(System.getProperty("root"), "src"), new File(System.getProperty("root"), "src")));
-        assertTrue("File equals itself",
-                   FILE_UTILS.contentEquals(new File(System.getProperty("root"), "build.xml"),
-                                    new File(System.getProperty("root"), "build.xml")));
-        assertTrue("Files are different",
-                   !FILE_UTILS.contentEquals(new File(System.getProperty("root"), "build.xml"),
-                                     new File(System.getProperty("root"), "docs.xml")));
-    }
-
-    /**
-     * Test createNewFile
-     */
-    @Test
-    public void testCreateNewFile() throws IOException {
-        removeThis = new File("dummy");
-        assertTrue(!removeThis.exists());
-        FILE_UTILS.createNewFile(removeThis);
-        assertTrue(removeThis.exists());
-    }
-
-    /**
-     * Test removeLeadingPath.
-     */
-    @Test
-    public void testRemoveLeadingPath() {
-        assertEquals("bar", FILE_UTILS.removeLeadingPath(new File("/foo"),
-                                                 new File("/foo/bar")));
-        assertEquals("bar", FILE_UTILS.removeLeadingPath(new File("/foo/"),
-                                                 new File("/foo/bar")));
-        assertEquals("bar", FILE_UTILS.removeLeadingPath(new File("\\foo"),
-                                                 new File("\\foo\\bar")));
-        assertEquals("bar", FILE_UTILS.removeLeadingPath(new File("\\foo\\"),
-                                                 new File("\\foo\\bar")));
-        assertEquals("bar", FILE_UTILS.removeLeadingPath(new File("c:/foo"),
-                                                 new File("c:/foo/bar")));
-        assertEquals("bar", FILE_UTILS.removeLeadingPath(new File("c:/foo/"),
-                                                 new File("c:/foo/bar")));
-        assertEquals("bar", FILE_UTILS.removeLeadingPath(new File("c:\\foo"),
-                                                 new File("c:\\foo\\bar")));
-        assertEquals("bar", FILE_UTILS.removeLeadingPath(new File("c:\\foo\\"),
-                                                 new File("c:\\foo\\bar")));
-        if (!(Os.isFamily("dos") || Os.isFamily("netware"))) {
-            assertEquals(FILE_UTILS.normalize("/bar").getAbsolutePath(),
-                         FILE_UTILS.removeLeadingPath(new File("/foo"), new File("/bar")));
-            assertEquals(FILE_UTILS.normalize("/foobar").getAbsolutePath(),
-                         FILE_UTILS.removeLeadingPath(new File("/foo"), new File("/foobar")));
-        }
-        // bugzilla report 19979
-        assertEquals("", FILE_UTILS.removeLeadingPath(new File("/foo/bar"),
-                                              new File("/foo/bar")));
-        assertEquals("", FILE_UTILS.removeLeadingPath(new File("/foo/bar"),
-                                              new File("/foo/bar/")));
-        assertEquals("", FILE_UTILS.removeLeadingPath(new File("/foo/bar/"),
-                                              new File("/foo/bar/")));
-        assertEquals("", FILE_UTILS.removeLeadingPath(new File("/foo/bar/"),
-                                              new File("/foo/bar")));
-
-        String expected = "foo/bar".replace('\\', File.separatorChar)
-            .replace('/', File.separatorChar);
-        assertEquals(expected, FILE_UTILS.removeLeadingPath(new File("/"),
-                                                    new File("/foo/bar")));
-        assertEquals(expected, FILE_UTILS.removeLeadingPath(new File("c:/"),
-                                                    new File("c:/foo/bar")));
-        assertEquals(expected, FILE_UTILS.removeLeadingPath(new File("c:\\"),
-                                                    new File("c:\\foo\\bar")));
-    }
-
-    /**
-     * test toUri
-     */
-    @Test
-    public void testToURI() {
-        String dosRoot;
-        if (Os.isFamily("dos") || Os.isFamily("netware")) {
-            dosRoot = System.getProperty("user.dir")
-                .substring(0, 3).replace(File.separatorChar, '/');
-        }
-        else
-        {
-            dosRoot = "";
-        }
-        if (Os.isFamily("dos")) {
-            assertEquals("file:/c:/foo", removeExtraneousAuthority(FILE_UTILS.toURI("c:\\foo")));
-        }
-        if (Os.isFamily("netware")) {
-            assertEquals("file:/SYS:/foo", removeExtraneousAuthority(FILE_UTILS.toURI("sys:\\foo")));
-        }
-        if (File.pathSeparatorChar == '/') {
-            assertEquals("file:/foo", removeExtraneousAuthority(FILE_UTILS.toURI("/foo")));
-            assertTrue("file: URIs must name absolute paths", FILE_UTILS.toURI("./foo").startsWith("file:/"));
-            assertTrue(FILE_UTILS.toURI("./foo").endsWith("/foo"));
-            assertEquals("file:/" + dosRoot + "foo%20bar", removeExtraneousAuthority(FILE_UTILS.toURI("/foo bar")));
-            assertEquals("file:/" + dosRoot + "foo%23bar", removeExtraneousAuthority(FILE_UTILS.toURI("/foo#bar")));
-        } else if (File.pathSeparatorChar == '\\') {
-            assertEquals("file:/" + dosRoot + "foo", removeExtraneousAuthority(FILE_UTILS.toURI("\\foo")));
-            assertTrue("file: URIs must name absolute paths", FILE_UTILS.toURI(".\\foo").startsWith("file:/"));
-            assertTrue(FILE_UTILS.toURI(".\\foo").endsWith("/foo"));
-            assertEquals("file:/" + dosRoot + "foo%20bar", removeExtraneousAuthority(FILE_UTILS.toURI("\\foo bar")));
-            assertEquals("file:/" + dosRoot + "foo%23bar", removeExtraneousAuthority(FILE_UTILS.toURI("\\foo#bar")));
-        }
-        // a test with ant for germans
-        // the escaped character used for the test is the "a umlaut"
-        // this is the fix for the bug 37348
-        assertEquals("file:/" + dosRoot + "%C3%A4nt", removeExtraneousAuthority(FILE_UTILS.toURI("/\u00E4nt")));
-    }
-
-    /**
-     * Authority field is unnecessary, but harmless, in file: URIs.
-     * Java 1.4 does not produce it when using File.toURI.
-     */
-    private static String removeExtraneousAuthority(String uri) {
-        String prefix = "file:///";
-        if (uri.startsWith(prefix)) {
-            return "file:/" + uri.substring(prefix.length());
-        } else {
-            return uri;
-        }
-    }
-
-    @Test
-    public void testIsContextRelativePath() {
-        assumeTrue("Test only runs on DOS", Os.isFamily("dos"));
-        assertTrue(FileUtils.isContextRelativePath("/\u00E4nt"));
-        assertTrue(FileUtils.isContextRelativePath("\\foo"));
-    }
-
-    /**
-     * test fromUri
-     */
-    @Test
-    public void testFromURI() {
-        String dosRoot;
-        if (Os.isFamily("dos") || Os.isFamily("netware")) {
-            dosRoot = System.getProperty("user.dir").substring(0, 2);
-        } else {
-            dosRoot = "";
-        }
-        if (Os.isFamily("netware")) {
-            assertEqualsIgnoreDriveCase("SYS:\\foo", FILE_UTILS.fromURI("file:///sys:/foo"));
-        }
-        if (Os.isFamily("dos")) {
-            assertEqualsIgnoreDriveCase("C:\\foo", FILE_UTILS.fromURI("file:///c:/foo"));
-        }
-        assertEqualsIgnoreDriveCase(dosRoot + File.separator + "foo", FILE_UTILS.fromURI("file:///foo"));
-        assertEquals("." + File.separator + "foo",
-                     FILE_UTILS.fromURI("file:./foo"));
-        assertEquals(dosRoot + File.separator + "foo bar", FILE_UTILS.fromURI("file:///foo%20bar"));
-        assertEquals(dosRoot + File.separator + "foo#bar", FILE_UTILS.fromURI("file:///foo%23bar"));
-    }
-
-    @Test
-    public void testModificationTests() {
-
-        //get a time
-        long firstTime=System.currentTimeMillis();
-        //add some time. We assume no OS has a granularity this bad
-        long secondTime=firstTime+60000;
-/*
-        assertTrue("same timestamp is up to date",
-                fu.isUpToDate(firstTime, firstTime));
-                */
-
-        //check that older is up to date with a newer dest
-        assertTrue("older source files are up to date",
-                FILE_UTILS.isUpToDate(firstTime,secondTime));
-        //check that older is up to date with a newer dest
-        assertFalse("newer source files are no up to date",
-                FILE_UTILS.isUpToDate(secondTime, firstTime));
-
-        assertTrue("-1 dest timestamp implies nonexistence",
-                !FILE_UTILS.isUpToDate(firstTime,-1L));
-    }
-
-    @Test
-    public void testHasErrorInCase() {
-        File tempFolder = new File(System.getProperty("java.io.tmpdir"));
-        File wellcased = FILE_UTILS.createTempFile("alpha", "beta", tempFolder,
-                                                   true, true);
-        String s = wellcased.getName().toUpperCase();
-        File wrongcased = new File(tempFolder, s);
-        if (Os.isFamily("mac") && Os.isFamily("unix")) {
-            //no guarantees on filesystem case-sensitivity
-        } else if (Os.isFamily("dos")) {
-            assertTrue(FILE_UTILS.hasErrorInCase(wrongcased));
-            assertFalse(FILE_UTILS.hasErrorInCase(wellcased));
-        } else {
-            assertFalse(FILE_UTILS.hasErrorInCase(wrongcased));
-            assertFalse(FILE_UTILS.hasErrorInCase(wellcased));
-        }
-        
-    }
-    public void testGetDefaultEncoding() {
-        // This just tests that the function does not blow up
-        FILE_UTILS.getDefaultEncoding();
-    }
-
-    /**
-     * adapt file separators to local conventions
-     */
-    private String localize(String path) {
-        path = root + path.substring(1);
-        return path.replace('\\', File.separatorChar).replace('/', File.separatorChar);
-    }
-
-    /**
-     * convenience method
-     * normalize brings the drive in uppercase
-     * the drive letter is in lower case under cygwin
-     * calling this method allows tests where normalize is called to pass under cygwin
-     */
-    private void assertEqualsIgnoreDriveCase(String s1, String s2) {
-        if ((Os.isFamily("dos") || Os.isFamily("netware"))
-            && s1.length() > 0 && s2.length() > 0) {
-            StringBuilder sb1 = new StringBuilder(s1);
-            StringBuilder sb2 = new StringBuilder(s2);
-            sb1.setCharAt(0, Character.toUpperCase(s1.charAt(0)));
-            sb2.setCharAt(0, Character.toUpperCase(s2.charAt(0)));
-            assertEquals(sb1.toString(), sb2.toString());
-        } else {
-            assertEquals(s1, s2);
-        }
-    }
-}
+/*
+ *  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.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.condition.Os;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
+
+/**
+ * Tests for org.apache.tools.ant.util.FileUtils.
+ *
+ */
+public class FileUtilsTest {
+
+    private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
+    private File removeThis;
+    private String root;
+
+
+    @Before
+    public void setUp() {
+        // Windows adds the drive letter in uppercase, unless you run Cygwin
+        root = new File(File.separator).getAbsolutePath().toUpperCase();
+    }
+
+    @After
+    public void tearDown() {
+        if (removeThis != null && removeThis.exists()) {
+            if (!removeThis.delete())
+            {
+                removeThis.deleteOnExit();
+            }
+        }
+    }
+
+    /**
+     * test modification.
+     * Since Ant1.7, the method being tested no longer uses
+     * reflection to provide backwards support to Java1.1, so this
+     * test is not so critical. But it does explore file system
+     * behaviour and will help catch any regression in Java itself,
+     * so is worth retaining.
+     * @see FileUtils#setFileLastModified(java.io.File, long)
+     * @throws IOException
+     */
+    @Test
+    public void testSetLastModified() throws IOException {
+        removeThis = new File("dummy");
+        FileOutputStream fos = new FileOutputStream(removeThis);
+        fos.write(new byte[0]);
+        fos.close();
+        assumeTrue("Could not change file modified time", removeThis.setLastModified(removeThis.lastModified() - 2000));
+        long modTime = removeThis.lastModified();
+        assertTrue(modTime != 0);
+
+
+        FILE_UTILS.setFileLastModified(removeThis, -1);
+        long secondModTime = removeThis.lastModified();
+        assertTrue(secondModTime > modTime);
+
+        // number of milliseconds in a day
+        final int millisperday=24 * 3600 * 1000;
+        // in a previous version, the date of the file was set to 123456
+        // milliseconds since 01.01.1970
+        // it did not work on a computer running JDK 1.4.1_02 + Windows 2000
+        FILE_UTILS.setFileLastModified(removeThis, secondModTime + millisperday);
+        long thirdModTime = removeThis.lastModified();
+        /*
+         * I would love to compare this with 123456, but depending on
+         * the filesystems granularity it can take an arbitrary value.
+         *
+         * Just assert the time has changed.
+         */
+        assertTrue(thirdModTime != secondModTime);
+    }
+
+    @Test
+    public void testResolveFile() {
+        if (!(Os.isFamily("dos") || Os.isFamily("netware"))) {
+            /*
+             * Start with simple absolute file names.
+             */
+            assertEquals(File.separator,
+                         FILE_UTILS.resolveFile(null, "/").getPath());
+            assertEquals(File.separator,
+                         FILE_UTILS.resolveFile(null, "\\").getPath());
+        } else {
+            assertEqualsIgnoreDriveCase(localize(File.separator),
+                FILE_UTILS.resolveFile(null, "/").getPath());
+            assertEqualsIgnoreDriveCase(localize(File.separator),
+                FILE_UTILS.resolveFile(null, "\\").getPath());
+            /*
+             * throw in drive letters
+             */
+            String driveSpec = "C:";
+            assertEquals(driveSpec + "\\",
+                         FILE_UTILS.resolveFile(null, driveSpec + "/").getPath());
+            assertEquals(driveSpec + "\\",
+                         FILE_UTILS.resolveFile(null, driveSpec + "\\").getPath());
+            String driveSpecLower = "c:";
+            assertEquals(driveSpecLower + "\\",
+                         FILE_UTILS.resolveFile(null, driveSpecLower + "/").getPath());
+            assertEquals(driveSpecLower + "\\",
+                         FILE_UTILS.resolveFile(null, driveSpecLower + "\\").getPath());
+            /*
+             * promised to eliminate consecutive slashes after drive letter.
+             */
+            assertEquals(driveSpec + "\\",
+                         FILE_UTILS.resolveFile(null, driveSpec + "/////").getPath());
+            assertEquals(driveSpec + "\\",
+                         FILE_UTILS.resolveFile(null, driveSpec + "\\\\\\\\\\\\").getPath());
+        }
+        if (Os.isFamily("netware")) {
+            /*
+             * throw in NetWare volume names
+             */
+            String driveSpec = "SYS:";
+            assertEquals(driveSpec,
+                         FILE_UTILS.resolveFile(null, driveSpec + "/").getPath());
+            assertEquals(driveSpec,
+                         FILE_UTILS.resolveFile(null, driveSpec + "\\").getPath());
+            String driveSpecLower = "sys:";
+            assertEquals(driveSpec,
+                         FILE_UTILS.resolveFile(null, driveSpecLower + "/").getPath());
+            assertEquals(driveSpec,
+                         FILE_UTILS.resolveFile(null, driveSpecLower + "\\").getPath());
+            /*
+             * promised to eliminate consecutive slashes after drive letter.
+             */
+            assertEquals(driveSpec,
+                         FILE_UTILS.resolveFile(null, driveSpec + "/////").getPath());
+            assertEquals(driveSpec,
+                         FILE_UTILS.resolveFile(null, driveSpec + "\\\\\\\\\\\\").getPath());
+        } else if (!(Os.isFamily("dos"))) {
+            /*
+             * drive letters must be considered just normal filenames.
+             */
+            String driveSpec = "C:";
+            String udir = System.getProperty("user.dir");
+            assertEquals(udir + File.separator + driveSpec,
+                         FILE_UTILS.resolveFile(null, driveSpec + "/").getPath());
+            assertEquals(udir + File.separator + driveSpec,
+                         FILE_UTILS.resolveFile(null, driveSpec + "\\").getPath());
+            String driveSpecLower = "c:";
+            assertEquals(udir + File.separator + driveSpecLower,
+                         FILE_UTILS.resolveFile(null, driveSpecLower + "/").getPath());
+            assertEquals(udir + File.separator + driveSpecLower,
+                         FILE_UTILS.resolveFile(null, driveSpecLower + "\\").getPath());
+        }
+
+        /*
+         * Now test some relative file name magic.
+         */
+        assertEquals(localize("/1/2/3/4"),
+                     FILE_UTILS.resolveFile(new File(localize("/1/2/3")), "4").getPath());
+        assertEquals(localize("/1/2/3/4"),
+                     FILE_UTILS.resolveFile(new File(localize("/1/2/3")), "./4").getPath());
+        assertEquals(localize("/1/2/3/4"),
+                     FILE_UTILS.resolveFile(new File(localize("/1/2/3")), ".\\4").getPath());
+        assertEquals(localize("/1/2/3/4"),
+                     FILE_UTILS.resolveFile(new File(localize("/1/2/3")), "./.\\4").getPath());
+        assertEquals(localize("/1/2/3/4"),
+                     FILE_UTILS.resolveFile(new File(localize("/1/2/3")), "../3/4").getPath());
+        assertEquals(localize("/1/2/3/4"),
+                     FILE_UTILS.resolveFile(new File(localize("/1/2/3")), "..\\3\\4").getPath());
+        assertEquals(localize("/1/2/3/4"),
+                     FILE_UTILS.resolveFile(new File(localize("/1/2/3")), "../../5/.././2/./3/6/../4").getPath());
+        assertEquals(localize("/1/2/3/4"),
+                     FILE_UTILS.resolveFile(new File(localize("/1/2/3")), "..\\../5/..\\./2/./3/6\\../4").getPath());
+
+        assertEquals("meaningless result but no exception",
+                new File(localize("/1/../../b")),
+                FILE_UTILS.resolveFile(new File(localize("/1")), "../../b"));
+
+    }
+
+    @Test
+    public void testNormalize() {
+        if (!(Os.isFamily("dos") || Os.isFamily("netware"))) {
+            /*
+             * Start with simple absolute file names.
+             */
+            assertEquals(File.separator,
+                         FILE_UTILS.normalize("/").getPath());
+            assertEquals(File.separator,
+                         FILE_UTILS.normalize("\\").getPath());
+        } else {
+            try {
+                 FILE_UTILS.normalize("/").getPath();
+                 fail("normalized \"/\" on dos or netware");
+            } catch (Exception e) {
+            }
+            try {
+                 FILE_UTILS.normalize("\\").getPath();
+                 fail("normalized \"\\\" on dos or netware");
+            } catch (Exception e) {
+            }
+        }
+
+        if (Os.isFamily("dos")) {
+            /*
+             * throw in drive letters
+             */
+            String driveSpec = "C:";
+            try {
+                 FILE_UTILS.normalize(driveSpec).getPath();
+                 fail(driveSpec + " is not an absolute path");
+            } catch (Exception e) {
+            }
+            assertEquals(driveSpec + "\\",
+                         FILE_UTILS.normalize(driveSpec + "/").getPath());
+            assertEquals(driveSpec + "\\",
+                         FILE_UTILS.normalize(driveSpec + "\\").getPath());
+            String driveSpecLower = "c:";
+            assertEquals(driveSpecLower + "\\",
+                         FILE_UTILS.normalize(driveSpecLower + "/").getPath());
+            assertEquals(driveSpecLower + "\\",
+                         FILE_UTILS.normalize(driveSpecLower + "\\").getPath());
+            /*
+             * promised to eliminate consecutive slashes after drive letter.
+             */
+            assertEquals(driveSpec + "\\",
+                         FILE_UTILS.normalize(driveSpec + "/////").getPath());
+            assertEquals(driveSpec + "\\",
+                         FILE_UTILS.normalize(driveSpec + "\\\\\\\\\\\\").getPath());
+        } else if (Os.isFamily("netware")) {
+            /*
+             * throw in NetWare volume names
+             */
+            String driveSpec = "SYS:";
+            assertEquals(driveSpec,
+                         FILE_UTILS.normalize(driveSpec).getPath());
+            assertEquals(driveSpec,
+                         FILE_UTILS.normalize(driveSpec + "/").getPath());
+            assertEquals(driveSpec,
+                         FILE_UTILS.normalize(driveSpec + "\\").getPath());
+            String driveSpecLower = "sys:";
+            assertEquals(driveSpec,
+                         FILE_UTILS.normalize(driveSpecLower).getPath());
+            assertEquals(driveSpec,
+                         FILE_UTILS.normalize(driveSpecLower + "/").getPath());
+            assertEquals(driveSpec,
+                         FILE_UTILS.normalize(driveSpecLower + "\\").getPath());
+            assertEquals(driveSpec + "\\junk",
+                         FILE_UTILS.normalize(driveSpecLower + "\\junk").getPath());
+            /*
+             * promised to eliminate consecutive slashes after drive letter.
+             */
+            assertEquals(driveSpec,
+                         FILE_UTILS.normalize(driveSpec + "/////").getPath());
+            assertEquals(driveSpec,
+                         FILE_UTILS.normalize(driveSpec + "\\\\\\\\\\\\").getPath());
+        } else {
+            try {
+                String driveSpec = "C:";
+                assertEquals(driveSpec,
+                             FILE_UTILS.normalize(driveSpec).getPath());
+                fail("Expected failure, C: isn't an absolute path on other os's");
+            } catch (BuildException e) {
+                // Passed test
+            }
+        }
+
+        /*
+         * Now test some relative file name magic.
+         */
+        assertEquals(localize("/1/2/3/4"),
+                     FILE_UTILS.normalize(localize("/1/2/3/4")).getPath());
+        assertEquals(localize("/1/2/3/4"),
+                     FILE_UTILS.normalize(localize("/1/2/3/./4")).getPath());
+        assertEquals(localize("/1/2/3/4"),
+                     FILE_UTILS.normalize(localize("/1/2/3/.\\4")).getPath());
+        assertEquals(localize("/1/2/3/4"),
+                     FILE_UTILS.normalize(localize("/1/2/3/./.\\4")).getPath());
+        assertEquals(localize("/1/2/3/4"),
+                     FILE_UTILS.normalize(localize("/1/2/3/../3/4")).getPath());
+        assertEquals(localize("/1/2/3/4"),
+                     FILE_UTILS.normalize(localize("/1/2/3/..\\3\\4")).getPath());
+        assertEquals(localize("/1/2/3/4"),
+                     FILE_UTILS.normalize(localize("/1/2/3/../../5/.././2/./3/6/../4")).getPath());
+        assertEquals(localize("/1/2/3/4"),
+                     FILE_UTILS.normalize(localize("/1/2/3/..\\../5/..\\./2/./3/6\\../4")).getPath());
+
+        try {
+            FILE_UTILS.normalize("foo");
+            fail("foo is not an absolute path");
+        } catch (BuildException e) {
+            // Expected exception caught
+        }
+
+        assertEquals("will not go outside FS root (but will not throw an exception either)",
+                new File(localize("/1/../../b")),
+                FILE_UTILS.normalize(localize("/1/../../b")));
+    }
+
+    /**
+     * Test handling of null arguments.
+     */
+    @Test
+    public void testNullArgs() {
+        try {
+            FILE_UTILS.normalize(null);
+            fail("successfully normalized a null-file");
+        } catch (NullPointerException npe) {
+            // Expected exception caught
+        }
+
+        File f = FILE_UTILS.resolveFile(null, "a");
+        assertEquals(f, new File("a").getAbsoluteFile());
+    }
+
+
+    /**
+     * Test createTempFile
+     */
+    @Test
+    public void testCreateTempFile()
+    {
+        // null parent dir
+        File tmp1 = FILE_UTILS.createTempFile("pre", ".suf", null, false, true);
+        String tmploc = System.getProperty("java.io.tmpdir");
+        String name = tmp1.getName();
+        assertTrue("starts with pre", name.startsWith("pre"));
+        assertTrue("ends with .suf", name.endsWith(".suf"));
+        assertTrue("File was created", tmp1.exists());
+        assertEquals((new File(tmploc, tmp1.getName())).getAbsolutePath(), tmp1
+                .getAbsolutePath());
+        tmp1.delete();
+
+        File dir2 = new File(tmploc + "/ant-test");
+        dir2.mkdir();
+        removeThis = dir2;
+
+        File tmp2 = FILE_UTILS.createTempFile("pre", ".suf", dir2, true, true);
+        String name2 = tmp2.getName();
+        assertTrue("starts with pre", name2.startsWith("pre"));
+        assertTrue("ends with .suf", name2.endsWith(".suf"));
+        assertTrue("File was created", tmp2.exists());
+        assertEquals((new File(dir2, tmp2.getName())).getAbsolutePath(), tmp2
+                .getAbsolutePath());
+        tmp2.delete();
+        dir2.delete();
+
+        File parent = new File((new File("/tmp")).getAbsolutePath());
+        tmp1 = FILE_UTILS.createTempFile("pre", ".suf", parent, false);
+        assertTrue("new file", !tmp1.exists());
+
+        name = tmp1.getName();
+        assertTrue("starts with pre", name.startsWith("pre"));
+        assertTrue("ends with .suf", name.endsWith(".suf"));
+        assertEquals("is inside parent dir", parent.getAbsolutePath(), tmp1
+                .getParent());
+
+        tmp2 = FILE_UTILS.createTempFile("pre", ".suf", parent, false);
+        assertTrue("files are different", !tmp1.getAbsolutePath().equals(
+                tmp2.getAbsolutePath()));
+
+        // null parent dir
+        File tmp3 = FILE_UTILS.createTempFile("pre", ".suf", null, false);
+        tmploc = System.getProperty("java.io.tmpdir");
+        assertEquals((new File(tmploc, tmp3.getName())).getAbsolutePath(), tmp3
+                .getAbsolutePath());
+    }
+
+    /**
+     * Test contentEquals
+     */
+    @Test
+    public void testContentEquals() throws IOException {
+        assertTrue("Non existing files", FILE_UTILS.contentEquals(new File(System.getProperty("root"), "foo"),
+                                                          new File(System.getProperty("root"), "bar")));
+        assertTrue("One exists, the other one doesn\'t",
+                   !FILE_UTILS.contentEquals(new File(System.getProperty("root"), "foo"), new File(System.getProperty("root"), "build.xml")));
+        assertTrue("Don\'t compare directories",
+                   !FILE_UTILS.contentEquals(new File(System.getProperty("root"), "src"), new File(System.getProperty("root"), "src")));
+        assertTrue("File equals itself",
+                   FILE_UTILS.contentEquals(new File(System.getProperty("root"), "build.xml"),
+                                    new File(System.getProperty("root"), "build.xml")));
+        assertTrue("Files are different",
+                   !FILE_UTILS.contentEquals(new File(System.getProperty("root"), "build.xml"),
+                                     new File(System.getProperty("root"), "docs.xml")));
+    }
+
+    /**
+     * Test createNewFile
+     */
+    @Test
+    public void testCreateNewFile() throws IOException {
+        removeThis = new File("dummy");
+        assertTrue(!removeThis.exists());
+        FILE_UTILS.createNewFile(removeThis);
+        assertTrue(removeThis.exists());
+    }
+
+    /**
+     * Test removeLeadingPath.
+     */
+    @Test
+    public void testRemoveLeadingPath() {
+        assertEquals("bar", FILE_UTILS.removeLeadingPath(new File("/foo"),
+                                                 new File("/foo/bar")));
+        assertEquals("bar", FILE_UTILS.removeLeadingPath(new File("/foo/"),
+                                                 new File("/foo/bar")));
+        assertEquals("bar", FILE_UTILS.removeLeadingPath(new File("\\foo"),
+                                                 new File("\\foo\\bar")));
+        assertEquals("bar", FILE_UTILS.removeLeadingPath(new File("\\foo\\"),
+                                                 new File("\\foo\\bar")));
+        assertEquals("bar", FILE_UTILS.removeLeadingPath(new File("c:/foo"),
+                                                 new File("c:/foo/bar")));
+        assertEquals("bar", FILE_UTILS.removeLeadingPath(new File("c:/foo/"),
+                                                 new File("c:/foo/bar")));
+        assertEquals("bar", FILE_UTILS.removeLeadingPath(new File("c:\\foo"),
+                                                 new File("c:\\foo\\bar")));
+        assertEquals("bar", FILE_UTILS.removeLeadingPath(new File("c:\\foo\\"),
+                                                 new File("c:\\foo\\bar")));
+        if (!(Os.isFamily("dos") || Os.isFamily("netware"))) {
+            assertEquals(FILE_UTILS.normalize("/bar").getAbsolutePath(),
+                         FILE_UTILS.removeLeadingPath(new File("/foo"), new File("/bar")));
+            assertEquals(FILE_UTILS.normalize("/foobar").getAbsolutePath(),
+                         FILE_UTILS.removeLeadingPath(new File("/foo"), new File("/foobar")));
+        }
+        // bugzilla report 19979
+        assertEquals("", FILE_UTILS.removeLeadingPath(new File("/foo/bar"),
+                                              new File("/foo/bar")));
+        assertEquals("", FILE_UTILS.removeLeadingPath(new File("/foo/bar"),
+                                              new File("/foo/bar/")));
+        assertEquals("", FILE_UTILS.removeLeadingPath(new File("/foo/bar/"),
+                                              new File("/foo/bar/")));
+        assertEquals("", FILE_UTILS.removeLeadingPath(new File("/foo/bar/"),
+                                              new File("/foo/bar")));
+
+        String expected = "foo/bar".replace('\\', File.separatorChar)
+            .replace('/', File.separatorChar);
+        assertEquals(expected, FILE_UTILS.removeLeadingPath(new File("/"),
+                                                    new File("/foo/bar")));
+        assertEquals(expected, FILE_UTILS.removeLeadingPath(new File("c:/"),
+                                                    new File("c:/foo/bar")));
+        assertEquals(expected, FILE_UTILS.removeLeadingPath(new File("c:\\"),
+                                                    new File("c:\\foo\\bar")));
+    }
+
+    /**
+     * test toUri
+     */
+    @Test
+    public void testToURI() {
+        String dosRoot;
+        if (Os.isFamily("dos") || Os.isFamily("netware")) {
+            dosRoot = System.getProperty("user.dir")
+                .substring(0, 3).replace(File.separatorChar, '/');
+        }
+        else
+        {
+            dosRoot = "";
+        }
+        if (Os.isFamily("dos")) {
+            assertEquals("file:/c:/foo", removeExtraneousAuthority(FILE_UTILS.toURI("c:\\foo")));
+        }
+        if (Os.isFamily("netware")) {
+            assertEquals("file:/SYS:/foo", removeExtraneousAuthority(FILE_UTILS.toURI("sys:\\foo")));
+        }
+        if (File.pathSeparatorChar == '/') {
+            assertEquals("file:/foo", removeExtraneousAuthority(FILE_UTILS.toURI("/foo")));
+            assertTrue("file: URIs must name absolute paths", FILE_UTILS.toURI("./foo").startsWith("file:/"));
+            assertTrue(FILE_UTILS.toURI("./foo").endsWith("/foo"));
+            assertEquals("file:/" + dosRoot + "foo%20bar", removeExtraneousAuthority(FILE_UTILS.toURI("/foo bar")));
+            assertEquals("file:/" + dosRoot + "foo%23bar", removeExtraneousAuthority(FILE_UTILS.toURI("/foo#bar")));
+        } else if (File.pathSeparatorChar == '\\') {
+            assertEquals("file:/" + dosRoot + "foo", removeExtraneousAuthority(FILE_UTILS.toURI("\\foo")));
+            assertTrue("file: URIs must name absolute paths", FILE_UTILS.toURI(".\\foo").startsWith("file:/"));
+            assertTrue(FILE_UTILS.toURI(".\\foo").endsWith("/foo"));
+            assertEquals("file:/" + dosRoot + "foo%20bar", removeExtraneousAuthority(FILE_UTILS.toURI("\\foo bar")));
+            assertEquals("file:/" + dosRoot + "foo%23bar", removeExtraneousAuthority(FILE_UTILS.toURI("\\foo#bar")));
+        }
+        // a test with ant for germans
+        // the escaped character used for the test is the "a umlaut"
+        // this is the fix for the bug 37348
+        assertEquals("file:/" + dosRoot + "%C3%A4nt", removeExtraneousAuthority(FILE_UTILS.toURI("/\u00E4nt")));
+    }
+
+    /**
+     * Authority field is unnecessary, but harmless, in file: URIs.
+     * Java 1.4 does not produce it when using File.toURI.
+     */
+    private static String removeExtraneousAuthority(String uri) {
+        String prefix = "file:///";
+        if (uri.startsWith(prefix)) {
+            return "file:/" + uri.substring(prefix.length());
+        } else {
+            return uri;
+        }
+    }
+
+    @Test
+    public void testIsContextRelativePath() {
+        assumeTrue("Test only runs on DOS", Os.isFamily("dos"));
+        assertTrue(FileUtils.isContextRelativePath("/\u00E4nt"));
+        assertTrue(FileUtils.isContextRelativePath("\\foo"));
+    }
+
+    /**
+     * test fromUri
+     */
+    @Test
+    public void testFromURI() {
+        String dosRoot;
+        if (Os.isFamily("dos") || Os.isFamily("netware")) {
+            dosRoot = System.getProperty("user.dir").substring(0, 2);
+        } else {
+            dosRoot = "";
+        }
+        if (Os.isFamily("netware")) {
+            assertEqualsIgnoreDriveCase("SYS:\\foo", FILE_UTILS.fromURI("file:///sys:/foo"));
+        }
+        if (Os.isFamily("dos")) {
+            assertEqualsIgnoreDriveCase("C:\\foo", FILE_UTILS.fromURI("file:///c:/foo"));
+        }
+        assertEqualsIgnoreDriveCase(dosRoot + File.separator + "foo", FILE_UTILS.fromURI("file:///foo"));
+        assertEquals("." + File.separator + "foo",
+                     FILE_UTILS.fromURI("file:./foo"));
+        assertEquals(dosRoot + File.separator + "foo bar", FILE_UTILS.fromURI("file:///foo%20bar"));
+        assertEquals(dosRoot + File.separator + "foo#bar", FILE_UTILS.fromURI("file:///foo%23bar"));
+    }
+
+    @Test
+    public void testModificationTests() {
+
+        //get a time
+        long firstTime=System.currentTimeMillis();
+        //add some time. We assume no OS has a granularity this bad
+        long secondTime=firstTime+60000;
+/*
+        assertTrue("same timestamp is up to date",
+                fu.isUpToDate(firstTime, firstTime));
+                */
+
+        //check that older is up to date with a newer dest
+        assertTrue("older source files are up to date",
+                FILE_UTILS.isUpToDate(firstTime,secondTime));
+        //check that older is up to date with a newer dest
+        assertFalse("newer source files are no up to date",
+                FILE_UTILS.isUpToDate(secondTime, firstTime));
+
+        assertTrue("-1 dest timestamp implies nonexistence",
+                !FILE_UTILS.isUpToDate(firstTime,-1L));
+    }
+
+    @Test
+    public void testHasErrorInCase() {
+        File tempFolder = new File(System.getProperty("java.io.tmpdir"));
+        File wellcased = FILE_UTILS.createTempFile("alpha", "beta", tempFolder,
+                                                   true, true);
+        String s = wellcased.getName().toUpperCase();
+        File wrongcased = new File(tempFolder, s);
+        if (Os.isFamily("mac") && Os.isFamily("unix")) {
+            //no guarantees on filesystem case-sensitivity
+        } else if (Os.isFamily("dos")) {
+            assertTrue(FILE_UTILS.hasErrorInCase(wrongcased));
+            assertFalse(FILE_UTILS.hasErrorInCase(wellcased));
+        } else {
+            assertFalse(FILE_UTILS.hasErrorInCase(wrongcased));
+            assertFalse(FILE_UTILS.hasErrorInCase(wellcased));
+        }
+
+    }
+    public void testGetDefaultEncoding() {
+        // This just tests that the function does not blow up
+        FILE_UTILS.getDefaultEncoding();
+    }
+
+    /**
+     * adapt file separators to local conventions
+     */
+    private String localize(String path) {
+        path = root + path.substring(1);
+        return path.replace('\\', File.separatorChar).replace('/', File.separatorChar);
+    }
+
+    /**
+     * convenience method
+     * normalize brings the drive in uppercase
+     * the drive letter is in lower case under cygwin
+     * calling this method allows tests where normalize is called to pass under cygwin
+     */
+    private void assertEqualsIgnoreDriveCase(String s1, String s2) {
+        if ((Os.isFamily("dos") || Os.isFamily("netware"))
+            && s1.length() > 0 && s2.length() > 0) {
+            StringBuilder sb1 = new StringBuilder(s1);
+            StringBuilder sb2 = new StringBuilder(s2);
+            sb1.setCharAt(0, Character.toUpperCase(s1.charAt(0)));
+            sb2.setCharAt(0, Character.toUpperCase(s2.charAt(0)));
+            assertEquals(sb1.toString(), sb2.toString());
+        } else {
+            assertEquals(s1, s2);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/GlobPatternMapperTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/GlobPatternMapperTest.java b/src/tests/junit/org/apache/tools/ant/util/GlobPatternMapperTest.java
index 25af0e1..5bd7db6 100644
--- a/src/tests/junit/org/apache/tools/ant/util/GlobPatternMapperTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/GlobPatternMapperTest.java
@@ -1,102 +1,102 @@
-/*
- *  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 org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-/**
- * Tests for org.apache.tools.ant.util;GlobPatternMapper.
- *
- */
-public class GlobPatternMapperTest {
-
-    @Test
-    public void testNoPatternAtAll() {
-        GlobPatternMapper m = new GlobPatternMapper();
-        m.setFrom("foobar");
-        m.setTo("baz");
-        assertNull("Shouldn\'t match foobar", m.mapFileName("plonk"));
-        String[] result = m.mapFileName("foobar");
-        assertNotNull("Should match foobar", result);
-        assertEquals("only one result for foobar", 1, result.length);
-        assertEquals("baz", result[0]);
-    }
-
-    @Test
-    public void testPostfixOnly() {
-        GlobPatternMapper m = new GlobPatternMapper();
-        m.setFrom("*foo");
-        m.setTo("*plonk");
-        assertNull("Shouldn\'t match *foo", m.mapFileName("bar.baz"));
-        String[] result = m.mapFileName("bar.foo");
-        assertNotNull("Should match *.foo", result);
-        assertEquals("only one result for bar.foo", 1, result.length);
-        assertEquals("bar.plonk", result[0]);
-
-        // Try a silly case
-        m.setTo("foo*");
-        result = m.mapFileName("bar.foo");
-        assertEquals("foobar.", result[0]);
-    }
-
-    @Test
-    public void testPrefixOnly() {
-        GlobPatternMapper m = new GlobPatternMapper();
-        m.setFrom("foo*");
-        m.setTo("plonk*");
-        assertNull("Shouldn\'t match foo*", m.mapFileName("bar.baz"));
-        String[] result = m.mapFileName("foo.bar");
-        assertNotNull("Should match foo*", result);
-        assertEquals("only one result for foo.bar", 1, result.length);
-        assertEquals("plonk.bar", result[0]);
-
-        // Try a silly case
-        m.setTo("*foo");
-        result = m.mapFileName("foo.bar");
-        assertEquals(".barfoo", result[0]);
-    }
-
-    @Test
-    public void testPreAndPostfix() {
-        GlobPatternMapper m = new GlobPatternMapper();
-        m.setFrom("foo*bar");
-        m.setTo("plonk*pling");
-        assertNull("Shouldn\'t match foo*bar", m.mapFileName("bar.baz"));
-        String[] result = m.mapFileName("foo.bar");
-        assertNotNull("Should match foo*bar", result);
-        assertEquals("only one result for foo.bar", 1, result.length);
-        assertEquals("plonk.pling", result[0]);
-
-        // and a little longer
-        result = m.mapFileName("foo.baz.bar");
-        assertNotNull("Should match foo*bar", result);
-        assertEquals("only one result for foo.baz.bar", 1, result.length);
-        assertEquals("plonk.baz.pling", result[0]);
-
-        // and a little shorter
-        result = m.mapFileName("foobar");
-        assertNotNull("Should match foo*bar", result);
-        assertEquals("only one result for foobar", 1, result.length);
-        assertEquals("plonkpling", result[0]);
-    }
-}
+/*
+ *  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 org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+/**
+ * Tests for org.apache.tools.ant.util;GlobPatternMapper.
+ *
+ */
+public class GlobPatternMapperTest {
+
+    @Test
+    public void testNoPatternAtAll() {
+        GlobPatternMapper m = new GlobPatternMapper();
+        m.setFrom("foobar");
+        m.setTo("baz");
+        assertNull("Shouldn\'t match foobar", m.mapFileName("plonk"));
+        String[] result = m.mapFileName("foobar");
+        assertNotNull("Should match foobar", result);
+        assertEquals("only one result for foobar", 1, result.length);
+        assertEquals("baz", result[0]);
+    }
+
+    @Test
+    public void testPostfixOnly() {
+        GlobPatternMapper m = new GlobPatternMapper();
+        m.setFrom("*foo");
+        m.setTo("*plonk");
+        assertNull("Shouldn\'t match *foo", m.mapFileName("bar.baz"));
+        String[] result = m.mapFileName("bar.foo");
+        assertNotNull("Should match *.foo", result);
+        assertEquals("only one result for bar.foo", 1, result.length);
+        assertEquals("bar.plonk", result[0]);
+
+        // Try a silly case
+        m.setTo("foo*");
+        result = m.mapFileName("bar.foo");
+        assertEquals("foobar.", result[0]);
+    }
+
+    @Test
+    public void testPrefixOnly() {
+        GlobPatternMapper m = new GlobPatternMapper();
+        m.setFrom("foo*");
+        m.setTo("plonk*");
+        assertNull("Shouldn\'t match foo*", m.mapFileName("bar.baz"));
+        String[] result = m.mapFileName("foo.bar");
+        assertNotNull("Should match foo*", result);
+        assertEquals("only one result for foo.bar", 1, result.length);
+        assertEquals("plonk.bar", result[0]);
+
+        // Try a silly case
+        m.setTo("*foo");
+        result = m.mapFileName("foo.bar");
+        assertEquals(".barfoo", result[0]);
+    }
+
+    @Test
+    public void testPreAndPostfix() {
+        GlobPatternMapper m = new GlobPatternMapper();
+        m.setFrom("foo*bar");
+        m.setTo("plonk*pling");
+        assertNull("Shouldn\'t match foo*bar", m.mapFileName("bar.baz"));
+        String[] result = m.mapFileName("foo.bar");
+        assertNotNull("Should match foo*bar", result);
+        assertEquals("only one result for foo.bar", 1, result.length);
+        assertEquals("plonk.pling", result[0]);
+
+        // and a little longer
+        result = m.mapFileName("foo.baz.bar");
+        assertNotNull("Should match foo*bar", result);
+        assertEquals("only one result for foo.baz.bar", 1, result.length);
+        assertEquals("plonk.baz.pling", result[0]);
+
+        // and a little shorter
+        result = m.mapFileName("foobar");
+        assertNotNull("Should match foo*bar", result);
+        assertEquals("only one result for foobar", 1, result.length);
+        assertEquals("plonkpling", result[0]);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/JAXPUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/JAXPUtilsTest.java b/src/tests/junit/org/apache/tools/ant/util/JAXPUtilsTest.java
index f21be8a..105c33d 100644
--- a/src/tests/junit/org/apache/tools/ant/util/JAXPUtilsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/JAXPUtilsTest.java
@@ -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.util;
-
-import org.junit.Test;
-
-import java.io.File;
-
-import static org.junit.Assert.assertTrue;
-
-/**
- * JAXPUtils test case
- */
-public class JAXPUtilsTest {
-
-    @Test
-    public void testGetSystemId(){
-        File file = null;
-        if ( File.separatorChar == '\\' ){
-            file = new File("d:\\jdk");
-        } else {
-            file = new File("/user/local/bin");
-        }
-        String systemid = JAXPUtils.getSystemId(file);
-        assertTrue("SystemIDs should start by file:/", systemid.startsWith("file:/"));
-        assertTrue("SystemIDs should not start with file:////", !systemid.startsWith("file:////"));
-    }
-}
+/*
+ *  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 org.junit.Test;
+
+import java.io.File;
+
+import static org.junit.Assert.assertTrue;
+
+/**
+ * JAXPUtils test case
+ */
+public class JAXPUtilsTest {
+
+    @Test
+    public void testGetSystemId(){
+        File file = null;
+        if ( File.separatorChar == '\\' ){
+            file = new File("d:\\jdk");
+        } else {
+            file = new File("/user/local/bin");
+        }
+        String systemid = JAXPUtils.getSystemId(file);
+        assertTrue("SystemIDs should start by file:/", systemid.startsWith("file:/"));
+        assertTrue("SystemIDs should not start with file:////", !systemid.startsWith("file:////"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java b/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java
index e27cc4d..a07daf2 100644
--- a/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java
@@ -137,7 +137,7 @@ public class JavaEnvUtilsTest {
                 "Current java version is not at least the current java version...",
                 JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.getJavaVersion()));
     }
-  
+
     @Test
     public void isJavaVersionSupportsBothVersionsOfJava9() {
         assumeTrue(JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_9));


[21/21] ant git commit: Normalise tabulation and line breaks

Posted by gi...@apache.org.
Normalise tabulation and line breaks

Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/4422804d
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/4422804d
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/4422804d

Branch: refs/heads/master
Commit: 4422804db35d3659ba85f39dfbbce1896031fcbb
Parents: 2c39081
Author: twogee <g....@gmail.com>
Authored: Wed Nov 29 17:18:48 2017 +0100
Committer: twogee <g....@gmail.com>
Committed: Wed Nov 29 17:18:48 2017 +0100

----------------------------------------------------------------------
 .../taskdefs/manifestclasspath/Alpha.java       |   32 +-
 .../taskdefs/manifestclasspath/Beta.java        |   36 +-
 .../types/assertions/AssertionMain.java         |   14 +-
 .../types/assertions/AssertionTest.java         |   48 +-
 src/main/org/apache/tools/ant/Target.java       |    4 +-
 .../tools/ant/taskdefs/optional/NetRexxC.java   |    2 +-
 .../optional/junit/IgnoredTestResult.java       |    2 +-
 .../optional/junit/JUnitVersionHelper.java      |    8 +-
 .../org/apache/tools/ant/types/Resource.java    |    2 +-
 .../tools/ant/types/ResourceCollection.java     |   66 +-
 .../BaseResourceCollectionWrapper.java          |    2 +-
 .../org/apache/tools/ant/util/JavaEnvUtils.java |    2 +-
 .../core/location/src/task/EchoLocation.java    |   34 +-
 .../junit/org/apache/tools/ant/AntAssert.java   |   20 +-
 .../apache/tools/ant/AntClassLoaderTest.java    |    8 +-
 .../org/apache/tools/ant/BuildFileRule.java     |    7 +-
 .../junit/org/apache/tools/ant/CaseTest.java    |   19 +-
 .../apache/tools/ant/DirectoryScannerTest.java  |   16 +-
 .../org/apache/tools/ant/DispatchTaskTest.java  |   10 +-
 .../org/apache/tools/ant/ExecutorTest.java      |   11 +-
 .../apache/tools/ant/ExtendedTaskdefTest.java   |   32 +-
 .../junit/org/apache/tools/ant/IncludeTest.java |    6 +-
 .../org/apache/tools/ant/LoaderRefTest.java     |   23 +-
 .../tools/ant/filters/TokenFilterTest.java      |   68 +-
 .../apache/tools/ant/taskdefs/DirnameTest.java  |   42 +-
 .../apache/tools/ant/taskdefs/ExecTaskTest.java |    8 +-
 .../org/apache/tools/ant/taskdefs/GzipTest.java |   42 +-
 .../apache/tools/ant/taskdefs/ImportTest.java   |   24 +-
 .../org/apache/tools/ant/taskdefs/JarTest.java  |   52 +-
 .../apache/tools/ant/taskdefs/LoadFileTest.java |   34 +-
 .../apache/tools/ant/taskdefs/MacroDefTest.java |   71 +-
 .../apache/tools/ant/taskdefs/MakeUrlTest.java  |   40 +-
 .../ant/taskdefs/ManifestClassPathTest.java     |  126 +-
 .../apache/tools/ant/taskdefs/MkdirTest.java    |   20 +-
 .../org/apache/tools/ant/taskdefs/NiceTest.java |   20 +-
 .../tools/ant/taskdefs/PreSetDefTest.java       |   27 +-
 .../apache/tools/ant/taskdefs/PropertyTest.java |   34 +-
 .../apache/tools/ant/taskdefs/ReplaceTest.java  |   62 +-
 .../apache/tools/ant/taskdefs/SleepTest.java    |    7 +-
 .../apache/tools/ant/taskdefs/TStampTest.java   |    2 +-
 .../org/apache/tools/ant/taskdefs/TarTest.java  |   60 +-
 .../apache/tools/ant/taskdefs/TaskdefTest.java  |   46 +-
 .../tools/ant/taskdefs/TypeAdapterTest.java     |   10 +-
 .../apache/tools/ant/taskdefs/TypedefTest.java  |   70 +-
 .../apache/tools/ant/taskdefs/UnzipTest.java    |   40 +-
 .../apache/tools/ant/taskdefs/UpToDateTest.java |    8 +-
 .../apache/tools/ant/taskdefs/XmlnsTest.java    |   11 +-
 .../org/apache/tools/ant/taskdefs/ZipTest.java  |   48 +-
 .../tools/ant/taskdefs/email/MessageTest.java   |  124 +-
 .../tools/ant/taskdefs/optional/ANTLRTest.java  |  432 ++--
 .../optional/AbstractXSLTLiaisonTest.java       |  208 +-
 .../taskdefs/optional/BeanShellScriptTest.java  |   96 +-
 .../taskdefs/optional/EchoPropertiesTest.java   |  531 +++--
 .../tools/ant/taskdefs/optional/JavahTest.java  |  120 +-
 .../tools/ant/taskdefs/optional/JspcTest.java   |  399 ++--
 .../ant/taskdefs/optional/Native2AsciiTest.java |  114 +-
 .../ant/taskdefs/optional/PropertyFileTest.java |  470 ++--
 .../tools/ant/taskdefs/optional/PvcsTest.java   |  158 +-
 .../taskdefs/optional/ReplaceRegExpTest.java    |  264 +--
 .../taskdefs/optional/RhinoReferenceTest.java   |   90 +-
 .../tools/ant/taskdefs/optional/RpmTest.java    |  142 +-
 .../taskdefs/optional/SchemaValidateTest.java   |  256 +--
 .../optional/XmlValidateCatalogTest.java        |  142 +-
 .../ant/taskdefs/optional/XmlValidateTest.java  |  386 ++--
 .../tools/ant/taskdefs/optional/XsltTest.java   |  171 +-
 .../taskdefs/optional/depend/DependTest.java    |  426 ++--
 .../taskdefs/optional/i18n/TranslateTest.java   |  173 +-
 .../ant/taskdefs/optional/image/ImageTest.java  |  265 ++-
 .../taskdefs/optional/jdepend/JDependTest.java  |  198 +-
 .../taskdefs/optional/junit/BatchTestTest.java  |  242 +-
 .../taskdefs/optional/junit/DOMUtilTest.java    |  106 +-
 .../optional/junit/JUnitClassLoaderTest.java    |   74 +-
 .../taskdefs/optional/junit/JUnitTaskTest.java  |   62 +-
 .../optional/junit/JUnitTestListenerTest.java   |  222 +-
 .../optional/junit/JUnitTestRunnerTest.java     |   21 +-
 .../optional/junit/JUnitVersionHelperTest.java  |  204 +-
 .../ant/taskdefs/optional/junit/NoVmCrash.java  |   60 +-
 .../ant/taskdefs/optional/junit/Printer.java    |   84 +-
 .../ant/taskdefs/optional/junit/Sleeper.java    |   60 +-
 .../optional/junit/SuiteMethodTest.java         |   84 +-
 .../optional/junit/TearDownOnVmCrashTest.java   |  106 +-
 .../taskdefs/optional/junit/TestFormatter.java  |  224 +-
 .../ant/taskdefs/optional/junit/VmCrash.java    |   62 +-
 .../junit/XMLFormatterWithCDATAOnSystemOut.java |  166 +-
 .../optional/junit/XMLResultAggregatorTest.java |  186 +-
 .../ant/taskdefs/optional/net/FTPTest.java      | 1758 +++++++--------
 .../ant/taskdefs/optional/sos/SOSTest.java      |  702 +++---
 .../optional/splash/SplashScreenTest.java       |   99 +-
 .../ant/taskdefs/optional/unix/SymlinkTest.java |  594 ++---
 .../ant/taskdefs/optional/vss/MSVSSTest.java    |  950 ++++----
 .../tools/ant/types/AbstractFileSetTest.java    |  496 ++--
 .../org/apache/tools/ant/types/AddTypeTest.java |  446 ++--
 .../apache/tools/ant/types/AssertionsTest.java  |  248 +-
 .../tools/ant/types/CommandlineJavaTest.java    |  382 ++--
 .../apache/tools/ant/types/CommandlineTest.java |  360 +--
 .../apache/tools/ant/types/DescriptionTest.java |  118 +-
 .../org/apache/tools/ant/types/DirSetTest.java  |  188 +-
 .../ant/types/EnumeratedAttributeTest.java      |  212 +-
 .../apache/tools/ant/types/FileListTest.java    |  326 +--
 .../org/apache/tools/ant/types/FileSetTest.java |   72 +-
 .../apache/tools/ant/types/FilterSetTest.java   |  478 ++--
 .../apache/tools/ant/types/FlexIntegerTest.java |  148 +-
 .../org/apache/tools/ant/types/MapperTest.java  |  470 ++--
 .../org/apache/tools/ant/types/PathTest.java    | 1158 +++++-----
 .../apache/tools/ant/types/PatternSetTest.java  |  412 ++--
 .../apache/tools/ant/types/PermissionsTest.java |  316 +--
 .../org/apache/tools/ant/types/PolyTest.java    |  158 +-
 .../tools/ant/types/RedirectorElementTest.java  |  172 +-
 .../tools/ant/types/ResourceOutputTest.java     |  320 +--
 .../apache/tools/ant/types/TarFileSetTest.java  |  238 +-
 .../ant/types/XMLCatalogBuildFileTest.java      |  196 +-
 .../apache/tools/ant/types/XMLCatalogTest.java  |  784 +++----
 .../apache/tools/ant/types/ZipFileSetTest.java  |  236 +-
 .../tools/ant/types/mappers/GlobMapperTest.java |   96 +-
 .../tools/ant/types/mappers/MapperResult.java   |  206 +-
 .../types/mappers/RegexpPatternMapperTest.java  |  100 +-
 .../ant/types/optional/ScriptMapperTest.java    |  106 +-
 .../ant/types/optional/ScriptSelectorTest.java  |  166 +-
 .../types/optional/depend/ClassFileSetTest.java |  372 +--
 .../ant/types/resources/FileResourceTest.java   |  274 +--
 .../ant/types/resources/JavaResourceTest.java   |  124 +-
 .../types/resources/MultiRootFileSetTest.java   |  262 +--
 .../ant/types/resources/ResourceListTest.java   |  268 +--
 .../ant/types/resources/TarResourceTest.java    |  108 +-
 .../ant/types/selectors/BaseSelectorRule.java   |  250 +--
 .../ant/types/selectors/BaseSelectorTest.java   |  590 ++---
 .../ant/types/selectors/ContainsRegexpTest.java |  111 +-
 .../types/selectors/ContainsSelectorTest.java   |  228 +-
 .../ant/types/selectors/DependSelectorTest.java |  370 +--
 .../ant/types/selectors/DepthSelectorTest.java  |  294 +--
 .../types/selectors/FilenameSelectorTest.java   |  230 +-
 .../ant/types/selectors/MockAlgorithm.java      |   74 +-
 .../tools/ant/types/selectors/MockCache.java    |  136 +-
 .../ant/types/selectors/MockComparator.java     |   64 +-
 .../types/selectors/ModifiedSelectorTest.java   | 2124 +++++++++---------
 .../types/selectors/PresentSelectorTest.java    |  274 +--
 .../ant/types/selectors/SignedSelectorTest.java |  108 +-
 .../ant/types/selectors/SizeSelectorTest.java   |  474 ++--
 .../types/selectors/TokenizedPatternTest.java   |  154 +-
 .../ant/types/selectors/TypeSelectorTest.java   |  162 +-
 .../tools/ant/util/Base64ConverterTest.java     |   86 +-
 .../tools/ant/util/ClasspathUtilsTest.java      |  134 +-
 .../tools/ant/util/CollectionUtilsTest.java     |  204 +-
 .../tools/ant/util/DOMElementWriterTest.java    |  610 ++---
 .../apache/tools/ant/util/DeweyDecimalTest.java |  140 +-
 .../apache/tools/ant/util/FileUtilsTest.java    | 1250 +++++------
 .../tools/ant/util/GlobPatternMapperTest.java   |  204 +-
 .../apache/tools/ant/util/JAXPUtilsTest.java    |   86 +-
 .../apache/tools/ant/util/JavaEnvUtilsTest.java |    2 +-
 .../util/LayoutPreservingPropertiesTest.java    |  632 +++---
 .../ant/util/LazyFileOutputStreamTest.java      |  150 +-
 .../ant/util/LineOrientedOutputStreamTest.java  |  306 +--
 .../tools/ant/util/LinkedHashtableTest.java     |  330 +--
 .../apache/tools/ant/util/LoaderUtilsTest.java  |   86 +-
 .../tools/ant/util/PackageNameMapperTest.java   |   86 +-
 .../tools/ant/util/ReaderInputStreamTest.java   |  284 +--
 .../tools/ant/util/ResourceUtilsTest.java       |  126 +-
 .../apache/tools/ant/util/SymlinkUtilsTest.java |   80 +-
 .../tools/ant/util/UnPackageNameMapperTest.java |   84 +-
 .../apache/tools/ant/util/UnicodeUtilTest.java  |   66 +-
 .../apache/tools/ant/util/VectorSetTest.java    |  590 ++---
 .../apache/tools/ant/util/XMLFragmentTest.java  |  182 +-
 .../ant/util/facade/FacadeTaskHelperTest.java   |  128 +-
 .../ImplementationSpecificArgumentTest.java     |  118 +-
 .../ant/util/regexp/JakartaOroMatcherTest.java  |   70 +-
 .../ant/util/regexp/JakartaOroRegexpTest.java   |   70 +-
 .../util/regexp/JakartaRegexpMatcherTest.java   |  126 +-
 .../util/regexp/JakartaRegexpRegexpTest.java    |  124 +-
 .../ant/util/regexp/Jdk14RegexpMatcherTest.java |  140 +-
 .../ant/util/regexp/Jdk14RegexpRegexpTest.java  |  142 +-
 .../ant/util/regexp/RegexpMatcherTest.java      |  408 ++--
 .../tools/ant/util/regexp/RegexpTest.java       |  126 +-
 .../org/apache/tools/bzip2/BlockSortTest.java   |  342 +--
 .../apache/tools/bzip2/CBZip2StreamTest.java    |   94 +-
 .../org/apache/tools/mail/MailMessageTest.java  | 1414 ++++++------
 .../org/apache/tools/tar/TarEntryTest.java      |   70 +-
 .../apache/tools/tar/TarOutputStreamTest.java   |   70 +-
 .../org/apache/tools/tar/TarRoundTripTest.java  |  146 +-
 .../org/apache/tools/zip/AsiExtraFieldTest.java |  326 +--
 .../apache/tools/zip/ExtraFieldUtilsTest.java   |  420 ++--
 .../org/apache/tools/zip/UTF8ZipFilesTest.java  |  519 +++--
 .../org/apache/tools/zip/ZipEncodingTest.java   |  304 +--
 .../org/apache/tools/zip/ZipEntryTest.java      |  456 ++--
 .../junit/org/apache/tools/zip/ZipLongTest.java |  188 +-
 .../apache/tools/zip/ZipOutputStreamTest.java   |  146 +-
 .../org/apache/tools/zip/ZipShortTest.java      |  184 +-
 .../example/junit/AbstractJUnit3TestMissed.java |   54 +-
 .../junit/AbstractJUnit3TestNotMissed.java      |   62 +-
 .../org/example/junit/AbstractTestMissed.java   |   58 +-
 .../example/junit/AbstractTestNotMissed.java    |   64 +-
 .../org/example/junit/JUnit3NonTestMissed.java  |   54 +-
 .../org/example/junit/JUnit3TestNotMissed.java  |   56 +-
 .../org/example/junit/JUnit4Skippable.java      |  148 +-
 .../org/example/junit/MultilineAsserts.java     |   54 +-
 .../junit/org/example/junit/NonTestMissed.java  |   50 +-
 src/tests/junit/org/example/junit/Output.java   |   74 +-
 .../junit/org/example/junit/TestNotMissed.java  |   58 +-
 .../example/junit/TestWithSuiteNotMissed.java   |   64 +-
 .../junit/org/example/junit/ThreadedOutput.java |   86 +-
 src/tests/junit/org/example/junit/Timeout.java  |   64 +-
 .../junit/org/example/junit/XmlParserTest.java  |  116 +-
 .../example/tasks/TaskdefTestContainerTask.java |   50 +-
 .../example/tasks/TaskdefTestSimpleTask.java    |   89 +-
 .../org/example/types/TypedefTestType.java      |   49 +-
 204 files changed, 20669 insertions(+), 20696 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/etc/testcases/taskdefs/manifestclasspath/Alpha.java
----------------------------------------------------------------------
diff --git a/src/etc/testcases/taskdefs/manifestclasspath/Alpha.java b/src/etc/testcases/taskdefs/manifestclasspath/Alpha.java
index 96124d5..9f00a93 100644
--- a/src/etc/testcases/taskdefs/manifestclasspath/Alpha.java
+++ b/src/etc/testcases/taskdefs/manifestclasspath/Alpha.java
@@ -1,21 +1,21 @@
 /*
-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.
-*/
+ * 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.
+ */
 public class Alpha {
     public String toString() {
-	return "alpha";
+        return "alpha";
     }
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/etc/testcases/taskdefs/manifestclasspath/Beta.java
----------------------------------------------------------------------
diff --git a/src/etc/testcases/taskdefs/manifestclasspath/Beta.java b/src/etc/testcases/taskdefs/manifestclasspath/Beta.java
index c1b446f..7ffeffe 100644
--- a/src/etc/testcases/taskdefs/manifestclasspath/Beta.java
+++ b/src/etc/testcases/taskdefs/manifestclasspath/Beta.java
@@ -1,25 +1,25 @@
 /*
-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.
-*/
+ * 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.
+ */
 public class Beta extends Alpha {
     public String toString() {
-	return "beta " + super.toString();
+        return "beta " + super.toString();
     }
     public static void main(String [] args) {
-	Beta myBeta = new Beta();
-	System.out.println(myBeta.toString());
+        Beta myBeta = new Beta();
+        System.out.println(myBeta.toString());
     }
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/etc/testcases/types/assertions/AssertionMain.java
----------------------------------------------------------------------
diff --git a/src/etc/testcases/types/assertions/AssertionMain.java b/src/etc/testcases/types/assertions/AssertionMain.java
index f4aa690..bc8853b 100644
--- a/src/etc/testcases/types/assertions/AssertionMain.java
+++ b/src/etc/testcases/types/assertions/AssertionMain.java
@@ -1,4 +1,4 @@
-/* 
+/*
  *  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.
@@ -13,19 +13,19 @@
  *  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.
- * 
+ *
  */
- 
+
 
 /**
  * this is an assertion tester
  * It has a main() entry
  */
 public class AssertionMain {
-    
+
     public static void main(String args[]) {
-		assert true == false : "there exist no facts that are both true and false";
-		System.out.println("Assertions are disabled");
+        assert true == false : "there exist no facts that are both true and false";
+        System.out.println("Assertions are disabled");
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/etc/testcases/types/assertions/AssertionTest.java
----------------------------------------------------------------------
diff --git a/src/etc/testcases/types/assertions/AssertionTest.java b/src/etc/testcases/types/assertions/AssertionTest.java
index 19ed2df..28a9dc3 100644
--- a/src/etc/testcases/types/assertions/AssertionTest.java
+++ b/src/etc/testcases/types/assertions/AssertionTest.java
@@ -1,4 +1,4 @@
-/* 
+/*
  *  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.
@@ -13,33 +13,33 @@
  *  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.
- * 
+ *
  */
- 
+
  import junit.framework.TestCase;
 
 /**
- * this is an assertion tester for junit 
+ * this is an assertion tester for junit
  */
 public class AssertionTest extends TestCase {
-    
-	public AssertionTest(String name) {
-		super(name);
-	}
-	
-	public void testAssertRaised() {
-		try {
-			assert true == false;
-			fail("expected an assertion");
-		} catch(AssertionError asserto) {
-			//if we got here, all was well
-		}
-	}
-	
-	
-	public void testAssertNotRaised() {
-		assert(2+2==4);
-	}
-	
-    
+
+    public AssertionTest(String name) {
+        super(name);
+    }
+
+    public void testAssertRaised() {
+        try {
+            assert true == false;
+            fail("expected an assertion");
+        } catch(AssertionError asserto) {
+            //if we got here, all was well
+        }
+    }
+
+
+    public void testAssertNotRaised() {
+        assert(2+2==4);
+    }
+
+
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/main/org/apache/tools/ant/Target.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/Target.java b/src/main/org/apache/tools/ant/Target.java
index dba7e25..d48d971 100644
--- a/src/main/org/apache/tools/ant/Target.java
+++ b/src/main/org/apache/tools/ant/Target.java
@@ -437,8 +437,8 @@ public class Target implements TaskContainer {
         try {
             // use index-based approach to avoid ConcurrentModificationExceptions;
             // also account for growing target children
-        	// do not optimize this loop by replacing children.size() by a variable
-        	// as children can be added dynamically as in RhinoScriptTest where a target is adding work for itself
+            // do not optimize this loop by replacing children.size() by a variable
+            // as children can be added dynamically as in RhinoScriptTest where a target is adding work for itself
             for (int i = 0; i < children.size(); i++) {
                 Object o = children.get(i);
                 if (o instanceof Task) {

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java b/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
index 070feb4..c3bd97b 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
@@ -709,7 +709,7 @@ public class NetRexxC extends MatchingTask {
                     filecopyList.put(srcFile.getAbsolutePath(), destFile.getAbsolutePath());
                     compileList.addElement(destFile.getAbsolutePath());
                 } else if (compile && srcFile.lastModified() > classFile.lastModified()) {
-                	// compile case tests against .class file
+                    // compile case tests against .class file
                     filecopyList.put(srcFile.getAbsolutePath(), destFile.getAbsolutePath());
                     compileList.addElement(destFile.getAbsolutePath());
                 }

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/main/org/apache/tools/ant/taskdefs/optional/junit/IgnoredTestResult.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/IgnoredTestResult.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/IgnoredTestResult.java
index ef51fff..3488338 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/IgnoredTestResult.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/IgnoredTestResult.java
@@ -84,7 +84,7 @@ public class IgnoredTestResult extends TestResult {
      * @param cause the details of the test and assumption failure.
      */
     public void testAssumptionFailure(Test test, Throwable cause) {
-    	skipped.add(new TestIgnored(test));
+        skipped.add(new TestIgnored(test));
         for (IgnoredTestListener listener : listeners) {
             listener.testAssumptionFailure(test, cause);
         }

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelper.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelper.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelper.java
index 5ac988e..c214681 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelper.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelper.java
@@ -142,10 +142,10 @@ public class JUnitVersionHelper {
             Class<?> junit4FacadeClass = Class.forName("junit.framework.JUnit4TestCaseFacade");
             if (test != null && test.getClass().isAssignableFrom(junit4FacadeClass)) {
             //try and get the message coded as part of the ignore
-        	/*
-        	 * org.junit.runner.Description contains a getAnnotation(Class) method... but this
-        	 * wasn't in older versions of JUnit4 so we have to try and do this by reflection
-        	 */
+            /*
+             * org.junit.runner.Description contains a getAnnotation(Class) method... but this
+             * wasn't in older versions of JUnit4 so we have to try and do this by reflection
+             */
                 Class<?> testClass = Class.forName(JUnitVersionHelper.getTestCaseClassName(test));
 
                 Method testMethod = testClass.getMethod(JUnitVersionHelper.getTestCaseName(test));

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/main/org/apache/tools/ant/types/Resource.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/Resource.java b/src/main/org/apache/tools/ant/types/Resource.java
index 39ad7f8..abeb83f 100644
--- a/src/main/org/apache/tools/ant/types/Resource.java
+++ b/src/main/org/apache/tools/ant/types/Resource.java
@@ -445,7 +445,7 @@ public class Resource extends DataType implements Comparable<Resource>, Resource
      * @since Ant 1.10.2
      */
     public <T> Optional<T> asOptional(Class<T> clazz) {
-    	return Optional.ofNullable(as(clazz));
+        return Optional.ofNullable(as(clazz));
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/main/org/apache/tools/ant/types/ResourceCollection.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/ResourceCollection.java b/src/main/org/apache/tools/ant/types/ResourceCollection.java
index cb17b71..85af5c9 100644
--- a/src/main/org/apache/tools/ant/types/ResourceCollection.java
+++ b/src/main/org/apache/tools/ant/types/ResourceCollection.java
@@ -22,40 +22,40 @@ import java.util.stream.Stream;
  */
 public interface ResourceCollection extends Iterable<Resource> {
 
-	/**
-	 * Learn the number of contained Resources.
-	 *
-	 * @return number of elements as int.
-	 */
-	int size();
+    /**
+     * Learn the number of contained Resources.
+     *
+     * @return number of elements as int.
+     */
+    int size();
 
-	/**
-	 * Indicate whether this ResourceCollection is composed entirely of
-	 * Resources accessible via local filesystem conventions. If true, all
-	 * resources returned from this collection should respond with a
-	 * {@link org.apache.tools.ant.types.resources.FileProvider} when asked via
-	 * {@link Resource#as}.
-	 *
-	 * @return whether this is a filesystem-only resource collection.
-	 */
-	boolean isFilesystemOnly();
+    /**
+     * Indicate whether this ResourceCollection is composed entirely of
+     * Resources accessible via local filesystem conventions. If true, all
+     * resources returned from this collection should respond with a
+     * {@link org.apache.tools.ant.types.resources.FileProvider} when asked via
+     * {@link Resource#as}.
+     *
+     * @return whether this is a filesystem-only resource collection.
+     */
+    boolean isFilesystemOnly();
 
-	/**
-	 * Return a {@link Stream} over this {@link ResourceCollection}.
-	 * @return {@link Stream} of {@link Resource}
-	 * @since Ant 1.10.2
-	 */
-	default Stream<? extends Resource> stream() {
-		final Stream.Builder<Resource> b = Stream.builder();
-		forEach(b);
-		return b.build();
-	}
+    /**
+     * Return a {@link Stream} over this {@link ResourceCollection}.
+     * @return {@link Stream} of {@link Resource}
+     * @since Ant 1.10.2
+     */
+    default Stream<? extends Resource> stream() {
+        final Stream.Builder<Resource> b = Stream.builder();
+        forEach(b);
+        return b.build();
+    }
 
-	/**
-	 * Learn whether this {@link ResourceCollection} is empty.
-	 * @return boolean
-	 */
-	default boolean isEmpty() {
-	    return size() == 0;
-	}
+    /**
+     * Learn whether this {@link ResourceCollection} is empty.
+     * @return boolean
+     */
+    default boolean isEmpty() {
+        return size() == 0;
+    }
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionWrapper.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionWrapper.java b/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionWrapper.java
index 0bec29f..66f292b 100644
--- a/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionWrapper.java
+++ b/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionWrapper.java
@@ -38,7 +38,7 @@ public abstract class BaseResourceCollectionWrapper
     }
 
     @Override
-	protected int getSize() {
+    protected int getSize() {
         return cacheCollection().size();
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/main/org/apache/tools/ant/util/JavaEnvUtils.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/JavaEnvUtils.java b/src/main/org/apache/tools/ant/util/JavaEnvUtils.java
index ea21b6b..e24a647 100644
--- a/src/main/org/apache/tools/ant/util/JavaEnvUtils.java
+++ b/src/main/org/apache/tools/ant/util/JavaEnvUtils.java
@@ -518,7 +518,7 @@ public final class JavaEnvUtils {
             case VERSION_1_4:
                 tests.addElement("sun.audio.AudioPlayer");
                 if (javaVersionNumber == VERSION_1_4) {
-                	// only for 1.4, not for higher versions which fall through
+                    // only for 1.4, not for higher versions which fall through
                     tests.addElement("org.apache.crimson.parser.ContentModel");
                     tests.addElement("org.apache.xalan.processor.ProcessorImport");
                     tests.addElement("org.apache.xml.utils.URI");

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/antunit/core/location/src/task/EchoLocation.java
----------------------------------------------------------------------
diff --git a/src/tests/antunit/core/location/src/task/EchoLocation.java b/src/tests/antunit/core/location/src/task/EchoLocation.java
index 0143145..a2031e6 100644
--- a/src/tests/antunit/core/location/src/task/EchoLocation.java
+++ b/src/tests/antunit/core/location/src/task/EchoLocation.java
@@ -1,26 +1,26 @@
 /*
-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.
-*/
+ * 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 task;
 
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.Task;
 
 public class EchoLocation extends Task {
-	public void execute() {
+    public void execute() {
         log("Line: " + getLocation().getLineNumber(), Project.MSG_INFO);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/AntAssert.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/AntAssert.java b/src/tests/junit/org/apache/tools/ant/AntAssert.java
index 7771924..5bc3caa 100644
--- a/src/tests/junit/org/apache/tools/ant/AntAssert.java
+++ b/src/tests/junit/org/apache/tools/ant/AntAssert.java
@@ -32,10 +32,10 @@ public class AntAssert {
      * @param needle the string to search for.
      * @param haystack the string to search in.
      */
-	public static void assertContains(String message, String needle, String haystack) {
-		String formattedMessage = (message == null ? "" : message + " ");
-		assertTrue(formattedMessage + String.format("expected message containing: <%s> but got: <%s>", needle, haystack), haystack.contains(needle));
-	}
+    public static void assertContains(String message, String needle, String haystack) {
+        String formattedMessage = (message == null ? "" : message + " ");
+        assertTrue(formattedMessage + String.format("expected message containing: <%s> but got: <%s>", needle, haystack), haystack.contains(needle));
+    }
 
     /**
      * Assert that a string contains the given substring. A default failure message will be used if the target string
@@ -43,9 +43,9 @@ public class AntAssert {
      * @param needle the target string to search for.
      * @param haystack the string to search in.
      */
-	public static void assertContains(String needle, String haystack) {
-		assertContains("", needle, haystack);
-	}
+    public static void assertContains(String needle, String haystack) {
+        assertContains("", needle, haystack);
+    }
 
     /**
      * Assert that a string does not contain the given substring.
@@ -54,8 +54,8 @@ public class AntAssert {
      * @param haystack the string to search in.
      */
     public static void assertNotContains(String message, String needle, String haystack) {
-    	String formattedMessage = (message == null ? "" : message + " ");
-    	assertFalse(formattedMessage + String.format("expected message not to contain: <%s> but got: <%s>", needle, haystack), haystack.contains(needle));
+        String formattedMessage = (message == null ? "" : message + " ");
+        assertFalse(formattedMessage + String.format("expected message not to contain: <%s> but got: <%s>", needle, haystack), haystack.contains(needle));
     }
 
     /**
@@ -67,6 +67,6 @@ public class AntAssert {
     public static void assertNotContains(String needle, String haystack) {
         assertNotContains("", needle, haystack);
     }
-	
+
 
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/AntClassLoaderTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/AntClassLoaderTest.java b/src/tests/junit/org/apache/tools/ant/AntClassLoaderTest.java
index 568cbc1..17c418a 100644
--- a/src/tests/junit/org/apache/tools/ant/AntClassLoaderTest.java
+++ b/src/tests/junit/org/apache/tools/ant/AntClassLoaderTest.java
@@ -44,7 +44,7 @@ import org.junit.Test;
  *
  */
 public class AntClassLoaderTest {
-	
+
     @Rule
     public BuildFileRule buildRule = new BuildFileRule();
 
@@ -62,7 +62,7 @@ public class AntClassLoaderTest {
             loader.cleanup();
         }
     }
-    
+
     //test inspired by bug report 37085
     @Test
     public void testJarWithManifestInDirWithSpace() {
@@ -75,7 +75,7 @@ public class AntClassLoaderTest {
         String path = loader.getClasspath();
         assertEquals(mainjarstring + File.pathSeparator + extjarstring, path);
     }
-    
+
     @Test
     public void testJarWithManifestInNonAsciiDir() {
         String mainjarstring = buildRule.getProject().getProperty("main.jar.nonascii");
@@ -87,7 +87,7 @@ public class AntClassLoaderTest {
         String path = loader.getClasspath();
         assertEquals(mainjarstring + File.pathSeparator + extjarstring, path);
     }
-    
+
     @Test
     public void testCleanup() throws BuildException {
         Path path = new Path(buildRule.getProject(), ".");

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/BuildFileRule.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/BuildFileRule.java b/src/tests/junit/org/apache/tools/ant/BuildFileRule.java
index b4e00fd..05f7d8e 100644
--- a/src/tests/junit/org/apache/tools/ant/BuildFileRule.java
+++ b/src/tests/junit/org/apache/tools/ant/BuildFileRule.java
@@ -61,14 +61,14 @@ import org.junit.rules.ExternalResource;
  */
 public class BuildFileRule extends ExternalResource {
 
-	private Project project;
+    private Project project;
 
     private StringBuffer logBuffer;
     private StringBuffer fullLogBuffer;
     private StringBuffer outputBuffer;
     private StringBuffer errorBuffer;
 
-   
+
 
     /**
      * Tidies up following a test execution. If the currently configured
@@ -313,6 +313,5 @@ public class BuildFileRule extends ExternalResource {
     public File getOutputDir() {
         return new File(getProject().getProperty("output"));
     }
-    
-}
 
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/CaseTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/CaseTest.java b/src/tests/junit/org/apache/tools/ant/CaseTest.java
index 81cf385..04f60be 100644
--- a/src/tests/junit/org/apache/tools/ant/CaseTest.java
+++ b/src/tests/junit/org/apache/tools/ant/CaseTest.java
@@ -29,9 +29,9 @@ import static org.junit.Assert.fail;
  * Simple tests of build file processing
  */
 public class CaseTest {
-	
-	@Rule
-	public BuildFileRule buildRule = new BuildFileRule();
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
 
     @Before
     public void setUp() {
@@ -53,12 +53,11 @@ public class CaseTest {
      */
     @Test
     public void testTaskCase() {
-    	try {
-    		buildRule.executeTarget("taskcase");
-    		fail("Build exception should have been thrown due to case sensitivity of name");
-    	} catch(BuildException ex) {
-    		assertContains("Task names should be case sensitive", "Problem: failed to create task or type ecHO", ex.getMessage());
-    	}
+        try {
+            buildRule.executeTarget("taskcase");
+            fail("Build exception should have been thrown due to case sensitivity of name");
+        } catch(BuildException ex) {
+            assertContains("Task names should be case sensitive", "Problem: failed to create task or type ecHO", ex.getMessage());
+        }
     }
 }
-

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/DirectoryScannerTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/DirectoryScannerTest.java b/src/tests/junit/org/apache/tools/ant/DirectoryScannerTest.java
index c0c25fd..baf0b20 100644
--- a/src/tests/junit/org/apache/tools/ant/DirectoryScannerTest.java
+++ b/src/tests/junit/org/apache/tools/ant/DirectoryScannerTest.java
@@ -44,9 +44,9 @@ import org.junit.Test;
  */
 public class DirectoryScannerTest {
 
-	@Rule
-	public BuildFileRule buildRule = new BuildFileRule();
-	
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
     // keep track of what operating systems are supported here.
     private boolean supportsSymlinks = Os.isFamily("unix");
 
@@ -121,8 +121,8 @@ public class DirectoryScannerTest {
 
     @Test
     public void testAllowSymlinks() {
-        
-    	assumeTrue("Current system does not support Symlinks", supportsSymlinks);
+
+        assumeTrue("Current system does not support Symlinks", supportsSymlinks);
 
         buildRule.getProject().executeTarget("symlink-setup");
         DirectoryScanner ds = new DirectoryScanner();
@@ -135,7 +135,7 @@ public class DirectoryScannerTest {
 
     @Test
     public void testProhibitSymlinks() {
-    	assumeTrue("Current system does not support Symlinks", supportsSymlinks);
+        assumeTrue("Current system does not support Symlinks", supportsSymlinks);
 
 
         buildRule.getProject().executeTarget("symlink-setup");
@@ -244,14 +244,14 @@ public class DirectoryScannerTest {
      * Only supports test on Linux at the moment because Java has
      * no real notion of symlinks built in, so an os-specfic call
      * to Runtime.exec() must be made to create a link to test against.
-     * @throws InterruptedException 
+     * @throws InterruptedException
      */
     @Test
     public void testSetFollowLinks() throws IOException, InterruptedException {
         if (supportsSymlinks) {
             File linkFile = new File(System.getProperty("root"), "src/main/org/apache/tools/ThisIsALink");
             System.err.println("link exists pre-test? " + linkFile.exists());
-            
+
             try {
                 // add conditions and more commands as soon as the need arises
                 String[] command = new String[] {

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/DispatchTaskTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/DispatchTaskTest.java b/src/tests/junit/org/apache/tools/ant/DispatchTaskTest.java
index 604a0a2..c682093 100644
--- a/src/tests/junit/org/apache/tools/ant/DispatchTaskTest.java
+++ b/src/tests/junit/org/apache/tools/ant/DispatchTaskTest.java
@@ -26,8 +26,8 @@ import org.junit.Test;
 
 public class DispatchTaskTest {
 
-	@Rule
-	public BuildFileRule buildRule = new BuildFileRule();
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
 
     @Before
     public void setUp() {
@@ -37,10 +37,10 @@ public class DispatchTaskTest {
     @Test
     public void testDisp() {
         try {
-        	buildRule.executeTarget("disp");
-        	fail("BuildException should have been thrown");
+            buildRule.executeTarget("disp");
+            fail("BuildException should have been thrown");
         } catch(BuildException ex) {
-        	//FIXME the previous method used here ignored the build exception - what are we trying to test
+            //FIXME the previous method used here ignored the build exception - what are we trying to test
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/ExecutorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/ExecutorTest.java b/src/tests/junit/org/apache/tools/ant/ExecutorTest.java
index 6a37093..80ec96f 100644
--- a/src/tests/junit/org/apache/tools/ant/ExecutorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/ExecutorTest.java
@@ -31,22 +31,22 @@ import org.junit.Test;
  * Executor tests
  */
 public class ExecutorTest implements BuildListener  {
-    
-	private static final String SINGLE_CHECK
+
+    private static final String SINGLE_CHECK
         = "org.apache.tools.ant.helper.SingleCheckExecutor";
     private static final String IGNORE_DEPS
         = "org.apache.tools.ant.helper.IgnoreDependenciesExecutor";
-    
+
     private static final Vector<String> TARGET_NAMES;
     static {
         TARGET_NAMES = new Vector<String>();
         TARGET_NAMES.add("a");
         TARGET_NAMES.add("b");
     }
-    
+
     @Rule
     public BuildFileRule buildRule = new BuildFileRule();
-    
+
     private int targetCount;
 
     /* BuildListener stuff */
@@ -168,4 +168,3 @@ public class ExecutorTest implements BuildListener  {
     }
 
 }
-

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/ExtendedTaskdefTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/ExtendedTaskdefTest.java b/src/tests/junit/org/apache/tools/ant/ExtendedTaskdefTest.java
index a141241..7c8ef75 100644
--- a/src/tests/junit/org/apache/tools/ant/ExtendedTaskdefTest.java
+++ b/src/tests/junit/org/apache/tools/ant/ExtendedTaskdefTest.java
@@ -32,10 +32,10 @@ import org.junit.Test;
 
 public class ExtendedTaskdefTest {
 
-	@Rule
-	public BuildFileRule buildRule = new BuildFileRule();
-	
-	@Before
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
     public void setUp() {
         buildRule.configureProject("src/etc/testcases/core/extended-taskdef.xml");
     }
@@ -47,22 +47,22 @@ public class ExtendedTaskdefTest {
 
     @Test
     public void testRun() throws Exception {
-    	try {
-    		buildRule.executeTarget("testRun");
-    		fail("BuildException should have been thrown");
-    	} catch(BuildException ex) {
-    		assertContains("exception thrown by the subclass", "executing the Foo task", ex.getMessage());
-    	}
+        try {
+            buildRule.executeTarget("testRun");
+            fail("BuildException should have been thrown");
+        } catch(BuildException ex) {
+            assertContains("exception thrown by the subclass", "executing the Foo task", ex.getMessage());
+        }
     }
 
     @Test
     public void testRun2() throws Exception {
-    	try {
-    		buildRule.executeTarget("testRun2");
-    		fail("BuildException should have been thrown");
-    	} catch(BuildException ex) {
-    		assertContains("exception thrown by the subclass", "executing the Foo task", ex.getMessage());
-    	}
+        try {
+            buildRule.executeTarget("testRun2");
+            fail("BuildException should have been thrown");
+        } catch(BuildException ex) {
+            assertContains("exception thrown by the subclass", "executing the Foo task", ex.getMessage());
+        }
     }
 
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/IncludeTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/IncludeTest.java b/src/tests/junit/org/apache/tools/ant/IncludeTest.java
index 54e61a4..80e53fe 100644
--- a/src/tests/junit/org/apache/tools/ant/IncludeTest.java
+++ b/src/tests/junit/org/apache/tools/ant/IncludeTest.java
@@ -31,9 +31,9 @@ import org.junit.Test;
  *
  */
 public class IncludeTest {
-	
-	@Rule
-	public BuildFileRule buildRule = new BuildFileRule();
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
 
     @Test
     public void test1() {

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/LoaderRefTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/LoaderRefTest.java b/src/tests/junit/org/apache/tools/ant/LoaderRefTest.java
index 2fb7439..668170b 100644
--- a/src/tests/junit/org/apache/tools/ant/LoaderRefTest.java
+++ b/src/tests/junit/org/apache/tools/ant/LoaderRefTest.java
@@ -29,10 +29,10 @@ import org.junit.Test;
  */
 public class LoaderRefTest {
 
-	@Rule
-	public BuildFileRule buildRule = new BuildFileRule();
-	
-	@Before
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
     public void setUp() {
         buildRule.configureProject("src/etc/testcases/core/loaderref/loaderref.xml");
         buildRule.executeTarget("setUp");
@@ -40,13 +40,12 @@ public class LoaderRefTest {
 
     // override allowed on <available>
     @Test
-	public void testBadRef() {
-    	try {
-    		buildRule.executeTarget("testbadref");
-    		fail("BuildRule should have thrown an exception due to a bad classloader being specified");
-    	} catch (BuildException ex) {
-    		assertContains("Should fail due to ref not being a class loader", "does not reference a class loader", ex.getMessage());
-    	}
+    public void testBadRef() {
+        try {
+            buildRule.executeTarget("testbadref");
+            fail("BuildRule should have thrown an exception due to a bad classloader being specified");
+        } catch (BuildException ex) {
+            assertContains("Should fail due to ref not being a class loader", "does not reference a class loader", ex.getMessage());
+        }
     }
 }
-

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/filters/TokenFilterTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/filters/TokenFilterTest.java b/src/tests/junit/org/apache/tools/ant/filters/TokenFilterTest.java
index f0db15a..daa7f2e 100644
--- a/src/tests/junit/org/apache/tools/ant/filters/TokenFilterTest.java
+++ b/src/tests/junit/org/apache/tools/ant/filters/TokenFilterTest.java
@@ -37,12 +37,12 @@ import org.junit.Test;
 /**
  */
 public class TokenFilterTest {
-	
-	@Rule
-	public BuildFileRule buildRule = new BuildFileRule();
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
 
     private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
-    
+
     @Before
     public void setUp() {
         buildRule.configureProject("src/etc/testcases/filters/tokenfilter.xml");
@@ -57,20 +57,20 @@ public class TokenFilterTest {
 
     @Test
     public void testTrimignore() throws IOException {
-    	buildRule.executeTarget("trimignore");
-    	assertContains("Hello-World", buildRule.getLog());
+        buildRule.executeTarget("trimignore");
+        assertContains("Hello-World", buildRule.getLog());
     }
 
     @Test
     public void testStringTokenizer() throws IOException {
-    	buildRule.executeTarget("stringtokenizer");
+        buildRule.executeTarget("stringtokenizer");
         assertContains("#This#is#a#number#of#words#", buildRule.getLog());
     }
 
     @Test
     public void testUnixLineOutput() throws IOException {
-    	buildRule.executeTarget("unixlineoutput");
-    	assertContains("\nThis\nis\na\nnumber\nof\nwords\n",
+        buildRule.executeTarget("unixlineoutput");
+        assertContains("\nThis\nis\na\nnumber\nof\nwords\n",
                 getFileString(buildRule.getProject().getProperty("output") + "/unixlineoutput"));
     }
 
@@ -84,7 +84,7 @@ public class TokenFilterTest {
 
     @Test
     public void testFileTokenizer() throws IOException {
-    	buildRule.executeTarget("filetokenizer");
+        buildRule.executeTarget("filetokenizer");
         String contents = getFileString(buildRule.getProject().getProperty("output") + "/filetokenizer");
         assertContains("   of words", contents);
         assertNotContains(" This is", contents);
@@ -92,20 +92,20 @@ public class TokenFilterTest {
 
     @Test
     public void testReplaceString() throws IOException {
-    	buildRule.executeTarget("replacestring");
-    	assertContains("this is the moon",
+        buildRule.executeTarget("replacestring");
+        assertContains("this is the moon",
                 getFileString(buildRule.getProject().getProperty("output") + "/replacestring"));
     }
 
     @Test
     public void testReplaceStrings() throws IOException {
-    	buildRule.executeTarget("replacestrings");
-    	assertContains("bar bar bar", buildRule.getLog());
+        buildRule.executeTarget("replacestrings");
+        assertContains("bar bar bar", buildRule.getLog());
     }
 
     @Test
     public void testContainsString() throws IOException {
-    	buildRule.executeTarget("containsstring");
+        buildRule.executeTarget("containsstring");
         String contents = getFileString(buildRule.getProject().getProperty("output") + "/containsstring");
         assertContains("this is a line contains foo", contents);
         assertNotContains("this line does not", contents);
@@ -114,7 +114,7 @@ public class TokenFilterTest {
     @Test
     public void testReplaceRegex() throws IOException {
 
-    	buildRule.executeTarget("hasregex");
+        buildRule.executeTarget("hasregex");
         Assume.assumeTrue("Regex not present",
                 getFileString(buildRule.getProject().getProperty("output") + "/replaceregexp").contains("bye world"));
 
@@ -130,7 +130,7 @@ public class TokenFilterTest {
 
     @Test
     public void testFilterReplaceRegex() throws IOException {
-    	buildRule.executeTarget("hasregex");
+        buildRule.executeTarget("hasregex");
         Assume.assumeTrue("Regex not present",
                 getFileString(buildRule.getProject().getProperty("output") + "/replaceregexp").contains("bye world"));
 
@@ -142,7 +142,7 @@ public class TokenFilterTest {
 
     @Test
     public void testHandleDollerMatch() throws IOException {
-    	buildRule.executeTarget("hasregex");
+        buildRule.executeTarget("hasregex");
         Assume.assumeTrue("Regex not present", getFileString(buildRule.getProject().getProperty("output") + "/replaceregexp").contains("bye world"));
 
         buildRule.executeTarget("dollermatch");
@@ -150,7 +150,7 @@ public class TokenFilterTest {
 
     @Test
     public void testTrimFile() throws IOException {
-    	buildRule.executeTarget("trimfile");
+        buildRule.executeTarget("trimfile");
         String contents = getFileString(buildRule.getProject().getProperty("output") + "/trimfile");
         assertTrue("no ws at start", contents.startsWith("This is th"));
         assertTrue("no ws at end", contents.endsWith("second line."));
@@ -159,7 +159,7 @@ public class TokenFilterTest {
 
     @Test
     public void testTrimFileByLine() throws IOException {
-    	buildRule.executeTarget("trimfilebyline");
+        buildRule.executeTarget("trimfilebyline");
         String contents = getFileString(buildRule.getProject().getProperty("output") + "/trimfilebyline");
         assertFalse("no ws at start", contents.startsWith("This is th"));
         assertFalse("no ws at end", contents.endsWith("second line."));
@@ -169,20 +169,20 @@ public class TokenFilterTest {
 
     @Test
     public void testFilterReplaceString() throws IOException {
-    	buildRule.executeTarget("filterreplacestring");
+        buildRule.executeTarget("filterreplacestring");
         String contents = getFileString(buildRule.getProject().getProperty("output") + "/filterreplacestring");
         assertContains("This is the moon", contents);
     }
 
     @Test
     public void testFilterReplaceStrings() throws IOException {
-    	buildRule.executeTarget("filterreplacestrings");
-    	assertContains("bar bar bar", buildRule.getLog());
+        buildRule.executeTarget("filterreplacestrings");
+        assertContains("bar bar bar", buildRule.getLog());
     }
 
     @Test
     public void testContainsRegex() throws IOException {
-    	buildRule.executeTarget("hasregex");
+        buildRule.executeTarget("hasregex");
         Assume.assumeTrue("Regex not present", getFileString(buildRule.getProject().getProperty("output") + "/replaceregexp").contains("bye world"));
 
         //expectFileContains(buildRule.getProject().getProperty("output") + "/replaceregexp", "bye world");
@@ -196,7 +196,7 @@ public class TokenFilterTest {
 
     @Test
     public void testFilterContainsRegex() throws IOException {
-    	buildRule.executeTarget("hasregex");
+        buildRule.executeTarget("hasregex");
         Assume.assumeTrue("Regex not present", getFileString(buildRule.getProject().getProperty("output") + "/replaceregexp").contains("bye world"));
 
         buildRule.executeTarget("filtercontainsregex");
@@ -208,9 +208,9 @@ public class TokenFilterTest {
 
     @Test
     public void testContainsRegex2() throws IOException {
-    	buildRule.executeTarget("hasregex");
+        buildRule.executeTarget("hasregex");
         Assume.assumeTrue("Regex not present", getFileString(buildRule.getProject().getProperty("output") + "/replaceregexp").contains("bye world"));
-        
+
         buildRule.executeTarget("containsregex2");
         String contents = getFileString(buildRule.getProject().getProperty("output") + "/containsregex2");
         assertContains("void register_bits();", contents);
@@ -218,7 +218,7 @@ public class TokenFilterTest {
 
     @Test
     public void testDeleteCharacters() throws IOException {
-    	buildRule.executeTarget("deletecharacters");
+        buildRule.executeTarget("deletecharacters");
         String contents = getFileString(buildRule.getProject().getProperty("output") + "/deletechars");
         assertNotContains("#", contents);
         assertNotContains("*", contents);
@@ -227,24 +227,24 @@ public class TokenFilterTest {
 
     @Test
     public void testScriptFilter() throws IOException {
-    	Assume.assumeTrue("Project does not have 'testScriptFilter' target",
+        Assume.assumeTrue("Project does not have 'testScriptFilter' target",
                 buildRule.getProject().getTargets().contains("testScriptFilter"));
-    	buildRule.executeTarget("scriptfilter");
-    	assertContains("HELLO WORLD", getFileString(buildRule.getProject().getProperty("output") + "/scriptfilter"));
+        buildRule.executeTarget("scriptfilter");
+        assertContains("HELLO WORLD", getFileString(buildRule.getProject().getProperty("output") + "/scriptfilter"));
 
     }
 
     @Test
     public void testScriptFilter2() throws IOException {
-    	Assume.assumeTrue("Project does not have 'testScriptFilter' target", buildRule.getProject().getTargets().contains("testScriptFilter"));
+        Assume.assumeTrue("Project does not have 'testScriptFilter' target", buildRule.getProject().getTargets().contains("testScriptFilter"));
         buildRule.executeTarget("scriptfilter2");
-    	assertContains("HELLO MOON", getFileString(buildRule.getProject().getProperty("output") + "/scriptfilter2"));
+        assertContains("HELLO MOON", getFileString(buildRule.getProject().getProperty("output") + "/scriptfilter2"));
     }
 
     @Test
     public void testCustomTokenFilter() throws IOException {
         buildRule.executeTarget("customtokenfilter");
-    	assertContains("Hello World", getFileString(buildRule.getProject().getProperty("output") + "/custom"));
+        assertContains("Hello World", getFileString(buildRule.getProject().getProperty("output") + "/custom"));
     }
 
     // ------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/DirnameTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/DirnameTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/DirnameTest.java
index 96c6c4a..8db1c5f 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/DirnameTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/DirnameTest.java
@@ -32,9 +32,9 @@ import org.junit.Test;
 /**
  */
 public class DirnameTest {
-	
-	@Rule
-	public BuildFileRule buildRule = new BuildFileRule();
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
 
     @Before
     public void setUp() {
@@ -43,32 +43,32 @@ public class DirnameTest {
 
     @Test
     public void test1() {
-    	try {
-        	buildRule.executeTarget("test1");
-        	fail("Build exception should have been thrown as property attribute is required");
-    	} catch(BuildException ex) {
-    		assertEquals("property attribute required", ex.getMessage());
-    	}
+        try {
+            buildRule.executeTarget("test1");
+            fail("Build exception should have been thrown as property attribute is required");
+        } catch(BuildException ex) {
+            assertEquals("property attribute required", ex.getMessage());
+        }
     }
 
     @Test
     public void test2() {
-    	try {
-        	buildRule.executeTarget("test2");
-        	fail("Build exception should have been thrown as file attribute is required");
-    	} catch(BuildException ex) {
-    		assertEquals("file attribute required", ex.getMessage());
-    	}
+        try {
+            buildRule.executeTarget("test2");
+            fail("Build exception should have been thrown as file attribute is required");
+        } catch(BuildException ex) {
+            assertEquals("file attribute required", ex.getMessage());
+        }
     }
 
     @Test
     public void test3() {
-    	try {
-        	buildRule.executeTarget("test3");
-        	fail("Build exception should have been thrown as property attribute is required");
-    	} catch(BuildException ex) {
-    		assertEquals("property attribute required", ex.getMessage());
-    	}
+        try {
+            buildRule.executeTarget("test3");
+            fail("Build exception should have been thrown as property attribute is required");
+        } catch(BuildException ex) {
+            assertEquals("property attribute required", ex.getMessage());
+        }
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/ExecTaskTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ExecTaskTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ExecTaskTest.java
index b742760..faa830f 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ExecTaskTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ExecTaskTest.java
@@ -39,10 +39,10 @@ import org.junit.Test;
  * Unit test for the &lt;exec&gt; task.
  */
 public class ExecTaskTest {
-	
-	@Rule
-	public BuildFileRule buildRule = new BuildFileRule();
-	
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
     private static final String BUILD_PATH = "src/etc/testcases/taskdefs/exec/";
     private static final String BUILD_FILE = BUILD_PATH + "exec.xml";
     private static final int TIME_TO_WAIT = 1;

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/GzipTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/GzipTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/GzipTest.java
index 00ea063..6319317 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/GzipTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/GzipTest.java
@@ -31,7 +31,7 @@ import static org.junit.Assert.fail;
 /**
  */
 public class GzipTest {
-    
+
     @Rule
     public final BuildFileRule buildRule = new BuildFileRule();
 
@@ -44,41 +44,41 @@ public class GzipTest {
     @Test
     public void test1() {
         try {
-			buildRule.executeTarget("test1");
-			fail("BuildException expected: required argument missing");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test1");
+            fail("BuildException expected: required argument missing");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
     public void test2() {
         try {
-			buildRule.executeTarget("test2");
-			fail("BuildException expected: required argument missing");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test2");
+            fail("BuildException expected: required argument missing");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
     public void test3() {
         try {
-			buildRule.executeTarget("test3");
-			fail("BuildException expected: required argument missing");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test3");
+            fail("BuildException expected: required argument missing");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
     public void test4() {
         try {
-			buildRule.executeTarget("test4");
-			fail("BuildException expected: zipfile must not point to a directory");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test4");
+            fail("BuildException expected: zipfile must not point to a directory");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/ImportTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ImportTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ImportTest.java
index e64d6f8..5fdf8a4 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ImportTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ImportTest.java
@@ -39,16 +39,16 @@ import org.junit.Test;
 
 public class ImportTest {
 
-	@Rule
-	public BuildFileRule buildRule = new BuildFileRule();
-	
-	@Test
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Test
     public void testSimpleImport() {
         buildRule.configureProject("src/etc/testcases/taskdefs/import/import.xml");
         assertContains("Before importIn imported topAfter import", buildRule.getLog());
     }
 
-	@Test
+    @Test
     public void testUnnamedNesting() {
         buildRule.configureProject("src/etc/testcases/taskdefs/import/unnamedImport.xml",
                          Project.MSG_WARN);
@@ -57,17 +57,17 @@ public class ImportTest {
                     log.length() == 0);
     }
 
-	@Test
+    @Test
     public void testSerial() {
         buildRule.configureProject("src/etc/testcases/taskdefs/import/subdir/serial.xml");
         assertContains("Unnamed2.xmlUnnamed1.xml", buildRule.getLog());
         assertContains("Expected string was not found in log",
-        		"Skipped already imported file", buildRule.getFullLog());
+                "Skipped already imported file", buildRule.getFullLog());
     }
 
     // allow this as imported in targets are only tested when a target is run
     @Test
-	public void testImportInTargetNoEffect() {
+    public void testImportInTargetNoEffect() {
         buildRule.configureProject("src/etc/testcases/taskdefs/import/subdir/importintarget.xml");
         buildRule.executeTarget("no-import");
         assertNull(buildRule.getProject().getProperty("foo"));
@@ -88,10 +88,10 @@ public class ImportTest {
         buildRule.configureProject(
             "src/etc/testcases/taskdefs/import/subdir/importintarget.xml");
         try {
-        	buildRule.executeTarget("do-import");
-        	fail("Build exception should have been thrown as import only allowed in top level task");
+            buildRule.executeTarget("do-import");
+            fail("Build exception should have been thrown as import only allowed in top level task");
         } catch(BuildException ex) {
-        	assertContains( "not a top level task", "import only allowed as a top-level task", ex.getMessage());
+            assertContains( "not a top level task", "import only allowed as a top-level task", ex.getMessage());
         }
     }
 
@@ -111,7 +111,7 @@ public class ImportTest {
                 "src/etc/testcases/taskdefs/import/same_target.xml");
             fail("Expected build exception");
         } catch (BuildException ex) {
-        	assertContains("Message did not contain expected contents", "Duplicate target", ex.getMessage());
+            assertContains("Message did not contain expected contents", "Duplicate target", ex.getMessage());
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/JarTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/JarTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/JarTest.java
index 9b8ff15..1c6fa94 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/JarTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/JarTest.java
@@ -48,7 +48,7 @@ import static org.junit.Assert.fail;
 /**
  */
 public class JarTest {
-    
+
     @Rule
     public final BuildFileRule buildRule = new BuildFileRule();
 
@@ -56,7 +56,7 @@ public class JarTest {
     private static String tempDir = "jartmp/";
     private Reader r1, r2;
 
-    
+
     @Before
     public void setUp() {
         buildRule.configureProject("src/etc/testcases/taskdefs/jar.xml");
@@ -82,31 +82,31 @@ public class JarTest {
     @Test
     public void test1() {
         try {
-			buildRule.executeTarget("test1");
-			fail("BuildException expected: required argument not specified");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test1");
+            fail("BuildException expected: required argument not specified");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
     public void test2() {
         try {
-			buildRule.executeTarget("test2");
-			fail("BuildException expected: manifest file does not exist");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test2");
+            fail("BuildException expected: manifest file does not exist");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
     public void test3() {
         try {
-			buildRule.executeTarget("test3");
-			fail("BuildException expected: Unrecognized whenempty attribute: format C: /y");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("test3");
+            fail("BuildException expected: Unrecognized whenempty attribute: format C: /y");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     private File getOutputDir() {
@@ -329,17 +329,17 @@ public class JarTest {
     public void testIndexJarsPlusJarMarker() {
         buildRule.executeTarget("testIndexJarsPlusJarMarker");
     }
-    
+
     @Test
     public void testNoVersionInfoFail() {
         try {
-			buildRule.executeTarget("testNoVersionInfoFail");
-			fail("BuildException expected: Manifest Implemention information missing.");
-		} catch (BuildException ex) {
-			assertContains("No Implementation-Title set.", ex.getMessage());
-		}
+            buildRule.executeTarget("testNoVersionInfoFail");
+            fail("BuildException expected: Manifest Implemention information missing.");
+        } catch (BuildException ex) {
+            assertContains("No Implementation-Title set.", ex.getMessage());
+        }
     }
-    
+
     @Test
     public void testNoVersionInfoIgnore() {
         buildRule.executeTarget("testNoVersionInfoIgnore");
@@ -363,7 +363,7 @@ public class JarTest {
         assertFalse(buildRule.getLog().indexOf("No Implementation-Version set.") > -1 );
         assertFalse(buildRule.getLog().indexOf("No Implementation-Vendor set.") > -1 );
     }
-    
+
     @Test
     public void testHasVersionInfo() {
         buildRule.executeTarget("testHasVersionInfo");
@@ -371,5 +371,5 @@ public class JarTest {
         assertFalse(buildRule.getLog().indexOf("No Implementation-Version set.") > -1 );
         assertFalse(buildRule.getLog().indexOf("No Implementation-Vendor set.") > -1 );
     }
-    
+
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/LoadFileTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/LoadFileTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/LoadFileTest.java
index fd8c328..ce166d9 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/LoadFileTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/LoadFileTest.java
@@ -37,7 +37,7 @@ public class LoadFileTest {
 
     @Rule
     public final BuildFileRule buildRule = new BuildFileRule();
-    
+
 
     @Before
     public void setUp() {
@@ -57,11 +57,11 @@ public class LoadFileTest {
     @Test
     public void testNoSourcefileDefined() {
         try {
-			buildRule.executeTarget("testNoSourcefileDefined");
-			fail("BuildException expected: source file not defined");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("testNoSourcefileDefined");
+            fail("BuildException expected: source file not defined");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
 
@@ -71,11 +71,11 @@ public class LoadFileTest {
     @Test
     public void testNoPropertyDefined() {
         try {
-			buildRule.executeTarget("testNoPropertyDefined");
-			fail("BuildException expected: output property not defined");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("testNoPropertyDefined");
+            fail("BuildException expected: output property not defined");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
 
@@ -85,11 +85,11 @@ public class LoadFileTest {
     @Test
     public void testNoSourcefilefound() {
         try {
-			buildRule.executeTarget("testNoSourcefilefound");
-			fail("BuildException expected: File not found");
-		} catch (BuildException ex) {
-			assertContains(" doesn't exist", ex.getMessage());
-		}
+            buildRule.executeTarget("testNoSourcefilefound");
+            fail("BuildException expected: File not found");
+        } catch (BuildException ex) {
+            assertContains(" doesn't exist", ex.getMessage());
+        }
     }
 
     /**
@@ -99,7 +99,7 @@ public class LoadFileTest {
     public void testFailOnError()
             throws BuildException {
         buildRule.executeTarget("testFailOnError");
-		assertNull(buildRule.getProject().getProperty("testFailOnError"));
+        assertNull(buildRule.getProject().getProperty("testFailOnError"));
     }
 
 

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/MacroDefTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/MacroDefTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/MacroDefTest.java
index 18b9786..ebcd015 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/MacroDefTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/MacroDefTest.java
@@ -43,114 +43,114 @@ public class MacroDefTest {
     @Test
     public void testSimple() {
         buildRule.executeTarget("simple");
-		assertEquals("Hello World", buildRule.getLog());
+        assertEquals("Hello World", buildRule.getLog());
     }
 
     @Test
     public void testText() {
         buildRule.executeTarget("text");
-		assertEquals("Inner Text", buildRule.getLog());
+        assertEquals("Inner Text", buildRule.getLog());
     }
 
     @Test
     public void testDuplicateAttribute() {
         try {
-			buildRule.executeTarget("duplicate.attribute");
-			fail("BuildException expected: the attribute text has already been specified");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("duplicate.attribute");
+            fail("BuildException expected: the attribute text has already been specified");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
     public void testDuplicateElement() {
         try {
-			buildRule.executeTarget("duplicate.element");
-			fail("BuildException expected: the element text has already been specified");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("duplicate.element");
+            fail("BuildException expected: the element text has already been specified");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
 
     @Test
     public void testUri() {
         buildRule.executeTarget("uri");
-		assertEquals("Hello World", buildRule.getLog());
+        assertEquals("Hello World", buildRule.getLog());
     }
 
     @Test
     public void testNested() {
         buildRule.executeTarget("nested");
-		assertEquals("A nested element", buildRule.getLog());
+        assertEquals("A nested element", buildRule.getLog());
     }
 
     @Test
     public void testDouble() {
         buildRule.executeTarget("double");
-		assertEquals("@{prop} is 'property', value of ${property} is 'A property value'", buildRule.getLog());
+        assertEquals("@{prop} is 'property', value of ${property} is 'A property value'", buildRule.getLog());
     }
 
     @Test
     public void testIgnoreCase() {
         buildRule.executeTarget("ignorecase");
-		assertEquals("a is ab is b", buildRule.getLog());
+        assertEquals("a is ab is b", buildRule.getLog());
     }
 
     @Test
     public void testIgnoreElementCase() {
         buildRule.executeTarget("ignore-element-case");
-		assertEquals("nested elementnested element", buildRule.getLog());
+        assertEquals("nested elementnested element", buildRule.getLog());
     }
 
     @Test
     public void testTextElement() {
         buildRule.executeTarget("textelement");
-		assertContains("Hello world", buildRule.getLog());
+        assertContains("Hello world", buildRule.getLog());
     }
 
     @Test
     public void testTextTrim() {
         buildRule.executeTarget("text.trim");
-		assertContains("[Hello world]", buildRule.getLog());
+        assertContains("[Hello world]", buildRule.getLog());
     }
 
     @Test
     public void testDuplicateTextName() {
         try {
-			buildRule.executeTarget("duplicatetextname");
-			fail("BuildException expected: the name \"text\" is already used as an attribute");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("duplicatetextname");
+            fail("BuildException expected: the name \"text\" is already used as an attribute");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
     @Test
     public void testDuplicateTextName2() {
         try {
-			buildRule.executeTarget("duplicatetextname2");
-			fail("BuildException expected: the attribute name \"text\" has already been used by the text element");
-		} catch (BuildException ex) {
-			//TODO assert value
-		}
+            buildRule.executeTarget("duplicatetextname2");
+            fail("BuildException expected: the attribute name \"text\" has already been used by the text element");
+        } catch (BuildException ex) {
+            //TODO assert value
+        }
     }
     @Test
     public void testEscape() {
         buildRule.executeTarget("escape");
-		assertEquals("a@b or a@b is avalue@bvalue", buildRule.getLog());
+        assertEquals("a@b or a@b is avalue@bvalue", buildRule.getLog());
     }
     @Test
     public void testAttributeDescription() {
         buildRule.executeTarget("attribute.description");
-		assertEquals("description is hello world", buildRule.getLog());
+        assertEquals("description is hello world", buildRule.getLog());
     }
     @Test
     public void testOverrideDefault() {
         buildRule.executeTarget("override.default");
-		assertEquals("value is new", buildRule.getLog());
+        assertEquals("value is new", buildRule.getLog());
     }
     @Test
     public void testImplicit() {
         buildRule.executeTarget("implicit");
-		assertEquals("Before implicitIn implicitAfter implicit", buildRule.getLog());
+        assertEquals("Before implicitIn implicitAfter implicit", buildRule.getLog());
     }
     @Test
     public void testImplicitNotOptional() {
@@ -164,7 +164,7 @@ public class MacroDefTest {
     @Test
     public void testImplicitOptional() {
         buildRule.executeTarget("implicit.optional");
-		assertEquals("Before implicitAfter implicit", buildRule.getLog());
+        assertEquals("Before implicitAfter implicit", buildRule.getLog());
     }
     @Test
     public void testImplicitExplicit() {
@@ -200,7 +200,6 @@ public class MacroDefTest {
     @Test
     public void testTopLevelText() {
         buildRule.executeTarget("top-level-text");
-		assertContains("Hello World", buildRule.getLog());
+        assertContains("Hello World", buildRule.getLog());
     }
 }
-

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/MakeUrlTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/MakeUrlTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/MakeUrlTest.java
index 8c2762a..07e53fd 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/MakeUrlTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/MakeUrlTest.java
@@ -46,41 +46,41 @@ public class MakeUrlTest {
     @Test
     public void testEmpty() {
         try {
-			buildRule.executeTarget("testEmpty");
-			fail("BuildException expected: missing property");
-		} catch (BuildException ex) {
-			assertContains("property", ex.getMessage());
-		}
+            buildRule.executeTarget("testEmpty");
+            fail("BuildException expected: missing property");
+        } catch (BuildException ex) {
+            assertContains("property", ex.getMessage());
+        }
     }
 
     @Test
     public void testNoProperty() {
         try {
-			buildRule.executeTarget("testNoProperty");
-			fail("BuildException expected: missing property");
-		} catch (BuildException ex) {
-			assertContains("property", ex.getMessage());
-		}
+            buildRule.executeTarget("testNoProperty");
+            fail("BuildException expected: missing property");
+        } catch (BuildException ex) {
+            assertContains("property", ex.getMessage());
+        }
     }
 
     @Test
     public void testNoFile() {
         try {
-			buildRule.executeTarget("testNoFile");
-			fail("BuildException expected: missing file");
-		} catch (BuildException ex) {
-			assertContains("file", ex.getMessage());
-		}
+            buildRule.executeTarget("testNoFile");
+            fail("BuildException expected: missing file");
+        } catch (BuildException ex) {
+            assertContains("file", ex.getMessage());
+        }
     }
 
     @Test
     public void testValidation() {
         try {
-			buildRule.executeTarget("testValidation");
-			fail("BuildException expected: " + MakeUrl.ERROR_MISSING_FILE);
-		} catch (BuildException ex) {
-			assertContains("file", ex.getMessage());
-		}
+            buildRule.executeTarget("testValidation");
+            fail("BuildException expected: " + MakeUrl.ERROR_MISSING_FILE);
+        } catch (BuildException ex) {
+            assertContains("file", ex.getMessage());
+        }
     }
 
     @Test


[04/21] ant git commit: Normalise tabulation and line breaks

Posted by gi...@apache.org.
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/VectorSetTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/VectorSetTest.java b/src/tests/junit/org/apache/tools/ant/util/VectorSetTest.java
index 524a187..11491e3 100644
--- a/src/tests/junit/org/apache/tools/ant/util/VectorSetTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/VectorSetTest.java
@@ -1,295 +1,295 @@
-/*
- *  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.util.ArrayList;
-import java.util.Arrays;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-public class VectorSetTest {
-
-    private static final Object O = new Object();
-    private VectorSet v = new VectorSet();
-
-    @Test
-    public void testAdd() {
-        assertTrue(v.add(O));
-        assertFalse(v.add(O));
-        assertEquals(1, v.size());
-    }
-
-    @Test
-    public void testAdd2() {
-        v.add(0, O);
-        v.add(1, O);
-        assertEquals(1, v.size());
-    }
-
-    @Test
-    public void testAddElement() {
-        v.addElement(O);
-        v.addElement(O);
-        assertEquals(1, v.size());
-    }
-
-    @Test
-    public void testAddAll() {
-        assertTrue(v.addAll(Arrays.asList(new Object[] {O, O})));
-        assertEquals(1, v.size());
-    }
-
-    @Test
-    public void testAddAll2() {
-        assertTrue(v.addAll(0, Arrays.asList(new Object[] {O, O})));
-        assertEquals(1, v.size());
-    }
-
-    @Test
-    public void testClear() {
-        v.add(O);
-        v.clear();
-        assertEquals(0, v.size());
-    }
-
-    @Test
-    public void testClone() {
-        v.add(O);
-        Object o = v.clone();
-        assertTrue(o instanceof VectorSet);
-        VectorSet vs = (VectorSet) o;
-        assertEquals(1, vs.size());
-        assertTrue(vs.contains(O));
-    }
-
-    @Test
-    public void testContains() {
-        assertFalse(v.contains(O));
-        v.add(O);
-        assertTrue(v.contains(O));
-        assertFalse(v.contains(null));
-    }
-
-    @Test
-    public void testContainsAll() {
-        assertFalse(v.containsAll(Arrays.asList(new Object[] {O, O})));
-        v.add(O);
-        assertTrue(v.containsAll(Arrays.asList(new Object[] {O, O})));
-        assertFalse(v.containsAll(Arrays.asList(new Object[] {O, null})));
-    }
-
-    @Test
-    public void testInsertElementAt() {
-        v.insertElementAt(O, 0);
-        v.insertElementAt(O, 1);
-        assertEquals(1, v.size());
-    }
-
-    @Test
-    public void testRemoveIndex() {
-        v.add(O);
-        assertSame(O, v.remove(0));
-        assertEquals(0, v.size());
-        try {
-            v.remove(0);
-            fail("expected an AIOBE");
-        } catch (ArrayIndexOutOfBoundsException e) {
-            //TODO assert exception values
-            // expected
-        }
-    }
-
-    @Test
-    public void testRemoveObject() {
-        v.add(O);
-        assertTrue(v.remove(O));
-        assertEquals(0, v.size());
-        assertFalse(v.remove(O));
-    }
-
-    @Test
-    public void testRemoveAtEndWhenSizeEqualsCapacity() {
-        v = new VectorSet(3, 1);
-        Object a = new Object();
-        v.add(a);
-        Object b = new Object();
-        v.add(b);
-        v.add(O);
-        assertEquals(3, v.size());
-        assertEquals(3, v.capacity());
-        assertTrue(v.remove(O));
-        assertEquals(2, v.size());
-        assertFalse(v.remove(O));
-        assertSame(a, v.elementAt(0));
-        assertSame(b, v.elementAt(1));
-    }
-
-    @Test
-    public void testRemoveAtFrontWhenSizeEqualsCapacity() {
-        v = new VectorSet(3, 1);
-        v.add(O);
-        Object a = new Object();
-        v.add(a);
-        Object b = new Object();
-        v.add(b);
-        assertEquals(3, v.size());
-        assertEquals(3, v.capacity());
-        assertTrue(v.remove(O));
-        assertEquals(2, v.size());
-        assertFalse(v.remove(O));
-        assertSame(a, v.elementAt(0));
-        assertSame(b, v.elementAt(1));
-    }
-
-    @Test
-    public void testRemoveInMiddleWhenSizeEqualsCapacity() {
-        v = new VectorSet(3, 1);
-        Object a = new Object();
-        v.add(a);
-        v.add(O);
-        Object b = new Object();
-        v.add(b);
-        assertEquals(3, v.size());
-        assertEquals(3, v.capacity());
-        assertTrue(v.remove(O));
-        assertEquals(2, v.size());
-        assertFalse(v.remove(O));
-        assertSame(a, v.elementAt(0));
-        assertSame(b, v.elementAt(1));
-    }
-
-    @Test
-    public void testRemoveAll() {
-        v.add(O);
-        assertTrue(v.removeAll(Arrays.asList(new Object[] {O, O})));
-        assertEquals(0, v.size());
-        assertFalse(v.removeAll(Arrays.asList(new Object[] {O, O})));
-    }
-
-    @Test
-    public void testRemoveAllElements() {
-        v.add(O);
-        v.removeAllElements();
-        assertEquals(0, v.size());
-    }
-
-    @Test
-    public void testRemoveElement() {
-        v.add(O);
-        assertTrue(v.removeElement(O));
-        assertEquals(0, v.size());
-        assertFalse(v.removeElement(O));
-    }
-
-    @Test
-    public void testRemoveElementAt() {
-        v.add(O);
-        v.removeElementAt(0);
-        assertEquals(0, v.size());
-        try {
-            v.removeElementAt(0);
-            fail("expected an AIOBE");
-        } catch (ArrayIndexOutOfBoundsException e) {
-            //TODO assert exception values
-            // expected
-        }
-    }
-
-    @Test
-    public void testRemoveRange() {
-        Object a = new Object();
-        Object b = new Object();
-        Object c = new Object();
-        v.addAll(Arrays.asList(new Object[] {O, a, b, c}));
-        v.removeRange(1, 3);
-        assertEquals(2, v.size());
-        assertTrue(v.contains(O));
-        assertTrue(v.contains(c));
-    }
-
-    @Test
-    public void testRetainAll() {
-        Object a = new Object();
-        Object b = new Object();
-        Object c = new Object();
-        v.addAll(Arrays.asList(new Object[] {O, a, b, c}));
-        assertEquals(0, v.indexOf(O));
-        assertTrue(v.retainAll(Arrays.asList(new Object[] {c, O})));
-        assertEquals(2, v.size());
-        assertTrue(v.contains(O));
-        assertTrue(v.contains(c));
-        assertEquals(0, v.indexOf(O));
-    }
-
-    @Test
-    public void testRetainAllReturnValueAndEmptiness() {
-        v.add(1);
-        v.add(2);
-        v.add(3);
-        assertTrue(v.retainAll(Arrays.asList(1, 2)));
-        assertEquals(2, v.size());
-        assertFalse(v.retainAll(Arrays.asList(1, 2)));
-        assertEquals(2, v.size());
-        assertTrue(v.retainAll(Arrays.asList(4, 5)));
-        assertEquals(0, v.size());
-        assertFalse(v.retainAll(Arrays.asList(4, 5)));
-    }
-
-    @Test
-    public void testSet() {
-        v.add(O);
-        Object a = new Object();
-        assertSame(O, v.set(0, a));
-        assertSame(a, v.get(0));
-        assertEquals(1, v.size());
-    }
-
-    @Test
-    public void testSetElementAt() {
-        v.add(O);
-        Object a = new Object();
-        v.setElementAt(a, 0);
-        assertSame(a, v.get(0));
-        assertEquals(1, v.size());
-    }
-
-    @Test
-    public void testRetainAllSpeed() {
-        int size = 50000;
-        for (int i = 0; i < size; i++) {
-            v.add(i);
-            v.add(i);
-        }
-        assertEquals(size, v.size());
-        ArrayList<Integer> list = new ArrayList<Integer>();
-        for (int i = size - 4; i < 2 * size; i++) {
-            list.add(i);
-            v.add(i);
-        }
-        assertTrue(v.retainAll(list));
-        assertEquals(v.toString(), size + 4, v.size());
-    }
-
-}
+/*
+ *  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.util.ArrayList;
+import java.util.Arrays;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+public class VectorSetTest {
+
+    private static final Object O = new Object();
+    private VectorSet v = new VectorSet();
+
+    @Test
+    public void testAdd() {
+        assertTrue(v.add(O));
+        assertFalse(v.add(O));
+        assertEquals(1, v.size());
+    }
+
+    @Test
+    public void testAdd2() {
+        v.add(0, O);
+        v.add(1, O);
+        assertEquals(1, v.size());
+    }
+
+    @Test
+    public void testAddElement() {
+        v.addElement(O);
+        v.addElement(O);
+        assertEquals(1, v.size());
+    }
+
+    @Test
+    public void testAddAll() {
+        assertTrue(v.addAll(Arrays.asList(new Object[] {O, O})));
+        assertEquals(1, v.size());
+    }
+
+    @Test
+    public void testAddAll2() {
+        assertTrue(v.addAll(0, Arrays.asList(new Object[] {O, O})));
+        assertEquals(1, v.size());
+    }
+
+    @Test
+    public void testClear() {
+        v.add(O);
+        v.clear();
+        assertEquals(0, v.size());
+    }
+
+    @Test
+    public void testClone() {
+        v.add(O);
+        Object o = v.clone();
+        assertTrue(o instanceof VectorSet);
+        VectorSet vs = (VectorSet) o;
+        assertEquals(1, vs.size());
+        assertTrue(vs.contains(O));
+    }
+
+    @Test
+    public void testContains() {
+        assertFalse(v.contains(O));
+        v.add(O);
+        assertTrue(v.contains(O));
+        assertFalse(v.contains(null));
+    }
+
+    @Test
+    public void testContainsAll() {
+        assertFalse(v.containsAll(Arrays.asList(new Object[] {O, O})));
+        v.add(O);
+        assertTrue(v.containsAll(Arrays.asList(new Object[] {O, O})));
+        assertFalse(v.containsAll(Arrays.asList(new Object[] {O, null})));
+    }
+
+    @Test
+    public void testInsertElementAt() {
+        v.insertElementAt(O, 0);
+        v.insertElementAt(O, 1);
+        assertEquals(1, v.size());
+    }
+
+    @Test
+    public void testRemoveIndex() {
+        v.add(O);
+        assertSame(O, v.remove(0));
+        assertEquals(0, v.size());
+        try {
+            v.remove(0);
+            fail("expected an AIOBE");
+        } catch (ArrayIndexOutOfBoundsException e) {
+            //TODO assert exception values
+            // expected
+        }
+    }
+
+    @Test
+    public void testRemoveObject() {
+        v.add(O);
+        assertTrue(v.remove(O));
+        assertEquals(0, v.size());
+        assertFalse(v.remove(O));
+    }
+
+    @Test
+    public void testRemoveAtEndWhenSizeEqualsCapacity() {
+        v = new VectorSet(3, 1);
+        Object a = new Object();
+        v.add(a);
+        Object b = new Object();
+        v.add(b);
+        v.add(O);
+        assertEquals(3, v.size());
+        assertEquals(3, v.capacity());
+        assertTrue(v.remove(O));
+        assertEquals(2, v.size());
+        assertFalse(v.remove(O));
+        assertSame(a, v.elementAt(0));
+        assertSame(b, v.elementAt(1));
+    }
+
+    @Test
+    public void testRemoveAtFrontWhenSizeEqualsCapacity() {
+        v = new VectorSet(3, 1);
+        v.add(O);
+        Object a = new Object();
+        v.add(a);
+        Object b = new Object();
+        v.add(b);
+        assertEquals(3, v.size());
+        assertEquals(3, v.capacity());
+        assertTrue(v.remove(O));
+        assertEquals(2, v.size());
+        assertFalse(v.remove(O));
+        assertSame(a, v.elementAt(0));
+        assertSame(b, v.elementAt(1));
+    }
+
+    @Test
+    public void testRemoveInMiddleWhenSizeEqualsCapacity() {
+        v = new VectorSet(3, 1);
+        Object a = new Object();
+        v.add(a);
+        v.add(O);
+        Object b = new Object();
+        v.add(b);
+        assertEquals(3, v.size());
+        assertEquals(3, v.capacity());
+        assertTrue(v.remove(O));
+        assertEquals(2, v.size());
+        assertFalse(v.remove(O));
+        assertSame(a, v.elementAt(0));
+        assertSame(b, v.elementAt(1));
+    }
+
+    @Test
+    public void testRemoveAll() {
+        v.add(O);
+        assertTrue(v.removeAll(Arrays.asList(new Object[] {O, O})));
+        assertEquals(0, v.size());
+        assertFalse(v.removeAll(Arrays.asList(new Object[] {O, O})));
+    }
+
+    @Test
+    public void testRemoveAllElements() {
+        v.add(O);
+        v.removeAllElements();
+        assertEquals(0, v.size());
+    }
+
+    @Test
+    public void testRemoveElement() {
+        v.add(O);
+        assertTrue(v.removeElement(O));
+        assertEquals(0, v.size());
+        assertFalse(v.removeElement(O));
+    }
+
+    @Test
+    public void testRemoveElementAt() {
+        v.add(O);
+        v.removeElementAt(0);
+        assertEquals(0, v.size());
+        try {
+            v.removeElementAt(0);
+            fail("expected an AIOBE");
+        } catch (ArrayIndexOutOfBoundsException e) {
+            //TODO assert exception values
+            // expected
+        }
+    }
+
+    @Test
+    public void testRemoveRange() {
+        Object a = new Object();
+        Object b = new Object();
+        Object c = new Object();
+        v.addAll(Arrays.asList(new Object[] {O, a, b, c}));
+        v.removeRange(1, 3);
+        assertEquals(2, v.size());
+        assertTrue(v.contains(O));
+        assertTrue(v.contains(c));
+    }
+
+    @Test
+    public void testRetainAll() {
+        Object a = new Object();
+        Object b = new Object();
+        Object c = new Object();
+        v.addAll(Arrays.asList(new Object[] {O, a, b, c}));
+        assertEquals(0, v.indexOf(O));
+        assertTrue(v.retainAll(Arrays.asList(new Object[] {c, O})));
+        assertEquals(2, v.size());
+        assertTrue(v.contains(O));
+        assertTrue(v.contains(c));
+        assertEquals(0, v.indexOf(O));
+    }
+
+    @Test
+    public void testRetainAllReturnValueAndEmptiness() {
+        v.add(1);
+        v.add(2);
+        v.add(3);
+        assertTrue(v.retainAll(Arrays.asList(1, 2)));
+        assertEquals(2, v.size());
+        assertFalse(v.retainAll(Arrays.asList(1, 2)));
+        assertEquals(2, v.size());
+        assertTrue(v.retainAll(Arrays.asList(4, 5)));
+        assertEquals(0, v.size());
+        assertFalse(v.retainAll(Arrays.asList(4, 5)));
+    }
+
+    @Test
+    public void testSet() {
+        v.add(O);
+        Object a = new Object();
+        assertSame(O, v.set(0, a));
+        assertSame(a, v.get(0));
+        assertEquals(1, v.size());
+    }
+
+    @Test
+    public void testSetElementAt() {
+        v.add(O);
+        Object a = new Object();
+        v.setElementAt(a, 0);
+        assertSame(a, v.get(0));
+        assertEquals(1, v.size());
+    }
+
+    @Test
+    public void testRetainAllSpeed() {
+        int size = 50000;
+        for (int i = 0; i < size; i++) {
+            v.add(i);
+            v.add(i);
+        }
+        assertEquals(size, v.size());
+        ArrayList<Integer> list = new ArrayList<Integer>();
+        for (int i = size - 4; i < 2 * size; i++) {
+            list.add(i);
+            v.add(i);
+        }
+        assertTrue(v.retainAll(list));
+        assertEquals(v.toString(), size + 4, v.size());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/XMLFragmentTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/XMLFragmentTest.java b/src/tests/junit/org/apache/tools/ant/util/XMLFragmentTest.java
index 72c42b3..0ac938f 100644
--- a/src/tests/junit/org/apache/tools/ant/util/XMLFragmentTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/XMLFragmentTest.java
@@ -1,91 +1,91 @@
-/*
- *  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 org.apache.tools.ant.BuildFileRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-public class XMLFragmentTest {
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject("src/etc/testcases/types/xmlfragment.xml");
-    }
-
-    @Test
-    public void testNestedText() {
-        XMLFragment x = (XMLFragment) buildRule.getProject().getReference("nested-text");
-        assertNotNull(x);
-        Node n = x.getFragment();
-        assertTrue("No attributes", !n.hasAttributes());
-        NodeList nl = n.getChildNodes();
-        assertEquals(1, nl.getLength());
-        assertEquals(Node.TEXT_NODE, nl.item(0).getNodeType());
-        assertEquals("foo", nl.item(0).getNodeValue());
-    }
-
-    @Test
-    public void testNestedChildren() {
-        XMLFragment x =
-            (XMLFragment) buildRule.getProject().getReference("with-children");
-        assertNotNull(x);
-        Node n = x.getFragment();
-        assertTrue("No attributes", !n.hasAttributes());
-        NodeList nl = n.getChildNodes();
-        assertEquals(3, nl.getLength());
-
-        assertEquals(Node.ELEMENT_NODE, nl.item(0).getNodeType());
-        Element child1 = (Element) nl.item(0);
-        assertEquals("child1", child1.getTagName());
-        assertTrue(!child1.hasAttributes());
-        NodeList nl2 = child1.getChildNodes();
-        assertEquals(1, nl2.getLength());
-        assertEquals(Node.TEXT_NODE, nl2.item(0).getNodeType());
-        assertEquals("foo", nl2.item(0).getNodeValue());
-
-        assertEquals(Node.ELEMENT_NODE, nl.item(1).getNodeType());
-        Element child2 = (Element) nl.item(1);
-        assertEquals("child2", child2.getTagName());
-        assertTrue(child2.hasAttributes());
-        nl2 = child2.getChildNodes();
-        assertEquals(0, nl2.getLength());
-        assertEquals("bar", child2.getAttribute("foo"));
-
-        assertEquals(Node.ELEMENT_NODE, nl.item(2).getNodeType());
-        Element child3 = (Element) nl.item(2);
-        assertEquals("child3", child3.getTagName());
-        assertTrue(!child3.hasAttributes());
-        nl2 = child3.getChildNodes();
-        assertEquals(1, nl2.getLength());
-        assertEquals(Node.ELEMENT_NODE, nl2.item(0).getNodeType());
-        assertEquals("child4", ((Element) nl2.item(0)).getTagName());
-    }
-}
+/*
+ *  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 org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+public class XMLFragmentTest {
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject("src/etc/testcases/types/xmlfragment.xml");
+    }
+
+    @Test
+    public void testNestedText() {
+        XMLFragment x = (XMLFragment) buildRule.getProject().getReference("nested-text");
+        assertNotNull(x);
+        Node n = x.getFragment();
+        assertTrue("No attributes", !n.hasAttributes());
+        NodeList nl = n.getChildNodes();
+        assertEquals(1, nl.getLength());
+        assertEquals(Node.TEXT_NODE, nl.item(0).getNodeType());
+        assertEquals("foo", nl.item(0).getNodeValue());
+    }
+
+    @Test
+    public void testNestedChildren() {
+        XMLFragment x =
+            (XMLFragment) buildRule.getProject().getReference("with-children");
+        assertNotNull(x);
+        Node n = x.getFragment();
+        assertTrue("No attributes", !n.hasAttributes());
+        NodeList nl = n.getChildNodes();
+        assertEquals(3, nl.getLength());
+
+        assertEquals(Node.ELEMENT_NODE, nl.item(0).getNodeType());
+        Element child1 = (Element) nl.item(0);
+        assertEquals("child1", child1.getTagName());
+        assertTrue(!child1.hasAttributes());
+        NodeList nl2 = child1.getChildNodes();
+        assertEquals(1, nl2.getLength());
+        assertEquals(Node.TEXT_NODE, nl2.item(0).getNodeType());
+        assertEquals("foo", nl2.item(0).getNodeValue());
+
+        assertEquals(Node.ELEMENT_NODE, nl.item(1).getNodeType());
+        Element child2 = (Element) nl.item(1);
+        assertEquals("child2", child2.getTagName());
+        assertTrue(child2.hasAttributes());
+        nl2 = child2.getChildNodes();
+        assertEquals(0, nl2.getLength());
+        assertEquals("bar", child2.getAttribute("foo"));
+
+        assertEquals(Node.ELEMENT_NODE, nl.item(2).getNodeType());
+        Element child3 = (Element) nl.item(2);
+        assertEquals("child3", child3.getTagName());
+        assertTrue(!child3.hasAttributes());
+        nl2 = child3.getChildNodes();
+        assertEquals(1, nl2.getLength());
+        assertEquals(Node.ELEMENT_NODE, nl2.item(0).getNodeType());
+        assertEquals("child4", ((Element) nl2.item(0)).getTagName());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/facade/FacadeTaskHelperTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/facade/FacadeTaskHelperTest.java b/src/tests/junit/org/apache/tools/ant/util/facade/FacadeTaskHelperTest.java
index 3377d73..df2d43b 100644
--- a/src/tests/junit/org/apache/tools/ant/util/facade/FacadeTaskHelperTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/facade/FacadeTaskHelperTest.java
@@ -1,64 +1,64 @@
-/*
- *  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.facade;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * @since Ant 1.5
- */
-public class FacadeTaskHelperTest {
-
-    @Test
-    public void testPrecedenceRules() {
-        FacadeTaskHelper fth = new FacadeTaskHelper("foo");
-        assertEquals("foo", fth.getImplementation());
-
-        fth.setMagicValue("bar");
-        assertEquals("bar", fth.getImplementation());
-
-        fth = new FacadeTaskHelper("foo", "bar");
-        assertEquals("bar", fth.getImplementation());
-
-        fth = new FacadeTaskHelper("foo", null);
-        assertEquals("foo", fth.getImplementation());
-
-        fth = new FacadeTaskHelper("foo");
-        fth.setMagicValue("bar");
-        fth.setImplementation("baz");
-        assertEquals("baz", fth.getImplementation());
-    }
-
-    @Test
-    public void testHasBeenSet() {
-        FacadeTaskHelper fth = new FacadeTaskHelper("foo");
-        assertTrue("nothing set", !fth.hasBeenSet());
-        fth.setMagicValue(null);
-        assertTrue("magic has not been set", !fth.hasBeenSet());
-        fth.setMagicValue("foo");
-        assertTrue("magic has been set", fth.hasBeenSet());
-        fth.setMagicValue(null);
-        assertTrue(!fth.hasBeenSet());
-        fth.setImplementation("baz");
-        assertTrue("set explicitly", fth.hasBeenSet());
-    }
-}
+/*
+ *  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.facade;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * @since Ant 1.5
+ */
+public class FacadeTaskHelperTest {
+
+    @Test
+    public void testPrecedenceRules() {
+        FacadeTaskHelper fth = new FacadeTaskHelper("foo");
+        assertEquals("foo", fth.getImplementation());
+
+        fth.setMagicValue("bar");
+        assertEquals("bar", fth.getImplementation());
+
+        fth = new FacadeTaskHelper("foo", "bar");
+        assertEquals("bar", fth.getImplementation());
+
+        fth = new FacadeTaskHelper("foo", null);
+        assertEquals("foo", fth.getImplementation());
+
+        fth = new FacadeTaskHelper("foo");
+        fth.setMagicValue("bar");
+        fth.setImplementation("baz");
+        assertEquals("baz", fth.getImplementation());
+    }
+
+    @Test
+    public void testHasBeenSet() {
+        FacadeTaskHelper fth = new FacadeTaskHelper("foo");
+        assertTrue("nothing set", !fth.hasBeenSet());
+        fth.setMagicValue(null);
+        assertTrue("magic has not been set", !fth.hasBeenSet());
+        fth.setMagicValue("foo");
+        assertTrue("magic has been set", fth.hasBeenSet());
+        fth.setMagicValue(null);
+        assertTrue(!fth.hasBeenSet());
+        fth.setImplementation("baz");
+        assertTrue("set explicitly", fth.hasBeenSet());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/facade/ImplementationSpecificArgumentTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/facade/ImplementationSpecificArgumentTest.java b/src/tests/junit/org/apache/tools/ant/util/facade/ImplementationSpecificArgumentTest.java
index 7a678bc..a1b97d1 100644
--- a/src/tests/junit/org/apache/tools/ant/util/facade/ImplementationSpecificArgumentTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/facade/ImplementationSpecificArgumentTest.java
@@ -1,59 +1,59 @@
-/*
- *  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.facade;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-/**
- * @since Ant 1.5
- */
-public class ImplementationSpecificArgumentTest {
-
-    @Test
-    public void testDependsOnImplementation() {
-        ImplementationSpecificArgument ia =
-            new ImplementationSpecificArgument();
-        ia.setLine("A B");
-        String[] parts = ia.getParts();
-        assertNotNull(parts);
-        assertEquals(2, parts.length);
-        assertEquals("A", parts[0]);
-        assertEquals("B", parts[1]);
-
-        parts = ia.getParts(null);
-        assertNotNull(parts);
-        assertEquals(2, parts.length);
-        assertEquals("A", parts[0]);
-        assertEquals("B", parts[1]);
-
-        ia.setImplementation("foo");
-        parts = ia.getParts(null);
-        assertNotNull(parts);
-        assertEquals(0, parts.length);
-
-        parts = ia.getParts("foo");
-        assertNotNull(parts);
-        assertEquals(2, parts.length);
-        assertEquals("A", parts[0]);
-        assertEquals("B", parts[1]);
-    }
-}
+/*
+ *  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.facade;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * @since Ant 1.5
+ */
+public class ImplementationSpecificArgumentTest {
+
+    @Test
+    public void testDependsOnImplementation() {
+        ImplementationSpecificArgument ia =
+            new ImplementationSpecificArgument();
+        ia.setLine("A B");
+        String[] parts = ia.getParts();
+        assertNotNull(parts);
+        assertEquals(2, parts.length);
+        assertEquals("A", parts[0]);
+        assertEquals("B", parts[1]);
+
+        parts = ia.getParts(null);
+        assertNotNull(parts);
+        assertEquals(2, parts.length);
+        assertEquals("A", parts[0]);
+        assertEquals("B", parts[1]);
+
+        ia.setImplementation("foo");
+        parts = ia.getParts(null);
+        assertNotNull(parts);
+        assertEquals(0, parts.length);
+
+        parts = ia.getParts("foo");
+        assertNotNull(parts);
+        assertEquals(2, parts.length);
+        assertEquals("A", parts[0]);
+        assertEquals("B", parts[1]);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaOroMatcherTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaOroMatcherTest.java b/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaOroMatcherTest.java
index 073cf86..d1405f4 100644
--- a/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaOroMatcherTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaOroMatcherTest.java
@@ -1,35 +1,35 @@
-/*
- *  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.regexp;
-
-/**
- * Tests for the jakarta-oro implementation of the RegexpMatcher interface.
- *
- */
-public class JakartaOroMatcherTest extends RegexpMatcherTest {
-
-    public RegexpMatcher getImplementation() {
-        return new JakartaOroMatcher();
-    }
-
-    public JakartaOroMatcherTest(String name) {
-        super(name);
-    }
-
-}
+/*
+ *  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.regexp;
+
+/**
+ * Tests for the jakarta-oro implementation of the RegexpMatcher interface.
+ *
+ */
+public class JakartaOroMatcherTest extends RegexpMatcherTest {
+
+    public RegexpMatcher getImplementation() {
+        return new JakartaOroMatcher();
+    }
+
+    public JakartaOroMatcherTest(String name) {
+        super(name);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaOroRegexpTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaOroRegexpTest.java b/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaOroRegexpTest.java
index 340e602..e869c62 100644
--- a/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaOroRegexpTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaOroRegexpTest.java
@@ -1,35 +1,35 @@
-/*
- *  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.regexp;
-
-/**
- * Tests for the jakarta-oro implementation of the Regexp interface.
- *
- */
-public class JakartaOroRegexpTest extends RegexpTest {
-
-    public Regexp getRegexpImplementation() {
-        return new JakartaOroRegexp();
-    }
-
-    public JakartaOroRegexpTest(String name) {
-        super(name);
-    }
-
-}
+/*
+ *  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.regexp;
+
+/**
+ * Tests for the jakarta-oro implementation of the Regexp interface.
+ *
+ */
+public class JakartaOroRegexpTest extends RegexpTest {
+
+    public Regexp getRegexpImplementation() {
+        return new JakartaOroRegexp();
+    }
+
+    public JakartaOroRegexpTest(String name) {
+        super(name);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpMatcherTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpMatcherTest.java b/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpMatcherTest.java
index 0b1bb55..3340b59 100644
--- a/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpMatcherTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpMatcherTest.java
@@ -1,63 +1,63 @@
-/*
- *  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.regexp;
-
-import java.io.IOException;
-
-import junit.framework.AssertionFailedError;
-
-/**
- * Tests for the jakarta-regexp implementation of the RegexpMatcher interface.
- *
- */
-public class JakartaRegexpMatcherTest extends RegexpMatcherTest {
-
-    public RegexpMatcher getImplementation() {
-        return new JakartaRegexpMatcher();
-    }
-
-    public JakartaRegexpMatcherTest(String name) {
-        super(name);
-    }
-
-    public void testWindowsLineSeparator2() throws IOException {
-        try {
-            super.testWindowsLineSeparator2();
-            fail("Should trigger when this bug is fixed. {@since 1.2}");
-        } catch (AssertionFailedError e) {
-        }
-    }
-
-    /**
-     * Fails for the same reason as "default" mode in doEndTest2.
-     */
-    public void testUnixLineSeparator() throws IOException {
-        try {
-            super.testUnixLineSeparator();
-            fail("Should trigger once this bug is fixed. {@since 1.2}");
-        } catch (AssertionFailedError e) {
-        }
-    }
-
-
-    /**
-     * Fails for "default" mode.
-     */
-    protected void doEndTest2(String text) {}
-}
+/*
+ *  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.regexp;
+
+import java.io.IOException;
+
+import junit.framework.AssertionFailedError;
+
+/**
+ * Tests for the jakarta-regexp implementation of the RegexpMatcher interface.
+ *
+ */
+public class JakartaRegexpMatcherTest extends RegexpMatcherTest {
+
+    public RegexpMatcher getImplementation() {
+        return new JakartaRegexpMatcher();
+    }
+
+    public JakartaRegexpMatcherTest(String name) {
+        super(name);
+    }
+
+    public void testWindowsLineSeparator2() throws IOException {
+        try {
+            super.testWindowsLineSeparator2();
+            fail("Should trigger when this bug is fixed. {@since 1.2}");
+        } catch (AssertionFailedError e) {
+        }
+    }
+
+    /**
+     * Fails for the same reason as "default" mode in doEndTest2.
+     */
+    public void testUnixLineSeparator() throws IOException {
+        try {
+            super.testUnixLineSeparator();
+            fail("Should trigger once this bug is fixed. {@since 1.2}");
+        } catch (AssertionFailedError e) {
+        }
+    }
+
+
+    /**
+     * Fails for "default" mode.
+     */
+    protected void doEndTest2(String text) {}
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpRegexpTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpRegexpTest.java b/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpRegexpTest.java
index ea2b963..078fbb1 100644
--- a/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpRegexpTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpRegexpTest.java
@@ -1,62 +1,62 @@
-/*
- *  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.regexp;
-
-import java.io.IOException;
-
-import junit.framework.AssertionFailedError;
-
-/**
- * Tests for the jakarta-regexp implementation of the Regexp interface.
- *
- */
-public class JakartaRegexpRegexpTest extends RegexpTest {
-
-    public Regexp getRegexpImplementation() {
-        return new JakartaRegexpRegexp();
-    }
-
-    public JakartaRegexpRegexpTest(String name) {
-        super(name);
-    }
-
-    public void testWindowsLineSeparator2() throws IOException {
-        try {
-            super.testWindowsLineSeparator2();
-            fail("Should trigger when this bug is fixed. {@since 1.2}");
-        } catch (AssertionFailedError e){
-        }
-    }
-
-    /**
-     * Fails for the same reason as "default" mode in doEndTest2.
-     */
-    public void testUnixLineSeparator() throws IOException {
-        try {
-            super.testUnixLineSeparator();
-            fail("Should trigger once this bug is fixed. {@since 1.2}");
-        } catch (AssertionFailedError e){
-        }
-    }
-
-    /**
-     * Fails for "default" mode.
-     */
-    protected void doEndTest2(String text) {}
-}
+/*
+ *  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.regexp;
+
+import java.io.IOException;
+
+import junit.framework.AssertionFailedError;
+
+/**
+ * Tests for the jakarta-regexp implementation of the Regexp interface.
+ *
+ */
+public class JakartaRegexpRegexpTest extends RegexpTest {
+
+    public Regexp getRegexpImplementation() {
+        return new JakartaRegexpRegexp();
+    }
+
+    public JakartaRegexpRegexpTest(String name) {
+        super(name);
+    }
+
+    public void testWindowsLineSeparator2() throws IOException {
+        try {
+            super.testWindowsLineSeparator2();
+            fail("Should trigger when this bug is fixed. {@since 1.2}");
+        } catch (AssertionFailedError e){
+        }
+    }
+
+    /**
+     * Fails for the same reason as "default" mode in doEndTest2.
+     */
+    public void testUnixLineSeparator() throws IOException {
+        try {
+            super.testUnixLineSeparator();
+            fail("Should trigger once this bug is fixed. {@since 1.2}");
+        } catch (AssertionFailedError e){
+        }
+    }
+
+    /**
+     * Fails for "default" mode.
+     */
+    protected void doEndTest2(String text) {}
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcherTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcherTest.java b/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcherTest.java
index fdb3e7d..c042e71 100644
--- a/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcherTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcherTest.java
@@ -1,70 +1,70 @@
-/*
- *  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.regexp;
-
-import java.io.IOException;
-
-import junit.framework.AssertionFailedError;
-
-/**
- * Tests for the JDK 1.4 implementation of the RegexpMatcher interface.
- *
- */
-public class Jdk14RegexpMatcherTest extends RegexpMatcherTest {
-
-    public RegexpMatcher getImplementation() {
-        return new Jdk14RegexpMatcher();
-    }
-
-    public Jdk14RegexpMatcherTest(String name) {
-        super(name);
-    }
-
-    public void testParagraphCharacter() throws IOException {
-        try {
-            super.testParagraphCharacter();
-            fail("Should trigger once fixed. {@since JDK 1.4RC1}");
-        } catch (AssertionFailedError e){
-        }
-    }
-
-    public void testLineSeparatorCharacter() throws IOException {
-        try {
-            super.testLineSeparatorCharacter();
-            fail("Should trigger once fixed. {@since JDK 1.4RC1}");
-        } catch (AssertionFailedError e){
-        }
-    }
-
-    public void testStandaloneCR() throws IOException {
-        try {
-            super.testStandaloneCR();
-            fail("Should trigger once fixed. {@since JDK 1.4RC1}");
-        } catch (AssertionFailedError e){
-        }
-    }
-
-    public void testWindowsLineSeparator() throws IOException {
-        try {
-            super.testWindowsLineSeparator();
-            fail("Should trigger once fixed. {@since JDK 1.4RC1}");
-        } catch (AssertionFailedError e){
-        }
-    }
-}
+/*
+ *  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.regexp;
+
+import java.io.IOException;
+
+import junit.framework.AssertionFailedError;
+
+/**
+ * Tests for the JDK 1.4 implementation of the RegexpMatcher interface.
+ *
+ */
+public class Jdk14RegexpMatcherTest extends RegexpMatcherTest {
+
+    public RegexpMatcher getImplementation() {
+        return new Jdk14RegexpMatcher();
+    }
+
+    public Jdk14RegexpMatcherTest(String name) {
+        super(name);
+    }
+
+    public void testParagraphCharacter() throws IOException {
+        try {
+            super.testParagraphCharacter();
+            fail("Should trigger once fixed. {@since JDK 1.4RC1}");
+        } catch (AssertionFailedError e){
+        }
+    }
+
+    public void testLineSeparatorCharacter() throws IOException {
+        try {
+            super.testLineSeparatorCharacter();
+            fail("Should trigger once fixed. {@since JDK 1.4RC1}");
+        } catch (AssertionFailedError e){
+        }
+    }
+
+    public void testStandaloneCR() throws IOException {
+        try {
+            super.testStandaloneCR();
+            fail("Should trigger once fixed. {@since JDK 1.4RC1}");
+        } catch (AssertionFailedError e){
+        }
+    }
+
+    public void testWindowsLineSeparator() throws IOException {
+        try {
+            super.testWindowsLineSeparator();
+            fail("Should trigger once fixed. {@since JDK 1.4RC1}");
+        } catch (AssertionFailedError e){
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexpTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexpTest.java b/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexpTest.java
index 7843adc..2b60406 100644
--- a/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexpTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexpTest.java
@@ -1,71 +1,71 @@
-/*
- *  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.regexp;
-
-import java.io.IOException;
-
-import junit.framework.AssertionFailedError;
-
-/**
- * Tests for the JDK 1.4 implementation of the Regexp interface.
- *
- */
-public class Jdk14RegexpRegexpTest extends RegexpTest {
-
-    public Regexp getRegexpImplementation() {
-        return new Jdk14RegexpRegexp();
-    }
-
-    public Jdk14RegexpRegexpTest(String name) {
-        super(name);
-    }
-
-    public void testParagraphCharacter() throws IOException {
-        try {
-            super.testParagraphCharacter();
-            fail("Should trigger once fixed. {@since JDK 1.4RC1}");
-        } catch (AssertionFailedError e){
-        }
-    }
-
-    public void testLineSeparatorCharacter() throws IOException {
-        try {
-            super.testLineSeparatorCharacter();
-            fail("Should trigger once fixed. {@since JDK 1.4RC1}");
-        } catch (AssertionFailedError e){
-        }
-    }
-
-    public void testStandaloneCR() throws IOException {
-        try {
-            super.testStandaloneCR();
-            fail("Should trigger once fixed. {@since JDK 1.4RC1}");
-        } catch (AssertionFailedError e){
-        }
-    }
-
-    public void testWindowsLineSeparator() throws IOException {
-        try {
-            super.testWindowsLineSeparator();
-            fail("Should trigger once fixed. {@since JDK 1.4RC1}");
-        } catch (AssertionFailedError e){
-        }
-    }
-
-}
+/*
+ *  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.regexp;
+
+import java.io.IOException;
+
+import junit.framework.AssertionFailedError;
+
+/**
+ * Tests for the JDK 1.4 implementation of the Regexp interface.
+ *
+ */
+public class Jdk14RegexpRegexpTest extends RegexpTest {
+
+    public Regexp getRegexpImplementation() {
+        return new Jdk14RegexpRegexp();
+    }
+
+    public Jdk14RegexpRegexpTest(String name) {
+        super(name);
+    }
+
+    public void testParagraphCharacter() throws IOException {
+        try {
+            super.testParagraphCharacter();
+            fail("Should trigger once fixed. {@since JDK 1.4RC1}");
+        } catch (AssertionFailedError e){
+        }
+    }
+
+    public void testLineSeparatorCharacter() throws IOException {
+        try {
+            super.testLineSeparatorCharacter();
+            fail("Should trigger once fixed. {@since JDK 1.4RC1}");
+        } catch (AssertionFailedError e){
+        }
+    }
+
+    public void testStandaloneCR() throws IOException {
+        try {
+            super.testStandaloneCR();
+            fail("Should trigger once fixed. {@since JDK 1.4RC1}");
+        } catch (AssertionFailedError e){
+        }
+    }
+
+    public void testWindowsLineSeparator() throws IOException {
+        try {
+            super.testWindowsLineSeparator();
+            fail("Should trigger once fixed. {@since JDK 1.4RC1}");
+        } catch (AssertionFailedError e){
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java b/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java
index 559e4f0..0950827 100644
--- a/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java
@@ -1,204 +1,204 @@
-/*
- *  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.regexp;
-
-import java.io.IOException;
-import java.util.Vector;
-
-import junit.framework.TestCase;
-
-/**
- * Tests for all implementations of the RegexpMatcher interface.
- *
- */
-public abstract class RegexpMatcherTest extends TestCase {
-
-    public final static String UNIX_LINE = "\n";
-
-    private RegexpMatcher reg;
-
-    public abstract RegexpMatcher getImplementation();
-
-    protected final RegexpMatcher getReg() {return reg;}
-
-    public RegexpMatcherTest(String name) {
-        super(name);
-    }
-
-    public void setUp() {
-        reg = getImplementation();
-    }
-
-    public void testMatches() {
-        reg.setPattern("aaaa");
-        assertTrue("aaaa should match itself", reg.matches("aaaa"));
-        assertTrue("aaaa should match xaaaa", reg.matches("xaaaa"));
-        assertTrue("aaaa shouldn\'t match xaaa", !reg.matches("xaaa"));
-        reg.setPattern("^aaaa");
-        assertTrue("^aaaa shouldn\'t match xaaaa", !reg.matches("xaaaa"));
-        assertTrue("^aaaa should match aaaax", reg.matches("aaaax"));
-        reg.setPattern("aaaa$");
-        assertTrue("aaaa$ shouldn\'t match aaaax", !reg.matches("aaaax"));
-        assertTrue("aaaa$ should match xaaaa", reg.matches("xaaaa"));
-        reg.setPattern("[0-9]+");
-        assertTrue("[0-9]+ should match 123", reg.matches("123"));
-        assertTrue("[0-9]+ should match 1", reg.matches("1"));
-        assertTrue("[0-9]+ shouldn\'t match \'\'", !reg.matches(""));
-        assertTrue("[0-9]+ shouldn\'t match a", !reg.matches("a"));
-        reg.setPattern("[0-9]*");
-        assertTrue("[0-9]* should match 123", reg.matches("123"));
-        assertTrue("[0-9]* should match 1", reg.matches("1"));
-        assertTrue("[0-9]* should match \'\'", reg.matches(""));
-        assertTrue("[0-9]* should match a", reg.matches("a"));
-        reg.setPattern("([0-9]+)=\\1");
-        assertTrue("([0-9]+)=\\1 should match 1=1", reg.matches("1=1"));
-        assertTrue("([0-9]+)=\\1 shouldn\'t match 1=2", !reg.matches("1=2"));
-    }
-
-    public void testGroups() {
-        reg.setPattern("aaaa");
-        Vector v = reg.getGroups("xaaaa");
-        assertEquals("No parens -> no extra groups", 1, v.size());
-        assertEquals("Trivial match with no parens", "aaaa",
-                     (String) v.elementAt(0));
-
-        reg.setPattern("(aaaa)");
-        v = reg.getGroups("xaaaa");
-        assertEquals("Trivial match with single paren", 2, v.size());
-        assertEquals("Trivial match with single paren, full match", "aaaa",
-                     (String) v.elementAt(0));
-        assertEquals("Trivial match with single paren, matched paren", "aaaa",
-                     (String) v.elementAt(0));
-
-        reg.setPattern("(a+)b(b+)");
-        v = reg.getGroups("xaabb");
-        assertEquals(3, v.size());
-        assertEquals("aabb", (String) v.elementAt(0));
-        assertEquals("aa", (String) v.elementAt(1));
-        assertEquals("b", (String) v.elementAt(2));
-    }
-
-    public void testBugzillaReport14619() {
-        reg.setPattern("^(.*)/src/((.*/)*)([a-zA-Z0-9_\\.]+)\\.java$");
-        Vector v = reg.getGroups("de/tom/src/Google.java");
-        assertEquals(5, v.size());
-        assertEquals("de/tom", v.elementAt(1));
-        assertEquals("", v.elementAt(2));
-        assertEquals("", v.elementAt(3));
-        assertEquals("Google", v.elementAt(4));
-    }
-
-    public void testCaseInsensitiveMatch() {
-        reg.setPattern("aaaa");
-        assertTrue("aaaa doesn't match AAaa", !reg.matches("AAaa"));
-        assertTrue("aaaa matches AAaa ignoring case",
-                   reg.matches("AAaa", RegexpMatcher.MATCH_CASE_INSENSITIVE));
-    }
-
-
-// make sure there are no issues concerning line separator interpretation
-// a line separator for regex (perl) is always a unix line (ie \n)
-
-    public void testParagraphCharacter() throws IOException {
-        reg.setPattern("end of text$");
-        assertTrue("paragraph character", !reg.matches("end of text\u2029"));
-    }
-
-    public void testLineSeparatorCharacter() throws IOException {
-        reg.setPattern("end of text$");
-        assertTrue("line-separator character", !reg.matches("end of text\u2028"));
-    }
-
-    public void testNextLineCharacter() throws IOException {
-        reg.setPattern("end of text$");
-        assertTrue("next-line character", !reg.matches("end of text\u0085"));
-    }
-
-    public void testStandaloneCR() throws IOException {
-        reg.setPattern("end of text$");
-        assertTrue("standalone CR", !reg.matches("end of text\r"));
-    }
-
-    public void testWindowsLineSeparator() throws IOException {
-        reg.setPattern("end of text$");
-        assertTrue("Windows line separator", !reg.matches("end of text\r\n"));
-    }
-
-    public void testWindowsLineSeparator2() throws IOException {
-        reg.setPattern("end of text\r$");
-        assertTrue("Windows line separator", reg.matches("end of text\r\n"));
-    }
-
-    public void testUnixLineSeparator() throws IOException {
-        reg.setPattern("end of text$");
-        assertTrue("Unix line separator", reg.matches("end of text\n"));
-    }
-
-
-    public void testMultiVersusSingleLine() throws IOException {
-        StringBuffer buf = new StringBuffer();
-        buf.append("Line1").append(UNIX_LINE);
-        buf.append("starttest Line2").append(UNIX_LINE);
-        buf.append("Line3 endtest").append(UNIX_LINE);
-        buf.append("Line4").append(UNIX_LINE);
-        String text = buf.toString();
-
-        doStartTest1(text);
-        doStartTest2(text);
-        doEndTest1(text);
-        doEndTest2(text);
-    }
-
-    protected void doStartTest1(String text) {
-        reg.setPattern("^starttest");
-        assertTrue("^starttest in default mode", !reg.matches(text));
-        assertTrue("^starttest in single line mode",
-               !reg.matches(text, RegexpMatcher.MATCH_SINGLELINE));
-        assertTrue("^starttest in multi line mode",
-               reg.matches(text, RegexpMatcher.MATCH_MULTILINE));
-    }
-
-    protected void doStartTest2(String text) {
-        reg.setPattern("^Line1");
-        assertTrue("^Line1 in default mode", reg.matches(text));
-        assertTrue("^Line1 in single line mode",
-               reg.matches(text, RegexpMatcher.MATCH_SINGLELINE));
-        assertTrue("^Line1 in multi line mode",
-               reg.matches(text, RegexpMatcher.MATCH_MULTILINE));
-    }
-
-    protected void doEndTest1(String text) {
-        reg.setPattern("endtest$");
-        assertTrue("endtest$ in default mode", !reg.matches(text));
-        assertTrue("endtest$ in single line mode",
-               !reg.matches(text, RegexpMatcher.MATCH_SINGLELINE));
-        assertTrue("endtest$ in multi line mode",
-               reg.matches(text, RegexpMatcher.MATCH_MULTILINE));
-    }
-
-    protected void doEndTest2(String text) {
-        reg.setPattern("Line4$");
-        assertTrue("Line4$ in default mode", reg.matches(text));
-        assertTrue("Line4$ in single line mode",
-               reg.matches(text, RegexpMatcher.MATCH_SINGLELINE));
-        assertTrue("Line4$ in multi line mode",
-               reg.matches(text, RegexpMatcher.MATCH_MULTILINE));
-    }
-
-}
+/*
+ *  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.regexp;
+
+import java.io.IOException;
+import java.util.Vector;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for all implementations of the RegexpMatcher interface.
+ *
+ */
+public abstract class RegexpMatcherTest extends TestCase {
+
+    public final static String UNIX_LINE = "\n";
+
+    private RegexpMatcher reg;
+
+    public abstract RegexpMatcher getImplementation();
+
+    protected final RegexpMatcher getReg() {return reg;}
+
+    public RegexpMatcherTest(String name) {
+        super(name);
+    }
+
+    public void setUp() {
+        reg = getImplementation();
+    }
+
+    public void testMatches() {
+        reg.setPattern("aaaa");
+        assertTrue("aaaa should match itself", reg.matches("aaaa"));
+        assertTrue("aaaa should match xaaaa", reg.matches("xaaaa"));
+        assertTrue("aaaa shouldn\'t match xaaa", !reg.matches("xaaa"));
+        reg.setPattern("^aaaa");
+        assertTrue("^aaaa shouldn\'t match xaaaa", !reg.matches("xaaaa"));
+        assertTrue("^aaaa should match aaaax", reg.matches("aaaax"));
+        reg.setPattern("aaaa$");
+        assertTrue("aaaa$ shouldn\'t match aaaax", !reg.matches("aaaax"));
+        assertTrue("aaaa$ should match xaaaa", reg.matches("xaaaa"));
+        reg.setPattern("[0-9]+");
+        assertTrue("[0-9]+ should match 123", reg.matches("123"));
+        assertTrue("[0-9]+ should match 1", reg.matches("1"));
+        assertTrue("[0-9]+ shouldn\'t match \'\'", !reg.matches(""));
+        assertTrue("[0-9]+ shouldn\'t match a", !reg.matches("a"));
+        reg.setPattern("[0-9]*");
+        assertTrue("[0-9]* should match 123", reg.matches("123"));
+        assertTrue("[0-9]* should match 1", reg.matches("1"));
+        assertTrue("[0-9]* should match \'\'", reg.matches(""));
+        assertTrue("[0-9]* should match a", reg.matches("a"));
+        reg.setPattern("([0-9]+)=\\1");
+        assertTrue("([0-9]+)=\\1 should match 1=1", reg.matches("1=1"));
+        assertTrue("([0-9]+)=\\1 shouldn\'t match 1=2", !reg.matches("1=2"));
+    }
+
+    public void testGroups() {
+        reg.setPattern("aaaa");
+        Vector v = reg.getGroups("xaaaa");
+        assertEquals("No parens -> no extra groups", 1, v.size());
+        assertEquals("Trivial match with no parens", "aaaa",
+                     (String) v.elementAt(0));
+
+        reg.setPattern("(aaaa)");
+        v = reg.getGroups("xaaaa");
+        assertEquals("Trivial match with single paren", 2, v.size());
+        assertEquals("Trivial match with single paren, full match", "aaaa",
+                     (String) v.elementAt(0));
+        assertEquals("Trivial match with single paren, matched paren", "aaaa",
+                     (String) v.elementAt(0));
+
+        reg.setPattern("(a+)b(b+)");
+        v = reg.getGroups("xaabb");
+        assertEquals(3, v.size());
+        assertEquals("aabb", (String) v.elementAt(0));
+        assertEquals("aa", (String) v.elementAt(1));
+        assertEquals("b", (String) v.elementAt(2));
+    }
+
+    public void testBugzillaReport14619() {
+        reg.setPattern("^(.*)/src/((.*/)*)([a-zA-Z0-9_\\.]+)\\.java$");
+        Vector v = reg.getGroups("de/tom/src/Google.java");
+        assertEquals(5, v.size());
+        assertEquals("de/tom", v.elementAt(1));
+        assertEquals("", v.elementAt(2));
+        assertEquals("", v.elementAt(3));
+        assertEquals("Google", v.elementAt(4));
+    }
+
+    public void testCaseInsensitiveMatch() {
+        reg.setPattern("aaaa");
+        assertTrue("aaaa doesn't match AAaa", !reg.matches("AAaa"));
+        assertTrue("aaaa matches AAaa ignoring case",
+                   reg.matches("AAaa", RegexpMatcher.MATCH_CASE_INSENSITIVE));
+    }
+
+
+// make sure there are no issues concerning line separator interpretation
+// a line separator for regex (perl) is always a unix line (ie \n)
+
+    public void testParagraphCharacter() throws IOException {
+        reg.setPattern("end of text$");
+        assertTrue("paragraph character", !reg.matches("end of text\u2029"));
+    }
+
+    public void testLineSeparatorCharacter() throws IOException {
+        reg.setPattern("end of text$");
+        assertTrue("line-separator character", !reg.matches("end of text\u2028"));
+    }
+
+    public void testNextLineCharacter() throws IOException {
+        reg.setPattern("end of text$");
+        assertTrue("next-line character", !reg.matches("end of text\u0085"));
+    }
+
+    public void testStandaloneCR() throws IOException {
+        reg.setPattern("end of text$");
+        assertTrue("standalone CR", !reg.matches("end of text\r"));
+    }
+
+    public void testWindowsLineSeparator() throws IOException {
+        reg.setPattern("end of text$");
+        assertTrue("Windows line separator", !reg.matches("end of text\r\n"));
+    }
+
+    public void testWindowsLineSeparator2() throws IOException {
+        reg.setPattern("end of text\r$");
+        assertTrue("Windows line separator", reg.matches("end of text\r\n"));
+    }
+
+    public void testUnixLineSeparator() throws IOException {
+        reg.setPattern("end of text$");
+        assertTrue("Unix line separator", reg.matches("end of text\n"));
+    }
+
+
+    public void testMultiVersusSingleLine() throws IOException {
+        StringBuffer buf = new StringBuffer();
+        buf.append("Line1").append(UNIX_LINE);
+        buf.append("starttest Line2").append(UNIX_LINE);
+        buf.append("Line3 endtest").append(UNIX_LINE);
+        buf.append("Line4").append(UNIX_LINE);
+        String text = buf.toString();
+
+        doStartTest1(text);
+        doStartTest2(text);
+        doEndTest1(text);
+        doEndTest2(text);
+    }
+
+    protected void doStartTest1(String text) {
+        reg.setPattern("^starttest");
+        assertTrue("^starttest in default mode", !reg.matches(text));
+        assertTrue("^starttest in single line mode",
+               !reg.matches(text, RegexpMatcher.MATCH_SINGLELINE));
+        assertTrue("^starttest in multi line mode",
+               reg.matches(text, RegexpMatcher.MATCH_MULTILINE));
+    }
+
+    protected void doStartTest2(String text) {
+        reg.setPattern("^Line1");
+        assertTrue("^Line1 in default mode", reg.matches(text));
+        assertTrue("^Line1 in single line mode",
+               reg.matches(text, RegexpMatcher.MATCH_SINGLELINE));
+        assertTrue("^Line1 in multi line mode",
+               reg.matches(text, RegexpMatcher.MATCH_MULTILINE));
+    }
+
+    protected void doEndTest1(String text) {
+        reg.setPattern("endtest$");
+        assertTrue("endtest$ in default mode", !reg.matches(text));
+        assertTrue("endtest$ in single line mode",
+               !reg.matches(text, RegexpMatcher.MATCH_SINGLELINE));
+        assertTrue("endtest$ in multi line mode",
+               reg.matches(text, RegexpMatcher.MATCH_MULTILINE));
+    }
+
+    protected void doEndTest2(String text) {
+        reg.setPattern("Line4$");
+        assertTrue("Line4$ in default mode", reg.matches(text));
+        assertTrue("Line4$ in single line mode",
+               reg.matches(text, RegexpMatcher.MATCH_SINGLELINE));
+        assertTrue("Line4$ in multi line mode",
+               reg.matches(text, RegexpMatcher.MATCH_MULTILINE));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpTest.java b/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpTest.java
index b083bfa..5cfe8c9 100644
--- a/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpTest.java
@@ -1,63 +1,63 @@
-/*
- *  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.regexp;
-
-/**
- * Tests for all implementations of the Regexp interface.
- *
- */
-public abstract class RegexpTest extends RegexpMatcherTest {
-
-    private static final String test = "abcdefg-abcdefg";
-    private static final String pattern = "ab([^d]*)d([^f]*)f";
-
-    public RegexpTest(String name) {
-        super(name);
-    }
-
-    public final RegexpMatcher getImplementation() {
-        return getRegexpImplementation();
-    }
-
-    public abstract Regexp getRegexpImplementation();
-
-    public void testSubstitution() {
-        Regexp reg = (Regexp) getReg();
-        reg.setPattern(pattern);
-        assertTrue(reg.matches(test));
-        assertEquals("abedcfg-abcdefg", reg.substitute(test, "ab\\2d\\1f",
-                                                       Regexp.MATCH_DEFAULT));
-    }
-
-    public void testReplaceFirstSubstitution() {
-        Regexp reg = (Regexp) getReg();
-        reg.setPattern(pattern);
-        assertTrue(reg.matches(test));
-        assertEquals("abedcfg-abcdefg", reg.substitute(test, "ab\\2d\\1f",
-                                                       Regexp.REPLACE_FIRST));
-    }
-
-    public void testReplaceAllSubstitution() {
-        Regexp reg = (Regexp) getReg();
-        reg.setPattern(pattern);
-        assertTrue(reg.matches(test));
-        assertEquals("abedcfg-abedcfg", reg.substitute(test, "ab\\2d\\1f",
-                                                       Regexp.REPLACE_ALL));
-    }
-}
+/*
+ *  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.regexp;
+
+/**
+ * Tests for all implementations of the Regexp interface.
+ *
+ */
+public abstract class RegexpTest extends RegexpMatcherTest {
+
+    private static final String test = "abcdefg-abcdefg";
+    private static final String pattern = "ab([^d]*)d([^f]*)f";
+
+    public RegexpTest(String name) {
+        super(name);
+    }
+
+    public final RegexpMatcher getImplementation() {
+        return getRegexpImplementation();
+    }
+
+    public abstract Regexp getRegexpImplementation();
+
+    public void testSubstitution() {
+        Regexp reg = (Regexp) getReg();
+        reg.setPattern(pattern);
+        assertTrue(reg.matches(test));
+        assertEquals("abedcfg-abcdefg", reg.substitute(test, "ab\\2d\\1f",
+                                                       Regexp.MATCH_DEFAULT));
+    }
+
+    public void testReplaceFirstSubstitution() {
+        Regexp reg = (Regexp) getReg();
+        reg.setPattern(pattern);
+        assertTrue(reg.matches(test));
+        assertEquals("abedcfg-abcdefg", reg.substitute(test, "ab\\2d\\1f",
+                                                       Regexp.REPLACE_FIRST));
+    }
+
+    public void testReplaceAllSubstitution() {
+        Regexp reg = (Regexp) getReg();
+        reg.setPattern(pattern);
+        assertTrue(reg.matches(test));
+        assertEquals("abedcfg-abedcfg", reg.substitute(test, "ab\\2d\\1f",
+                                                       Regexp.REPLACE_ALL));
+    }
+}


[11/21] ant git commit: Normalise tabulation and line breaks

Posted by gi...@apache.org.
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/PermissionsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/PermissionsTest.java b/src/tests/junit/org/apache/tools/ant/types/PermissionsTest.java
index 37e643d..1e43fe1 100644
--- a/src/tests/junit/org/apache/tools/ant/types/PermissionsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/PermissionsTest.java
@@ -1,158 +1,158 @@
-/*
- *  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.types;
-
-import org.apache.tools.ant.ExitException;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.fail;
-
-/**
- * JUnit 3 testcases for org.apache.tools.ant.types.Permissions.
- *
- */
-public class PermissionsTest {
-
-    Permissions perms;
-
-    @Before
-    public void setUp() {
-        perms = new Permissions();
-        Permissions.Permission perm = new Permissions.Permission();
-        // Grant extra permissions to read and write the user.* properties and read to the
-        // java.home property
-        perm.setActions("read, write");
-        perm.setName("user.*");
-        perm.setClass("java.util.PropertyPermission");
-        perms.addConfiguredGrant(perm);
-
-        perm = new Permissions.Permission();
-        perm.setActions("read");
-        perm.setName("java.home");
-        perm.setClass("java.util.PropertyPermission");
-        perms.addConfiguredGrant(perm);
-
-        perm = new Permissions.Permission();
-        perm.setActions("read");
-        perm.setName("file.encoding");
-        perm.setClass("java.util.PropertyPermission");
-        perms.addConfiguredGrant(perm);
-
-        // Revoke permission to write user.home (granted above via user.*), still able to read though.
-        // and the default granted permission to read os.name.
-        perm = new Permissions.Permission();
-        perm.setActions("write");
-        perm.setName("user.home");
-        perm.setClass("java.util.PropertyPermission");
-        perms.addConfiguredRevoke(perm);
-
-        perm = new Permissions.Permission();
-        perm.setActions("read");
-        perm.setName("os.*");
-        perm.setClass("java.util.PropertyPermission");
-        perms.addConfiguredRevoke(perm);
-    }
-
-    /** Tests a permission that is granted per default. */
-    @Test
-    public void testDefaultGranted() {
-        perms.setSecurityManager();
-        try {
-            System.getProperty("line.separator");
-        } finally {
-            perms.restoreSecurityManager();
-        }
-    }
-
-    /** Tests a permission that has been granted later via wildcard. */
-    @Test
-    public void testGranted() {
-        perms.setSecurityManager();
-        try {
-            String s = System.getProperty("user.name");
-            System.setProperty("user.name", s);
-        } finally {
-            perms.restoreSecurityManager();
-        }
-    }
-
-    /** Tests a permission that has been granted and revoked later. */
-    @Test
-    public void testGrantedAndRevoked() {
-        perms.setSecurityManager();
-        try {
-            String s = System.getProperty("user.home");
-            System.setProperty("user.home", s);
-            fail("Could perform an action that should have been forbidden.");
-        } catch (SecurityException e){
-            // Was expected, test passes
-        } finally {
-            perms.restoreSecurityManager();
-        }
-    }
-
-    /** Tests a permission that is granted as per default but revoked later via wildcard. */
-    @Test
-    public void testDefaultRevoked() {
-        perms.setSecurityManager();
-        try {
-            System.getProperty("os.name");
-            fail("Could perform an action that should have been forbidden.");
-        } catch (SecurityException e){
-            // Was expected, test passes
-        } finally {
-            perms.restoreSecurityManager();
-        }
-    }
-    /** Tests a permission that has not been granted or revoked. */
-    @Test
-    public void testOther() {
-        String ls = System.getProperty("line.separator");
-        perms.setSecurityManager();
-        try {
-            System.setProperty("line.separator",ls);
-            fail("Could perform an action that should have been forbidden.");
-        } catch (SecurityException e){
-            //TODO assert exception message
-            // Was expected, test passes
-        } finally {
-            perms.restoreSecurityManager();
-        }
-    }
-
-    /** Tests an exit condition. */
-    @Test
-    public void testExit() {
-        perms.setSecurityManager();
-        try {
-            System.out.println("If this is the last line on standard out the testExit f.a.i.l.e.d");
-            System.exit(3);
-            fail("Totaly impossible that this fail is ever executed. Please let me know if it is!");
-        } catch (ExitException e) {
-            if (e.getStatus() != 3) {
-                fail("Received wrong exit status in Exit Exception.");
-            }
-            System.out.println("testExit successful.");
-        } finally {
-            perms.restoreSecurityManager();
-        }
-    }
-
-}
+/*
+ *  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.types;
+
+import org.apache.tools.ant.ExitException;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.fail;
+
+/**
+ * JUnit 3 testcases for org.apache.tools.ant.types.Permissions.
+ *
+ */
+public class PermissionsTest {
+
+    Permissions perms;
+
+    @Before
+    public void setUp() {
+        perms = new Permissions();
+        Permissions.Permission perm = new Permissions.Permission();
+        // Grant extra permissions to read and write the user.* properties and read to the
+        // java.home property
+        perm.setActions("read, write");
+        perm.setName("user.*");
+        perm.setClass("java.util.PropertyPermission");
+        perms.addConfiguredGrant(perm);
+
+        perm = new Permissions.Permission();
+        perm.setActions("read");
+        perm.setName("java.home");
+        perm.setClass("java.util.PropertyPermission");
+        perms.addConfiguredGrant(perm);
+
+        perm = new Permissions.Permission();
+        perm.setActions("read");
+        perm.setName("file.encoding");
+        perm.setClass("java.util.PropertyPermission");
+        perms.addConfiguredGrant(perm);
+
+        // Revoke permission to write user.home (granted above via user.*), still able to read though.
+        // and the default granted permission to read os.name.
+        perm = new Permissions.Permission();
+        perm.setActions("write");
+        perm.setName("user.home");
+        perm.setClass("java.util.PropertyPermission");
+        perms.addConfiguredRevoke(perm);
+
+        perm = new Permissions.Permission();
+        perm.setActions("read");
+        perm.setName("os.*");
+        perm.setClass("java.util.PropertyPermission");
+        perms.addConfiguredRevoke(perm);
+    }
+
+    /** Tests a permission that is granted per default. */
+    @Test
+    public void testDefaultGranted() {
+        perms.setSecurityManager();
+        try {
+            System.getProperty("line.separator");
+        } finally {
+            perms.restoreSecurityManager();
+        }
+    }
+
+    /** Tests a permission that has been granted later via wildcard. */
+    @Test
+    public void testGranted() {
+        perms.setSecurityManager();
+        try {
+            String s = System.getProperty("user.name");
+            System.setProperty("user.name", s);
+        } finally {
+            perms.restoreSecurityManager();
+        }
+    }
+
+    /** Tests a permission that has been granted and revoked later. */
+    @Test
+    public void testGrantedAndRevoked() {
+        perms.setSecurityManager();
+        try {
+            String s = System.getProperty("user.home");
+            System.setProperty("user.home", s);
+            fail("Could perform an action that should have been forbidden.");
+        } catch (SecurityException e){
+            // Was expected, test passes
+        } finally {
+            perms.restoreSecurityManager();
+        }
+    }
+
+    /** Tests a permission that is granted as per default but revoked later via wildcard. */
+    @Test
+    public void testDefaultRevoked() {
+        perms.setSecurityManager();
+        try {
+            System.getProperty("os.name");
+            fail("Could perform an action that should have been forbidden.");
+        } catch (SecurityException e){
+            // Was expected, test passes
+        } finally {
+            perms.restoreSecurityManager();
+        }
+    }
+    /** Tests a permission that has not been granted or revoked. */
+    @Test
+    public void testOther() {
+        String ls = System.getProperty("line.separator");
+        perms.setSecurityManager();
+        try {
+            System.setProperty("line.separator",ls);
+            fail("Could perform an action that should have been forbidden.");
+        } catch (SecurityException e){
+            //TODO assert exception message
+            // Was expected, test passes
+        } finally {
+            perms.restoreSecurityManager();
+        }
+    }
+
+    /** Tests an exit condition. */
+    @Test
+    public void testExit() {
+        perms.setSecurityManager();
+        try {
+            System.out.println("If this is the last line on standard out the testExit f.a.i.l.e.d");
+            System.exit(3);
+            fail("Totaly impossible that this fail is ever executed. Please let me know if it is!");
+        } catch (ExitException e) {
+            if (e.getStatus() != 3) {
+                fail("Received wrong exit status in Exit Exception.");
+            }
+            System.out.println("testExit successful.");
+        } finally {
+            perms.restoreSecurityManager();
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/PolyTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/PolyTest.java b/src/tests/junit/org/apache/tools/ant/types/PolyTest.java
index 89f6268..8dd132a 100644
--- a/src/tests/junit/org/apache/tools/ant/types/PolyTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/PolyTest.java
@@ -1,79 +1,79 @@
-/*
- *  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.types;
-
-import org.apache.tools.ant.AntAssert;
-import org.apache.tools.ant.BuildFileRule;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class PolyTest {
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-    
-    @Before
-    public void setUp() {
-        buildRule.configureProject("src/etc/testcases/types/poly.xml");
-    }
-
-    @Test
-    public void testFileSet() {
-        buildRule.executeTarget("fileset");
-        AntAssert.assertContains( "types.FileSet", buildRule.getLog());
-    }
-
-    @Test
-    public void testFileSetAntType() {
-        buildRule.executeTarget("fileset-ant-type");
-        AntAssert.assertContains("types.PolyTest$MyFileSet", buildRule.getLog());
-    }
-
-    @Test
-    public void testPath() {
-        buildRule.executeTarget("path");
-        AntAssert.assertContains( "types.Path", buildRule.getLog());
-    }
-
-    @Test
-    public void testPathAntType() {
-        buildRule.executeTarget("path-ant-type");
-        AntAssert.assertContains( "types.PolyTest$MyPath", buildRule.getLog());
-    }
-
-    public static class MyFileSet extends FileSet {}
-
-    public static class MyPath extends Path {
-        public MyPath(Project project) {
-            super(project);
-        }
-    }
-
-    public static class MyTask extends Task {
-        public void addPath(Path path) {
-            log("class of path is " + path.getClass());
-        }
-        public void addFileset(FileSet fileset) {
-            log("class of fileset is " + fileset.getClass());
-        }
-    }
-}
+/*
+ *  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.types;
+
+import org.apache.tools.ant.AntAssert;
+import org.apache.tools.ant.BuildFileRule;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class PolyTest {
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject("src/etc/testcases/types/poly.xml");
+    }
+
+    @Test
+    public void testFileSet() {
+        buildRule.executeTarget("fileset");
+        AntAssert.assertContains( "types.FileSet", buildRule.getLog());
+    }
+
+    @Test
+    public void testFileSetAntType() {
+        buildRule.executeTarget("fileset-ant-type");
+        AntAssert.assertContains("types.PolyTest$MyFileSet", buildRule.getLog());
+    }
+
+    @Test
+    public void testPath() {
+        buildRule.executeTarget("path");
+        AntAssert.assertContains( "types.Path", buildRule.getLog());
+    }
+
+    @Test
+    public void testPathAntType() {
+        buildRule.executeTarget("path-ant-type");
+        AntAssert.assertContains( "types.PolyTest$MyPath", buildRule.getLog());
+    }
+
+    public static class MyFileSet extends FileSet {}
+
+    public static class MyPath extends Path {
+        public MyPath(Project project) {
+            super(project);
+        }
+    }
+
+    public static class MyTask extends Task {
+        public void addPath(Path path) {
+            log("class of path is " + path.getClass());
+        }
+        public void addFileset(FileSet fileset) {
+            log("class of fileset is " + fileset.getClass());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/RedirectorElementTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/RedirectorElementTest.java b/src/tests/junit/org/apache/tools/ant/types/RedirectorElementTest.java
index 62c76f0..f4c2abe 100644
--- a/src/tests/junit/org/apache/tools/ant/types/RedirectorElementTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/RedirectorElementTest.java
@@ -1,86 +1,86 @@
-/*
- *  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.types;
-
-import org.apache.tools.ant.AntAssert;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.BuildFileRule;
-import org.apache.tools.ant.Project;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-public class RedirectorElementTest {
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject("src/etc/testcases/types/redirector.xml", Project.MSG_VERBOSE);
-    }
-
-    @Test
-    public void test1() {
-        buildRule.executeTarget("test1");
-        assertTrue((buildRule.getProject().<Object> getReference("test1")
-            instanceof RedirectorElement));
-    }
-
-    @Test
-    public void test2() {
-        try {
-            buildRule.executeTarget("test2");
-            fail("You must not specify more than one attribute when using refid");
-        } catch (BuildException ex) {
-            //TODO assert exception message
-        }
-    }
-
-    @Test
-    public void test3() {
-        try {
-            buildRule.executeTarget("test3");
-            fail("You must not specify nested elements when using refid");
-        } catch (BuildException ex) {
-            //TODO assert exception message
-        }
-    }
-
-    @Test
-    public void test4() {
-        buildRule.executeTarget("test4");
-    }
-
-    @Test
-    public void testLogInputString() {
-        buildRule.executeTarget("testLogInputString");
-        if (buildRule.getLog().indexOf("testLogInputString can-cat") >=0 ) {
-            AntAssert.assertContains("Using input string", buildRule.getFullLog());
-        }
-    }
-
-    @Test
-    public void testRefid() {
-        buildRule.executeTarget("testRefid");
-    }
-
-}
+/*
+ *  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.types;
+
+import org.apache.tools.ant.AntAssert;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileRule;
+import org.apache.tools.ant.Project;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+public class RedirectorElementTest {
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject("src/etc/testcases/types/redirector.xml", Project.MSG_VERBOSE);
+    }
+
+    @Test
+    public void test1() {
+        buildRule.executeTarget("test1");
+        assertTrue((buildRule.getProject().<Object> getReference("test1")
+            instanceof RedirectorElement));
+    }
+
+    @Test
+    public void test2() {
+        try {
+            buildRule.executeTarget("test2");
+            fail("You must not specify more than one attribute when using refid");
+        } catch (BuildException ex) {
+            //TODO assert exception message
+        }
+    }
+
+    @Test
+    public void test3() {
+        try {
+            buildRule.executeTarget("test3");
+            fail("You must not specify nested elements when using refid");
+        } catch (BuildException ex) {
+            //TODO assert exception message
+        }
+    }
+
+    @Test
+    public void test4() {
+        buildRule.executeTarget("test4");
+    }
+
+    @Test
+    public void testLogInputString() {
+        buildRule.executeTarget("testLogInputString");
+        if (buildRule.getLog().indexOf("testLogInputString can-cat") >=0 ) {
+            AntAssert.assertContains("Using input string", buildRule.getFullLog());
+        }
+    }
+
+    @Test
+    public void testRefid() {
+        buildRule.executeTarget("testRefid");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/ResourceOutputTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/ResourceOutputTest.java b/src/tests/junit/org/apache/tools/ant/types/ResourceOutputTest.java
index 0a48a42..b66335a 100644
--- a/src/tests/junit/org/apache/tools/ant/types/ResourceOutputTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/ResourceOutputTest.java
@@ -1,160 +1,160 @@
-/*
- *  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.types;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.UnknownServiceException;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.Zip;
-import org.apache.tools.ant.types.resources.ImmutableResourceException;
-import org.apache.tools.ant.types.resources.PropertyResource;
-import org.apache.tools.ant.types.resources.StringResource;
-import org.apache.tools.ant.types.resources.URLResource;
-import org.apache.tools.ant.types.resources.ZipResource;
-import org.apache.tools.ant.util.FileUtils;
-import org.apache.tools.ant.util.ResourceUtils;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-public class ResourceOutputTest {
-
-    private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
-    private static final File basedir = new File(System.getProperty("root"),
-        "src/etc/testcases/types/resources");
-
-    private Project project;
-
-    @Before
-    public void setUp() {
-        project = new Project();
-        project.init();
-        project.setUserProperty("basedir" , basedir.getAbsolutePath());
-    }
-
-    @Test
-    public void testresourceoutput() {
-        try {
-            testoutputbe(new Resource("foo"));
-            fail("should have caught UnsupportedOperationException");
-        } catch (UnsupportedOperationException e) {
-            //TODO assert exception message
-        }
-    }
-
-    @Test
-    public void teststringoutput1() {
-        StringResource r = new StringResource();
-        testoutputbe(r);
-        assertEquals("foo", r.getValue());
-    }
-
-    @Test
-    public void teststringoutput2() throws IOException {
-        StringResource r = new StringResource("bar");
-        try {
-            testoutput(r);
-            fail("should have caught ImmutableResourceException");
-        } catch (ImmutableResourceException e) {
-            //TODO assert exception message
-        }
-        assertEquals("bar", r.getValue());
-    }
-
-    @Test
-    public void testpropertyoutput1() {
-        PropertyResource r = new PropertyResource(project, "bar");
-        testoutputbe(r);
-        assertEquals("foo", project.getProperty("bar"));
-    }
-
-    @Test
-    public void testpropertyoutput2() throws IOException {
-        project.setNewProperty("bar", "bar");
-        PropertyResource r = new PropertyResource(project, "bar");
-        try {
-            testoutput(r);
-            fail("should have caught ImmutableResourceException");
-        } catch (ImmutableResourceException e) {
-            //TODO assert exception message
-        }
-        assertEquals("bar", project.getProperty("bar"));
-    }
-
-    @Test
-    public void testurloutput() throws IOException {
-        File f = project.resolveFile("testurloutput");
-        try {
-            FILE_UTILS.createNewFile(f);
-            testoutput(new URLResource(f));
-            fail("should have caught UnknownServiceException");
-        } catch (UnknownServiceException e) {
-            //TODO assert exception message
-        } finally {
-            if (!f.delete()) {
-                f.deleteOnExit();
-            }
-        }
-    }
-
-    @Test
-    public void testzipentryoutput() {
-        Zip z = new Zip();
-        z.setProject(project);
-        Zip.WhenEmpty create = new Zip.WhenEmpty();
-        create.setValue("create");
-        z.setWhenempty(create);
-        z.setBasedir(basedir);
-        z.setExcludes("**/*");
-        File f = project.resolveFile("foo");
-        z.setDestFile(f);
-        z.execute();
-        ZipResource r = new ZipResource();
-        r.setZipfile(f);
-        r.setName("foo");
-        try {
-            testoutputbe(r);
-            fail("should have caught UnsupportedOperationException");
-        } catch (UnsupportedOperationException e) {
-            //TODO assert exception message
-        } finally {
-            if (!f.delete()) {
-                f.deleteOnExit();
-            }
-        }
-    }
-
-    private void testoutputbe(Resource dest) {
-        try {
-            testoutput(dest);
-        } catch (IOException e) {
-            throw new BuildException(e);
-        }
-    }
-
-    private void testoutput(Resource dest) throws IOException {
-        ResourceUtils.copyResource(new StringResource("foo"), dest, null);
-    }
-
-}
+/*
+ *  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.types;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.UnknownServiceException;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Zip;
+import org.apache.tools.ant.types.resources.ImmutableResourceException;
+import org.apache.tools.ant.types.resources.PropertyResource;
+import org.apache.tools.ant.types.resources.StringResource;
+import org.apache.tools.ant.types.resources.URLResource;
+import org.apache.tools.ant.types.resources.ZipResource;
+import org.apache.tools.ant.util.FileUtils;
+import org.apache.tools.ant.util.ResourceUtils;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+public class ResourceOutputTest {
+
+    private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
+    private static final File basedir = new File(System.getProperty("root"),
+        "src/etc/testcases/types/resources");
+
+    private Project project;
+
+    @Before
+    public void setUp() {
+        project = new Project();
+        project.init();
+        project.setUserProperty("basedir" , basedir.getAbsolutePath());
+    }
+
+    @Test
+    public void testresourceoutput() {
+        try {
+            testoutputbe(new Resource("foo"));
+            fail("should have caught UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            //TODO assert exception message
+        }
+    }
+
+    @Test
+    public void teststringoutput1() {
+        StringResource r = new StringResource();
+        testoutputbe(r);
+        assertEquals("foo", r.getValue());
+    }
+
+    @Test
+    public void teststringoutput2() throws IOException {
+        StringResource r = new StringResource("bar");
+        try {
+            testoutput(r);
+            fail("should have caught ImmutableResourceException");
+        } catch (ImmutableResourceException e) {
+            //TODO assert exception message
+        }
+        assertEquals("bar", r.getValue());
+    }
+
+    @Test
+    public void testpropertyoutput1() {
+        PropertyResource r = new PropertyResource(project, "bar");
+        testoutputbe(r);
+        assertEquals("foo", project.getProperty("bar"));
+    }
+
+    @Test
+    public void testpropertyoutput2() throws IOException {
+        project.setNewProperty("bar", "bar");
+        PropertyResource r = new PropertyResource(project, "bar");
+        try {
+            testoutput(r);
+            fail("should have caught ImmutableResourceException");
+        } catch (ImmutableResourceException e) {
+            //TODO assert exception message
+        }
+        assertEquals("bar", project.getProperty("bar"));
+    }
+
+    @Test
+    public void testurloutput() throws IOException {
+        File f = project.resolveFile("testurloutput");
+        try {
+            FILE_UTILS.createNewFile(f);
+            testoutput(new URLResource(f));
+            fail("should have caught UnknownServiceException");
+        } catch (UnknownServiceException e) {
+            //TODO assert exception message
+        } finally {
+            if (!f.delete()) {
+                f.deleteOnExit();
+            }
+        }
+    }
+
+    @Test
+    public void testzipentryoutput() {
+        Zip z = new Zip();
+        z.setProject(project);
+        Zip.WhenEmpty create = new Zip.WhenEmpty();
+        create.setValue("create");
+        z.setWhenempty(create);
+        z.setBasedir(basedir);
+        z.setExcludes("**/*");
+        File f = project.resolveFile("foo");
+        z.setDestFile(f);
+        z.execute();
+        ZipResource r = new ZipResource();
+        r.setZipfile(f);
+        r.setName("foo");
+        try {
+            testoutputbe(r);
+            fail("should have caught UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            //TODO assert exception message
+        } finally {
+            if (!f.delete()) {
+                f.deleteOnExit();
+            }
+        }
+    }
+
+    private void testoutputbe(Resource dest) {
+        try {
+            testoutput(dest);
+        } catch (IOException e) {
+            throw new BuildException(e);
+        }
+    }
+
+    private void testoutput(Resource dest) throws IOException {
+        ResourceUtils.copyResource(new StringResource("foo"), dest, null);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/TarFileSetTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/TarFileSetTest.java b/src/tests/junit/org/apache/tools/ant/types/TarFileSetTest.java
index 3b186f9..b30168a 100644
--- a/src/tests/junit/org/apache/tools/ant/types/TarFileSetTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/TarFileSetTest.java
@@ -1,119 +1,119 @@
-/*
- *  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.types;
-
-import java.io.File;
-
-import org.apache.tools.ant.BuildException;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-/**
- * JUnit 3 testcases for org.apache.tools.ant.types.TarFileSet.
- *
- * <p>This doesn't actually test much, mainly reference handling.
- *
- */
-
-public class TarFileSetTest extends AbstractFileSetTest {
-
-
-    protected AbstractFileSet getInstance() {
-        return new TarFileSet();
-    }
-
-    @Test
-    public final void testAttributes() {
-        TarFileSet f = (TarFileSet)getInstance();
-        //check that dir and src are incompatible
-        f.setSrc(new File("example.tar"));
-        try {
-            f.setDir(new File("examples"));
-            fail("can add dir to "
-                    + f.getDataTypeName()
-                    + " when a src is already present");
-        } catch (BuildException be) {
-            assertEquals("Cannot set both dir and src attributes",be.getMessage());
-        }
-        f = (TarFileSet)getInstance();
-        //check that dir and src are incompatible
-        f.setDir(new File("examples"));
-        try {
-            f.setSrc(new File("example.tar"));
-            fail("can add src to "
-                    + f.getDataTypeName()
-                    + " when a dir is already present");
-        } catch (BuildException be) {
-            assertEquals("Cannot set both dir and src attributes",be.getMessage());
-        }
-        //check that fullpath and prefix are incompatible
-        f = (TarFileSet)getInstance();
-        f.setSrc(new File("example.tar"));
-        f.setPrefix("/examples");
-        try {
-            f.setFullpath("/doc/manual/index.html");
-            fail("Can add fullpath to "
-                    + f.getDataTypeName()
-                    + " when a prefix is already present");
-        } catch (BuildException be) {
-            assertEquals("Cannot set both fullpath and prefix attributes", be.getMessage());
-        }
-        f = (TarFileSet)getInstance();
-        f.setSrc(new File("example.tar"));
-        f.setFullpath("/doc/manual/index.html");
-        try {
-            f.setPrefix("/examples");
-            fail("Can add prefix to "
-                    + f.getDataTypeName()
-                    + " when a fullpath is already present");
-        } catch (BuildException be) {
-            assertEquals("Cannot set both fullpath and prefix attributes", be.getMessage());
-        }
-        // check that reference tarfilesets cannot have specific attributes
-        f = (TarFileSet)getInstance();
-        f.setRefid(new Reference(getProject(), "test"));
-        try {
-            f.setSrc(new File("example.tar"));
-            fail("Can add src to "
-                    + f.getDataTypeName()
-                    + " when a refid is already present");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one "
-            + "attribute when using refid", be.getMessage());
-        }
-        // check that a reference tarfileset gets the same attributes as the original
-        f = (TarFileSet)getInstance();
-        f.setSrc(new File("example.tar"));
-        f.setPrefix("/examples");
-        f.setFileMode("600");
-        f.setDirMode("530");
-        getProject().addReference("test",f);
-        TarFileSet zid=(TarFileSet)getInstance();
-        zid.setRefid(new Reference(getProject(), "test"));
-        assertTrue("src attribute copied by copy constructor",zid.getSrc(getProject()).equals(f.getSrc(getProject())));
-        assertTrue("prefix attribute copied by copy constructor",f.getPrefix(getProject()).equals(zid.getPrefix(getProject())));
-        assertTrue("file mode attribute copied by copy constructor",f.getFileMode(getProject())==zid.getFileMode(getProject()));
-        assertTrue("dir mode attribute copied by copy constructor",f.getDirMode(getProject())==zid.getDirMode(getProject()));
-      }
-
-
-}
+/*
+ *  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.types;
+
+import java.io.File;
+
+import org.apache.tools.ant.BuildException;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * JUnit 3 testcases for org.apache.tools.ant.types.TarFileSet.
+ *
+ * <p>This doesn't actually test much, mainly reference handling.
+ *
+ */
+
+public class TarFileSetTest extends AbstractFileSetTest {
+
+
+    protected AbstractFileSet getInstance() {
+        return new TarFileSet();
+    }
+
+    @Test
+    public final void testAttributes() {
+        TarFileSet f = (TarFileSet)getInstance();
+        //check that dir and src are incompatible
+        f.setSrc(new File("example.tar"));
+        try {
+            f.setDir(new File("examples"));
+            fail("can add dir to "
+                    + f.getDataTypeName()
+                    + " when a src is already present");
+        } catch (BuildException be) {
+            assertEquals("Cannot set both dir and src attributes",be.getMessage());
+        }
+        f = (TarFileSet)getInstance();
+        //check that dir and src are incompatible
+        f.setDir(new File("examples"));
+        try {
+            f.setSrc(new File("example.tar"));
+            fail("can add src to "
+                    + f.getDataTypeName()
+                    + " when a dir is already present");
+        } catch (BuildException be) {
+            assertEquals("Cannot set both dir and src attributes",be.getMessage());
+        }
+        //check that fullpath and prefix are incompatible
+        f = (TarFileSet)getInstance();
+        f.setSrc(new File("example.tar"));
+        f.setPrefix("/examples");
+        try {
+            f.setFullpath("/doc/manual/index.html");
+            fail("Can add fullpath to "
+                    + f.getDataTypeName()
+                    + " when a prefix is already present");
+        } catch (BuildException be) {
+            assertEquals("Cannot set both fullpath and prefix attributes", be.getMessage());
+        }
+        f = (TarFileSet)getInstance();
+        f.setSrc(new File("example.tar"));
+        f.setFullpath("/doc/manual/index.html");
+        try {
+            f.setPrefix("/examples");
+            fail("Can add prefix to "
+                    + f.getDataTypeName()
+                    + " when a fullpath is already present");
+        } catch (BuildException be) {
+            assertEquals("Cannot set both fullpath and prefix attributes", be.getMessage());
+        }
+        // check that reference tarfilesets cannot have specific attributes
+        f = (TarFileSet)getInstance();
+        f.setRefid(new Reference(getProject(), "test"));
+        try {
+            f.setSrc(new File("example.tar"));
+            fail("Can add src to "
+                    + f.getDataTypeName()
+                    + " when a refid is already present");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one "
+            + "attribute when using refid", be.getMessage());
+        }
+        // check that a reference tarfileset gets the same attributes as the original
+        f = (TarFileSet)getInstance();
+        f.setSrc(new File("example.tar"));
+        f.setPrefix("/examples");
+        f.setFileMode("600");
+        f.setDirMode("530");
+        getProject().addReference("test",f);
+        TarFileSet zid=(TarFileSet)getInstance();
+        zid.setRefid(new Reference(getProject(), "test"));
+        assertTrue("src attribute copied by copy constructor",zid.getSrc(getProject()).equals(f.getSrc(getProject())));
+        assertTrue("prefix attribute copied by copy constructor",f.getPrefix(getProject()).equals(zid.getPrefix(getProject())));
+        assertTrue("file mode attribute copied by copy constructor",f.getFileMode(getProject())==zid.getFileMode(getProject()));
+        assertTrue("dir mode attribute copied by copy constructor",f.getDirMode(getProject())==zid.getDirMode(getProject()));
+      }
+
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/XMLCatalogBuildFileTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/XMLCatalogBuildFileTest.java b/src/tests/junit/org/apache/tools/ant/types/XMLCatalogBuildFileTest.java
index ce796b1..96c0c5d 100644
--- a/src/tests/junit/org/apache/tools/ant/types/XMLCatalogBuildFileTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/XMLCatalogBuildFileTest.java
@@ -1,98 +1,98 @@
-/*
- *  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.types;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * testcases for org.apache.tools.ant.types.XMLCatalog
- *
- * @see org.apache.tools.ant.types.XMLCatalogTest
- *
- */
-public class XMLCatalogBuildFileTest {
-
-     @Rule
-     public BuildFileRule buildRule = new BuildFileRule();
-
-
-
-    //
-    // Ensure that an external entity resolves as expected with NO
-    // XMLCatalog involvement:
-    //
-    // Transform an XML file that refers to the entity into a text
-    // file, stuff result into property: val1
-    //
-    @Test
-    public void testEntityNoCatalog() {
-        buildRule.configureProject("src/etc/testcases/types/xmlcatalog.xml");
-        buildRule.executeTarget("testentitynocatalog");
-        assertEquals("A stitch in time saves nine", buildRule.getProject().getProperty("val1"));
-    }
-
-    //
-    // Ensure that an external entity resolves as expected Using an
-    // XMLCatalog:
-    //
-    // Transform an XML file that refers to the entity into a text
-    // file, entity is listed in the XMLCatalog pointing to a
-    // different file.  Stuff result into property: val2
-    //
-    @Test
-    public void testEntityWithCatalog() {
-        buildRule.configureProject("src/etc/testcases/types/xmlcatalog.xml");
-        buildRule.executeTarget("testentitywithcatalog");
-        assertEquals("No news is good news", buildRule.getProject().getProperty("val2"));
-    }
-
-    //
-    // Ensure that an external entity resolves as expected with NO
-    // XMLCatalog involvement:
-    //
-    // Transform an XML file that contains a reference to a _second_ XML file
-    // via the document() function.  The _second_ XML file refers to an entity.
-    // Stuff result into the property: val3
-    //
-    @Test
-    public void testDocumentNoCatalog() {
-        buildRule.configureProject("src/etc/testcases/types/xmlcatalog.xml");
-        buildRule.executeTarget("testdocumentnocatalog");
-        assertEquals("A stitch in time saves nine", buildRule.getProject().getProperty("val3"));
-    }
-
-    //
-    // Ensure that an external entity resolves as expected Using an
-    // XMLCatalog:
-    //
-    // Transform an XML file that contains a reference to a _second_ XML file
-    // via the document() function.  The _second_ XML file refers to an entity.
-    // The entity is listed in the XMLCatalog pointing to a different file.
-    // Stuff result into the property: val4
-    @Test
-    public void testDocumentWithCatalog() {
-        buildRule.configureProject("src/etc/testcases/types/xmlcatalog.xml");
-        buildRule.executeTarget("testdocumentwithcatalog");
-        assertEquals("No news is good news", buildRule.getProject().getProperty("val4"));
-    }
-}
+/*
+ *  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.types;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * testcases for org.apache.tools.ant.types.XMLCatalog
+ *
+ * @see org.apache.tools.ant.types.XMLCatalogTest
+ *
+ */
+public class XMLCatalogBuildFileTest {
+
+     @Rule
+     public BuildFileRule buildRule = new BuildFileRule();
+
+
+
+    //
+    // Ensure that an external entity resolves as expected with NO
+    // XMLCatalog involvement:
+    //
+    // Transform an XML file that refers to the entity into a text
+    // file, stuff result into property: val1
+    //
+    @Test
+    public void testEntityNoCatalog() {
+        buildRule.configureProject("src/etc/testcases/types/xmlcatalog.xml");
+        buildRule.executeTarget("testentitynocatalog");
+        assertEquals("A stitch in time saves nine", buildRule.getProject().getProperty("val1"));
+    }
+
+    //
+    // Ensure that an external entity resolves as expected Using an
+    // XMLCatalog:
+    //
+    // Transform an XML file that refers to the entity into a text
+    // file, entity is listed in the XMLCatalog pointing to a
+    // different file.  Stuff result into property: val2
+    //
+    @Test
+    public void testEntityWithCatalog() {
+        buildRule.configureProject("src/etc/testcases/types/xmlcatalog.xml");
+        buildRule.executeTarget("testentitywithcatalog");
+        assertEquals("No news is good news", buildRule.getProject().getProperty("val2"));
+    }
+
+    //
+    // Ensure that an external entity resolves as expected with NO
+    // XMLCatalog involvement:
+    //
+    // Transform an XML file that contains a reference to a _second_ XML file
+    // via the document() function.  The _second_ XML file refers to an entity.
+    // Stuff result into the property: val3
+    //
+    @Test
+    public void testDocumentNoCatalog() {
+        buildRule.configureProject("src/etc/testcases/types/xmlcatalog.xml");
+        buildRule.executeTarget("testdocumentnocatalog");
+        assertEquals("A stitch in time saves nine", buildRule.getProject().getProperty("val3"));
+    }
+
+    //
+    // Ensure that an external entity resolves as expected Using an
+    // XMLCatalog:
+    //
+    // Transform an XML file that contains a reference to a _second_ XML file
+    // via the document() function.  The _second_ XML file refers to an entity.
+    // The entity is listed in the XMLCatalog pointing to a different file.
+    // Stuff result into the property: val4
+    @Test
+    public void testDocumentWithCatalog() {
+        buildRule.configureProject("src/etc/testcases/types/xmlcatalog.xml");
+        buildRule.executeTarget("testdocumentwithcatalog");
+        assertEquals("No news is good news", buildRule.getProject().getProperty("val4"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java b/src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java
index ca06ec3..c1adc30 100644
--- a/src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java
@@ -1,392 +1,392 @@
-/*
- *  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.types;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.sax.SAXSource;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.util.JAXPUtils;
-import org.junit.Before;
-import org.junit.Test;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.junit.Assert.assertNotNull;
-
-/**
- * JUnit testcases for org.apache.tools.ant.types.XMLCatalog
- *
- */
-public class XMLCatalogTest {
-
-    private Project project;
-    private XMLCatalog catalog;
-
-    private XMLCatalog newCatalog() {
-        XMLCatalog cat = new XMLCatalog();
-        cat.setProject(project);
-        return cat;
-    }
-
-    private static String toURLString(File file) throws MalformedURLException {
-        return JAXPUtils.getSystemId(file);
-    }
-
-    @Before
-    public void setUp() {
-        project = new Project();
-        project.setBasedir(System.getProperty("root"));
-
-        // This causes XMLCatalog to print out detailed logging
-        // messages for debugging
-        //
-        // DefaultLogger logger = new DefaultLogger();
-        // logger.setMessageOutputLevel(Project.MSG_DEBUG);
-        // logger.setOutputPrintStream(System.out);
-        // logger.setErrorPrintStream(System.err);
-        // project.addBuildListener(logger);
-
-        catalog = newCatalog();
-    }
-
-    @Test
-    public void testEmptyCatalog() {
-        try {
-            InputSource result = catalog.resolveEntity("PUBLIC ID ONE",
-                                                       "i/dont/exist.dtd");
-            assertNull("Empty catalog should return null", result);
-        } catch (Exception e) {
-            fail("resolveEntity() failed!" + e.toString());
-        }
-
-        try {
-            Source result = catalog.resolve("i/dont/exist.dtd", null);
-            String expected = toURLString(new File(project.getBaseDir() +
-                                                   "/i/dont/exist.dtd"));
-            String resultStr =
-                fileURLPartWithoutLeadingSlashes((SAXSource)result);
-            assertTrue("Empty catalog should return input with a system ID like "
-                       + expected + " but was " + resultStr,
-                       expected.endsWith(resultStr));
-        } catch (Exception e) {
-            fail("resolve() failed!" + e.toString());
-        }
-    }
-
-    private static String fileURLPartWithoutLeadingSlashes(SAXSource result)
-        throws MalformedURLException {
-        //
-        // These shenanigans are necessary b/c Norm Walsh's resolver
-        // has a different idea of how file URLs are created on windoze
-        // ie file://c:/foo instead of file:///c:/foo
-        //
-        String resultStr =
-            new URL(result.getInputSource().getSystemId()).getFile();
-        // on Sun's Java6 this returns an unexpected number of four
-        // leading slashes, at least on Linux - strip all of them
-        while (resultStr.startsWith("/")) {
-            resultStr = resultStr.substring(1);
-        }
-        return resultStr;
-    }
-
-    @Test
-    public void testNonExistentEntry() throws IOException, SAXException, TransformerException {
-
-        ResourceLocation dtd = new ResourceLocation();
-        dtd.setPublicId("PUBLIC ID ONE");
-        dtd.setLocation("i/dont/exist.dtd");
-
-        InputSource isResult = catalog.resolveEntity("PUBLIC ID ONE",
-                                                   "i/dont/exist.dtd");
-        assertNull("Nonexistent Catalog entry should not be returned", isResult);
-
-        Source result = catalog.resolve("i/dont/exist.dtd", null);
-        String expected = toURLString(new File(project.getBaseDir().toURL() +
-                                               "/i/dont/exist.dtd"));
-        String resultStr =
-            fileURLPartWithoutLeadingSlashes((SAXSource)result);
-        assertTrue("Nonexistent Catalog entry return input with a system ID like "
-                   + expected + " but was " + resultStr,
-                   expected.endsWith(resultStr));
-    }
-
-    @Test
-    public void testEmptyElementIfIsReference() {
-        ResourceLocation dtd = new ResourceLocation();
-        dtd.setPublicId("PUBLIC ID ONE");
-        dtd.setLocation("i/dont/exist.dtd");
-        catalog.addDTD(dtd);
-        project.addReference("catalog", catalog);
-
-        try {
-            catalog.setRefid(new Reference(project, "dummyref"));
-            fail("Can add reference to nonexistent XMLCatalog");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one "
-                         + "attribute when using refid", be.getMessage());
-        }
-
-        XMLCatalog catalog2 = newCatalog();
-        catalog2.setRefid(new Reference(project, "catalog"));
-
-        try {
-            catalog2.addConfiguredXMLCatalog(catalog);
-            fail("Can add nested XMLCatalog to XMLCatalog that is a reference");
-        } catch (BuildException be) {
-            assertEquals("You must not specify nested elements when using refid",
-                         be.getMessage());
-        }
-    }
-
-    @Test
-    public void testCircularReferenceCheck() throws IOException, SAXException {
-
-        // catalog <--> catalog
-        project.addReference("catalog", catalog);
-        catalog.setRefid(new Reference(project, "catalog"));
-
-        try {
-            InputSource result = catalog.resolveEntity("PUBLIC ID ONE",
-                                                       "i/dont/exist.dtd");
-            fail("Can make XMLCatalog a Reference to itself.");
-        } catch (BuildException be) {
-            assertEquals("This data type contains a circular reference.",
-                         be.getMessage());
-        } catch (Exception e) {
-            fail("resolveEntity() failed!" + e.toString());
-        }
-
-        // catalog1 --> catalog2 --> catalog3 --> catalog1
-        XMLCatalog catalog1 = newCatalog();
-        project.addReference("catalog1", catalog1);
-        XMLCatalog catalog2 = newCatalog();
-        project.addReference("catalog2", catalog2);
-        XMLCatalog catalog3 = newCatalog();
-        project.addReference("catalog3", catalog3);
-
-        catalog3.setRefid(new Reference(project, "catalog1"));
-        catalog2.setRefid(new Reference(project, "catalog3"));
-        catalog1.setRefid(new Reference(project, "catalog2"));
-
-        try {
-            catalog1.resolveEntity("PUBLIC ID ONE",
-                                                        "i/dont/exist.dtd");
-            fail("Can make circular reference");
-        } catch (BuildException be) {
-            assertEquals("This data type contains a circular reference.",
-                    be.getMessage());
-        }
-    }
-    // inspired by Bugzilla Report 23913
-    // a problem used to happen under Windows when the location of the DTD was given as an absolute path
-    // possibly with a mixture of file separators
-    @Test
-    public void testAbsolutePath() throws IOException, SAXException {
-        ResourceLocation dtd = new ResourceLocation();
-        dtd.setPublicId("-//stevo//DTD doc 1.0//EN");
-
-        String sysid = System.getProperty("root") + File.separator + "src/etc/testcases/taskdefs/optional/xml/doc.dtd";
-        dtd.setLocation(sysid);
-        catalog.addDTD(dtd);
-        File dtdFile = project.resolveFile(sysid);
-
-        InputSource result = catalog.resolveEntity("-//stevo//DTD doc 1.0//EN",
-                                                   "nap:chemical+brothers");
-        assertNotNull(result);
-        assertEquals(toURLString(dtdFile),
-                     result.getSystemId());
-
-
-    }
-
-    @Test
-    public void testSimpleEntry() throws IOException, SAXException {
-
-        ResourceLocation dtd = new ResourceLocation();
-        dtd.setPublicId("-//stevo//DTD doc 1.0//EN");
-        String sysid = "src/etc/testcases/taskdefs/optional/xml/doc.dtd";
-        dtd.setLocation(sysid);
-        catalog.addDTD(dtd);
-        File dtdFile = project.resolveFile(sysid);
-
-        InputSource result = catalog.resolveEntity("-//stevo//DTD doc 1.0//EN",
-                                                   "nap:chemical+brothers");
-        assertNotNull(result);
-        assertEquals(toURLString(dtdFile),
-                     result.getSystemId());
-
-    }
-
-    @Test
-    public void testEntryReference() throws IOException, SAXException, TransformerException {
-
-        String publicId = "-//stevo//DTD doc 1.0//EN";
-        String sysid = "src/etc/testcases/taskdefs/optional/xml/doc.dtd";
-
-        // catalog2 --> catalog1 --> catalog
-        ResourceLocation dtd = new ResourceLocation();
-        dtd.setPublicId(publicId);
-        dtd.setLocation(sysid);
-        catalog.addDTD(dtd);
-        File dtdFile = project.resolveFile(sysid);
-
-        String uri = "http://foo.com/bar/blah.xml";
-        String uriLoc = "src/etc/testcases/taskdefs/optional/xml/about.xml";
-
-        ResourceLocation entity = new ResourceLocation();
-        entity.setPublicId(uri);
-        entity.setLocation(uriLoc);
-        catalog.addEntity(entity);
-        File xmlFile = project.resolveFile(uriLoc);
-
-        project.addReference("catalog", catalog);
-
-        XMLCatalog catalog1 = newCatalog();
-        project.addReference("catalog1", catalog1);
-        XMLCatalog catalog2 = newCatalog();
-        project.addReference("catalog2", catalog1);
-
-        catalog1.setRefid(new Reference(project, "catalog"));
-        catalog2.setRefid(new Reference(project, "catalog1"));
-
-        InputSource isResult = catalog2.resolveEntity(publicId,
-                                                    "nap:chemical+brothers");
-
-        assertNotNull(isResult);
-        assertEquals(toURLString(dtdFile),
-                     isResult.getSystemId());
-
-
-            Source result = catalog.resolve(uri, null);
-            assertNotNull(result);
-            assertEquals(toURLString(xmlFile),
-                         result.getSystemId());
-    }
-
-    @Test
-    public void testNestedCatalog() throws IOException, SAXException, TransformerException {
-
-        String publicId = "-//stevo//DTD doc 1.0//EN";
-        String dtdLoc = "src/etc/testcases/taskdefs/optional/xml/doc.dtd";
-
-        ResourceLocation dtd = new ResourceLocation();
-        dtd.setPublicId(publicId);
-        dtd.setLocation(dtdLoc);
-        catalog.addDTD(dtd);
-        File dtdFile = project.resolveFile(dtdLoc);
-
-        String uri = "http://foo.com/bar/blah.xml";
-        String uriLoc = "src/etc/testcases/taskdefs/optional/xml/about.xml";
-
-        ResourceLocation entity = new ResourceLocation();
-        entity.setPublicId(uri);
-        entity.setLocation(uriLoc);
-        catalog.addEntity(entity);
-        File xmlFile = project.resolveFile(uriLoc);
-
-        XMLCatalog catalog1 = newCatalog();
-        catalog1.addConfiguredXMLCatalog(catalog);
-
-        InputSource isResult = catalog1.resolveEntity(publicId,
-                                                    "nap:chemical+brothers");
-        assertNotNull(isResult);
-        assertEquals(toURLString(dtdFile),
-                     isResult.getSystemId());
-
-        Source result = catalog.resolve(uri, null);
-        assertNotNull(result);
-        assertEquals(toURLString(xmlFile),
-                     result.getSystemId());
-
-    }
-
-    @Test
-    public void testResolverBase() throws MalformedURLException, TransformerException {
-
-        String uri = "http://foo.com/bar/blah.xml";
-        String uriLoc = "etc/testcases/taskdefs/optional/xml/about.xml";
-        String base = toURLString(project.getBaseDir()) + "/src/";
-
-        ResourceLocation entity = new ResourceLocation();
-        entity.setPublicId(uri);
-        entity.setLocation(uriLoc);
-        catalog.addEntity(entity);
-        File xmlFile = project.resolveFile("src/" + uriLoc);
-
-        Source result = catalog.resolve(uri, base);
-        assertNotNull(result);
-        assertEquals(toURLString(xmlFile),
-                     result.getSystemId());
-
-    }
-
-    @Test
-    public void testClasspath() throws IOException, TransformerException, SAXException {
-
-
-        String publicId = "-//stevo//DTD doc 1.0//EN";
-        String dtdLoc = "testcases/taskdefs/optional/xml/doc.dtd";
-        String path1 = project.getBaseDir().toString() + "/src/etc";
-
-        ResourceLocation dtd = new ResourceLocation();
-        dtd.setPublicId(publicId);
-        dtd.setLocation(dtdLoc);
-        catalog.addDTD(dtd);
-        File dtdFile = project.resolveFile("src/etc/" + dtdLoc);
-
-        String uri = "http://foo.com/bar/blah.xml";
-        String uriLoc = "etc/testcases/taskdefs/optional/xml/about.xml";
-        String path2 = project.getBaseDir().toString() + "/src";
-
-        ResourceLocation entity = new ResourceLocation();
-        entity.setPublicId(uri);
-        entity.setLocation(uriLoc);
-        catalog.addEntity(entity);
-        File xmlFile = project.resolveFile("src/" + uriLoc);
-
-        Path aPath = new Path(project, path1);
-        aPath.append(new Path(project, path2));
-        catalog.setClasspath(aPath);
-
-        InputSource isResult = catalog.resolveEntity(publicId,
-                                                   "nap:chemical+brothers");
-        assertNotNull(isResult);
-        String resultStr1 = new URL(isResult.getSystemId()).getFile();
-        assertTrue(toURLString(dtdFile).endsWith(resultStr1));
-
-        Source result = catalog.resolve(uri, null);
-        assertNotNull(result);
-        String resultStr = new URL(result.getSystemId()).getFile();
-        assertTrue(toURLString(xmlFile).endsWith(resultStr));
-
-    }
-}
+/*
+ *  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.types;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.sax.SAXSource;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.util.JAXPUtils;
+import org.junit.Before;
+import org.junit.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * JUnit testcases for org.apache.tools.ant.types.XMLCatalog
+ *
+ */
+public class XMLCatalogTest {
+
+    private Project project;
+    private XMLCatalog catalog;
+
+    private XMLCatalog newCatalog() {
+        XMLCatalog cat = new XMLCatalog();
+        cat.setProject(project);
+        return cat;
+    }
+
+    private static String toURLString(File file) throws MalformedURLException {
+        return JAXPUtils.getSystemId(file);
+    }
+
+    @Before
+    public void setUp() {
+        project = new Project();
+        project.setBasedir(System.getProperty("root"));
+
+        // This causes XMLCatalog to print out detailed logging
+        // messages for debugging
+        //
+        // DefaultLogger logger = new DefaultLogger();
+        // logger.setMessageOutputLevel(Project.MSG_DEBUG);
+        // logger.setOutputPrintStream(System.out);
+        // logger.setErrorPrintStream(System.err);
+        // project.addBuildListener(logger);
+
+        catalog = newCatalog();
+    }
+
+    @Test
+    public void testEmptyCatalog() {
+        try {
+            InputSource result = catalog.resolveEntity("PUBLIC ID ONE",
+                                                       "i/dont/exist.dtd");
+            assertNull("Empty catalog should return null", result);
+        } catch (Exception e) {
+            fail("resolveEntity() failed!" + e.toString());
+        }
+
+        try {
+            Source result = catalog.resolve("i/dont/exist.dtd", null);
+            String expected = toURLString(new File(project.getBaseDir() +
+                                                   "/i/dont/exist.dtd"));
+            String resultStr =
+                fileURLPartWithoutLeadingSlashes((SAXSource)result);
+            assertTrue("Empty catalog should return input with a system ID like "
+                       + expected + " but was " + resultStr,
+                       expected.endsWith(resultStr));
+        } catch (Exception e) {
+            fail("resolve() failed!" + e.toString());
+        }
+    }
+
+    private static String fileURLPartWithoutLeadingSlashes(SAXSource result)
+        throws MalformedURLException {
+        //
+        // These shenanigans are necessary b/c Norm Walsh's resolver
+        // has a different idea of how file URLs are created on windoze
+        // ie file://c:/foo instead of file:///c:/foo
+        //
+        String resultStr =
+            new URL(result.getInputSource().getSystemId()).getFile();
+        // on Sun's Java6 this returns an unexpected number of four
+        // leading slashes, at least on Linux - strip all of them
+        while (resultStr.startsWith("/")) {
+            resultStr = resultStr.substring(1);
+        }
+        return resultStr;
+    }
+
+    @Test
+    public void testNonExistentEntry() throws IOException, SAXException, TransformerException {
+
+        ResourceLocation dtd = new ResourceLocation();
+        dtd.setPublicId("PUBLIC ID ONE");
+        dtd.setLocation("i/dont/exist.dtd");
+
+        InputSource isResult = catalog.resolveEntity("PUBLIC ID ONE",
+                                                   "i/dont/exist.dtd");
+        assertNull("Nonexistent Catalog entry should not be returned", isResult);
+
+        Source result = catalog.resolve("i/dont/exist.dtd", null);
+        String expected = toURLString(new File(project.getBaseDir().toURL() +
+                                               "/i/dont/exist.dtd"));
+        String resultStr =
+            fileURLPartWithoutLeadingSlashes((SAXSource)result);
+        assertTrue("Nonexistent Catalog entry return input with a system ID like "
+                   + expected + " but was " + resultStr,
+                   expected.endsWith(resultStr));
+    }
+
+    @Test
+    public void testEmptyElementIfIsReference() {
+        ResourceLocation dtd = new ResourceLocation();
+        dtd.setPublicId("PUBLIC ID ONE");
+        dtd.setLocation("i/dont/exist.dtd");
+        catalog.addDTD(dtd);
+        project.addReference("catalog", catalog);
+
+        try {
+            catalog.setRefid(new Reference(project, "dummyref"));
+            fail("Can add reference to nonexistent XMLCatalog");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one "
+                         + "attribute when using refid", be.getMessage());
+        }
+
+        XMLCatalog catalog2 = newCatalog();
+        catalog2.setRefid(new Reference(project, "catalog"));
+
+        try {
+            catalog2.addConfiguredXMLCatalog(catalog);
+            fail("Can add nested XMLCatalog to XMLCatalog that is a reference");
+        } catch (BuildException be) {
+            assertEquals("You must not specify nested elements when using refid",
+                         be.getMessage());
+        }
+    }
+
+    @Test
+    public void testCircularReferenceCheck() throws IOException, SAXException {
+
+        // catalog <--> catalog
+        project.addReference("catalog", catalog);
+        catalog.setRefid(new Reference(project, "catalog"));
+
+        try {
+            InputSource result = catalog.resolveEntity("PUBLIC ID ONE",
+                                                       "i/dont/exist.dtd");
+            fail("Can make XMLCatalog a Reference to itself.");
+        } catch (BuildException be) {
+            assertEquals("This data type contains a circular reference.",
+                         be.getMessage());
+        } catch (Exception e) {
+            fail("resolveEntity() failed!" + e.toString());
+        }
+
+        // catalog1 --> catalog2 --> catalog3 --> catalog1
+        XMLCatalog catalog1 = newCatalog();
+        project.addReference("catalog1", catalog1);
+        XMLCatalog catalog2 = newCatalog();
+        project.addReference("catalog2", catalog2);
+        XMLCatalog catalog3 = newCatalog();
+        project.addReference("catalog3", catalog3);
+
+        catalog3.setRefid(new Reference(project, "catalog1"));
+        catalog2.setRefid(new Reference(project, "catalog3"));
+        catalog1.setRefid(new Reference(project, "catalog2"));
+
+        try {
+            catalog1.resolveEntity("PUBLIC ID ONE",
+                                                        "i/dont/exist.dtd");
+            fail("Can make circular reference");
+        } catch (BuildException be) {
+            assertEquals("This data type contains a circular reference.",
+                    be.getMessage());
+        }
+    }
+    // inspired by Bugzilla Report 23913
+    // a problem used to happen under Windows when the location of the DTD was given as an absolute path
+    // possibly with a mixture of file separators
+    @Test
+    public void testAbsolutePath() throws IOException, SAXException {
+        ResourceLocation dtd = new ResourceLocation();
+        dtd.setPublicId("-//stevo//DTD doc 1.0//EN");
+
+        String sysid = System.getProperty("root") + File.separator + "src/etc/testcases/taskdefs/optional/xml/doc.dtd";
+        dtd.setLocation(sysid);
+        catalog.addDTD(dtd);
+        File dtdFile = project.resolveFile(sysid);
+
+        InputSource result = catalog.resolveEntity("-//stevo//DTD doc 1.0//EN",
+                                                   "nap:chemical+brothers");
+        assertNotNull(result);
+        assertEquals(toURLString(dtdFile),
+                     result.getSystemId());
+
+
+    }
+
+    @Test
+    public void testSimpleEntry() throws IOException, SAXException {
+
+        ResourceLocation dtd = new ResourceLocation();
+        dtd.setPublicId("-//stevo//DTD doc 1.0//EN");
+        String sysid = "src/etc/testcases/taskdefs/optional/xml/doc.dtd";
+        dtd.setLocation(sysid);
+        catalog.addDTD(dtd);
+        File dtdFile = project.resolveFile(sysid);
+
+        InputSource result = catalog.resolveEntity("-//stevo//DTD doc 1.0//EN",
+                                                   "nap:chemical+brothers");
+        assertNotNull(result);
+        assertEquals(toURLString(dtdFile),
+                     result.getSystemId());
+
+    }
+
+    @Test
+    public void testEntryReference() throws IOException, SAXException, TransformerException {
+
+        String publicId = "-//stevo//DTD doc 1.0//EN";
+        String sysid = "src/etc/testcases/taskdefs/optional/xml/doc.dtd";
+
+        // catalog2 --> catalog1 --> catalog
+        ResourceLocation dtd = new ResourceLocation();
+        dtd.setPublicId(publicId);
+        dtd.setLocation(sysid);
+        catalog.addDTD(dtd);
+        File dtdFile = project.resolveFile(sysid);
+
+        String uri = "http://foo.com/bar/blah.xml";
+        String uriLoc = "src/etc/testcases/taskdefs/optional/xml/about.xml";
+
+        ResourceLocation entity = new ResourceLocation();
+        entity.setPublicId(uri);
+        entity.setLocation(uriLoc);
+        catalog.addEntity(entity);
+        File xmlFile = project.resolveFile(uriLoc);
+
+        project.addReference("catalog", catalog);
+
+        XMLCatalog catalog1 = newCatalog();
+        project.addReference("catalog1", catalog1);
+        XMLCatalog catalog2 = newCatalog();
+        project.addReference("catalog2", catalog1);
+
+        catalog1.setRefid(new Reference(project, "catalog"));
+        catalog2.setRefid(new Reference(project, "catalog1"));
+
+        InputSource isResult = catalog2.resolveEntity(publicId,
+                                                    "nap:chemical+brothers");
+
+        assertNotNull(isResult);
+        assertEquals(toURLString(dtdFile),
+                     isResult.getSystemId());
+
+
+            Source result = catalog.resolve(uri, null);
+            assertNotNull(result);
+            assertEquals(toURLString(xmlFile),
+                         result.getSystemId());
+    }
+
+    @Test
+    public void testNestedCatalog() throws IOException, SAXException, TransformerException {
+
+        String publicId = "-//stevo//DTD doc 1.0//EN";
+        String dtdLoc = "src/etc/testcases/taskdefs/optional/xml/doc.dtd";
+
+        ResourceLocation dtd = new ResourceLocation();
+        dtd.setPublicId(publicId);
+        dtd.setLocation(dtdLoc);
+        catalog.addDTD(dtd);
+        File dtdFile = project.resolveFile(dtdLoc);
+
+        String uri = "http://foo.com/bar/blah.xml";
+        String uriLoc = "src/etc/testcases/taskdefs/optional/xml/about.xml";
+
+        ResourceLocation entity = new ResourceLocation();
+        entity.setPublicId(uri);
+        entity.setLocation(uriLoc);
+        catalog.addEntity(entity);
+        File xmlFile = project.resolveFile(uriLoc);
+
+        XMLCatalog catalog1 = newCatalog();
+        catalog1.addConfiguredXMLCatalog(catalog);
+
+        InputSource isResult = catalog1.resolveEntity(publicId,
+                                                    "nap:chemical+brothers");
+        assertNotNull(isResult);
+        assertEquals(toURLString(dtdFile),
+                     isResult.getSystemId());
+
+        Source result = catalog.resolve(uri, null);
+        assertNotNull(result);
+        assertEquals(toURLString(xmlFile),
+                     result.getSystemId());
+
+    }
+
+    @Test
+    public void testResolverBase() throws MalformedURLException, TransformerException {
+
+        String uri = "http://foo.com/bar/blah.xml";
+        String uriLoc = "etc/testcases/taskdefs/optional/xml/about.xml";
+        String base = toURLString(project.getBaseDir()) + "/src/";
+
+        ResourceLocation entity = new ResourceLocation();
+        entity.setPublicId(uri);
+        entity.setLocation(uriLoc);
+        catalog.addEntity(entity);
+        File xmlFile = project.resolveFile("src/" + uriLoc);
+
+        Source result = catalog.resolve(uri, base);
+        assertNotNull(result);
+        assertEquals(toURLString(xmlFile),
+                     result.getSystemId());
+
+    }
+
+    @Test
+    public void testClasspath() throws IOException, TransformerException, SAXException {
+
+
+        String publicId = "-//stevo//DTD doc 1.0//EN";
+        String dtdLoc = "testcases/taskdefs/optional/xml/doc.dtd";
+        String path1 = project.getBaseDir().toString() + "/src/etc";
+
+        ResourceLocation dtd = new ResourceLocation();
+        dtd.setPublicId(publicId);
+        dtd.setLocation(dtdLoc);
+        catalog.addDTD(dtd);
+        File dtdFile = project.resolveFile("src/etc/" + dtdLoc);
+
+        String uri = "http://foo.com/bar/blah.xml";
+        String uriLoc = "etc/testcases/taskdefs/optional/xml/about.xml";
+        String path2 = project.getBaseDir().toString() + "/src";
+
+        ResourceLocation entity = new ResourceLocation();
+        entity.setPublicId(uri);
+        entity.setLocation(uriLoc);
+        catalog.addEntity(entity);
+        File xmlFile = project.resolveFile("src/" + uriLoc);
+
+        Path aPath = new Path(project, path1);
+        aPath.append(new Path(project, path2));
+        catalog.setClasspath(aPath);
+
+        InputSource isResult = catalog.resolveEntity(publicId,
+                                                   "nap:chemical+brothers");
+        assertNotNull(isResult);
+        String resultStr1 = new URL(isResult.getSystemId()).getFile();
+        assertTrue(toURLString(dtdFile).endsWith(resultStr1));
+
+        Source result = catalog.resolve(uri, null);
+        assertNotNull(result);
+        String resultStr = new URL(result.getSystemId()).getFile();
+        assertTrue(toURLString(xmlFile).endsWith(resultStr));
+
+    }
+}


[18/21] ant git commit: Normalise tabulation and line breaks

Posted by gi...@apache.org.
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/SchemaValidateTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/SchemaValidateTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/SchemaValidateTest.java
index 5914001..667c890 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/SchemaValidateTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/SchemaValidateTest.java
@@ -1,128 +1,128 @@
-/*
- *  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;
-
-import org.apache.tools.ant.AntAssert;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.fail;
-
-/**
- * Test schema validation
- */
-
-public class SchemaValidateTest {
-
-    /**
-     * where tasks run
-     */
-    private final static String TASKDEFS_DIR =
-            "src/etc/testcases/taskdefs/optional/";
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject(TASKDEFS_DIR + "schemavalidate.xml");
-    }
-
-    /**
-     * test with no namespace
-     */
-    @Test
-    public void testNoNamespace() throws Exception {
-        buildRule.executeTarget("testNoNamespace");
-    }
-
-    /**
-     * add namespace awareness.
-     */
-    @Test
-    public void testNSMapping() throws Exception {
-        buildRule.executeTarget("testNSMapping");
-    }
-
-    @Test
-    public void testNoEmptySchemaNamespace() throws Exception {
-        try {
-            buildRule.executeTarget("testNoEmptySchemaNamespace");
-            fail("Empty namespace URI");
-        } catch (BuildException ex) {
-            AntAssert.assertContains(SchemaValidate.SchemaLocation.ERROR_NO_URI, ex.getMessage());
-        }
-    }
-
-    @Test
-    public void testNoEmptySchemaLocation() throws Exception {
-        try {
-            buildRule.executeTarget("testNoEmptySchemaLocation");
-            fail("Empty schema location");
-        } catch (BuildException ex) {
-            AntAssert.assertContains(SchemaValidate.SchemaLocation.ERROR_NO_LOCATION,
-                    ex.getMessage());
-        }
-    }
-
-    @Test
-    public void testNoFile() throws Exception {
-        try {
-            buildRule.executeTarget("testNoFile");
-            fail("No file at file attribute");
-        } catch (BuildException ex) {
-            AntAssert.assertContains(SchemaValidate.SchemaLocation.ERROR_NO_FILE,
-                    ex.getMessage());
-        }
-    }
-
-    @Test
-    public void testNoDoubleSchemaLocation() throws Exception {
-        try {
-            buildRule.executeTarget("testNoDoubleSchemaLocation");
-            fail("Two locations for schemas");
-        } catch (BuildException ex) {
-            AntAssert.assertContains(SchemaValidate.SchemaLocation.ERROR_TWO_LOCATIONS,
-                    ex.getMessage());
-        }
-    }
-
-    @Test
-    public void testNoDuplicateSchema() throws Exception {
-        try {
-            buildRule.executeTarget("testNoDuplicateSchema");
-            fail("duplicate schemas with different values");
-        } catch (BuildException ex) {
-            AntAssert.assertContains(SchemaValidate.ERROR_DUPLICATE_SCHEMA,
-                    ex.getMessage());
-        }
-    }
-
-    @Test
-    public void testEqualsSchemasOK() throws Exception {
-        buildRule.executeTarget("testEqualsSchemasOK");
-    }
-
-    @Test
-    public void testFileset() throws Exception {
-        buildRule.executeTarget("testFileset");
-    }
-}
+/*
+ *  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;
+
+import org.apache.tools.ant.AntAssert;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.fail;
+
+/**
+ * Test schema validation
+ */
+
+public class SchemaValidateTest {
+
+    /**
+     * where tasks run
+     */
+    private final static String TASKDEFS_DIR =
+            "src/etc/testcases/taskdefs/optional/";
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject(TASKDEFS_DIR + "schemavalidate.xml");
+    }
+
+    /**
+     * test with no namespace
+     */
+    @Test
+    public void testNoNamespace() throws Exception {
+        buildRule.executeTarget("testNoNamespace");
+    }
+
+    /**
+     * add namespace awareness.
+     */
+    @Test
+    public void testNSMapping() throws Exception {
+        buildRule.executeTarget("testNSMapping");
+    }
+
+    @Test
+    public void testNoEmptySchemaNamespace() throws Exception {
+        try {
+            buildRule.executeTarget("testNoEmptySchemaNamespace");
+            fail("Empty namespace URI");
+        } catch (BuildException ex) {
+            AntAssert.assertContains(SchemaValidate.SchemaLocation.ERROR_NO_URI, ex.getMessage());
+        }
+    }
+
+    @Test
+    public void testNoEmptySchemaLocation() throws Exception {
+        try {
+            buildRule.executeTarget("testNoEmptySchemaLocation");
+            fail("Empty schema location");
+        } catch (BuildException ex) {
+            AntAssert.assertContains(SchemaValidate.SchemaLocation.ERROR_NO_LOCATION,
+                    ex.getMessage());
+        }
+    }
+
+    @Test
+    public void testNoFile() throws Exception {
+        try {
+            buildRule.executeTarget("testNoFile");
+            fail("No file at file attribute");
+        } catch (BuildException ex) {
+            AntAssert.assertContains(SchemaValidate.SchemaLocation.ERROR_NO_FILE,
+                    ex.getMessage());
+        }
+    }
+
+    @Test
+    public void testNoDoubleSchemaLocation() throws Exception {
+        try {
+            buildRule.executeTarget("testNoDoubleSchemaLocation");
+            fail("Two locations for schemas");
+        } catch (BuildException ex) {
+            AntAssert.assertContains(SchemaValidate.SchemaLocation.ERROR_TWO_LOCATIONS,
+                    ex.getMessage());
+        }
+    }
+
+    @Test
+    public void testNoDuplicateSchema() throws Exception {
+        try {
+            buildRule.executeTarget("testNoDuplicateSchema");
+            fail("duplicate schemas with different values");
+        } catch (BuildException ex) {
+            AntAssert.assertContains(SchemaValidate.ERROR_DUPLICATE_SCHEMA,
+                    ex.getMessage());
+        }
+    }
+
+    @Test
+    public void testEqualsSchemasOK() throws Exception {
+        buildRule.executeTarget("testEqualsSchemasOK");
+    }
+
+    @Test
+    public void testFileset() throws Exception {
+        buildRule.executeTarget("testFileset");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XmlValidateCatalogTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XmlValidateCatalogTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XmlValidateCatalogTest.java
index 02b11a3..c9948bb 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XmlValidateCatalogTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XmlValidateCatalogTest.java
@@ -1,71 +1,71 @@
-/*
- *  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;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-/**
- * Tests the XMLValidate optional task with nested external catalogs.
- *
- * @see XmlValidateTest
- * @since Ant 1.6
- */
-public class XmlValidateCatalogTest {
-
-    /**
-     * where tasks run
-     */
-    private final static String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/";
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject(TASKDEFS_DIR + "xmlvalidate.xml");
-    }
-
-
-    /**
-     * catalogfiles fileset should be ignored
-     * if resolver.jar is not present, but will
-     * be used if it is.  either way, test should
-     * work b/c we have a nested dtd with the same
-     * entity
-     */
-    @Test
-    public void testXmlCatalogFiles() {
-        buildRule.executeTarget("xmlcatalogfiles");
-    }
-
-    /**
-     * Test nested catalogpath.
-     * It should be ignored if resolver.jar is not
-     * present, but will be used if it is.  either
-     * way, test should work b/c we have a nested
-     * dtd with the same entity
-     */
-    @Test
-    public void testXmlCatalogPath() {
-        buildRule.executeTarget("xmlcatalogpath");
-    }
-
-}
+/*
+ *  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;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+/**
+ * Tests the XMLValidate optional task with nested external catalogs.
+ *
+ * @see XmlValidateTest
+ * @since Ant 1.6
+ */
+public class XmlValidateCatalogTest {
+
+    /**
+     * where tasks run
+     */
+    private final static String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/";
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject(TASKDEFS_DIR + "xmlvalidate.xml");
+    }
+
+
+    /**
+     * catalogfiles fileset should be ignored
+     * if resolver.jar is not present, but will
+     * be used if it is.  either way, test should
+     * work b/c we have a nested dtd with the same
+     * entity
+     */
+    @Test
+    public void testXmlCatalogFiles() {
+        buildRule.executeTarget("xmlcatalogfiles");
+    }
+
+    /**
+     * Test nested catalogpath.
+     * It should be ignored if resolver.jar is not
+     * present, but will be used if it is.  either
+     * way, test should work b/c we have a nested
+     * dtd with the same entity
+     */
+    @Test
+    public void testXmlCatalogPath() {
+        buildRule.executeTarget("xmlcatalogpath");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XmlValidateTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XmlValidateTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XmlValidateTest.java
index 869031f..58f7a4b 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XmlValidateTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XmlValidateTest.java
@@ -1,193 +1,193 @@
-/*
- *  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;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.internal.AssumptionViolatedException;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-/**
- * Tests the XMLValidate optional task, by running targets in the test script
- * <code>src/etc/testcases/taskdefs/optional/xmlvalidate.xml</code>
- * <p>
- *
- * @see XmlValidateCatalogTest
- * @since Ant 1.5
- */
-public class XmlValidateTest {
-
-    /**
-     * where tasks run
-     */
-    private final static String TASKDEFS_DIR =
-        "src/etc/testcases/taskdefs/optional/";
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject(TASKDEFS_DIR + "xmlvalidate.xml");
-    }
-
-    /**
-     * Basic inline 'dtd' element test.
-     */
-    @Test
-    public void testValidate() throws Exception {
-        buildRule.executeTarget("testValidate");
-    }
-
-    /**
-     * Test indirect validation.
-     */
-    @Test
-    public void testDeepValidate() throws Exception {
-        buildRule.executeTarget("testDeepValidate");
-    }
-
-    @Test
-    public void testXmlCatalog() {
-        buildRule.executeTarget("xmlcatalog");
-    }
-
-    @Test
-    public void testXmlCatalogViaRefid() {
-        buildRule.executeTarget("xmlcatalogViaRefid");
-    }
-
-    /**
-     * Test that the nested dtd element is used when resolver.jar is not
-     * present.  This test should pass either way.
-     */
-    @Test
-    public void testXmlCatalogFiles() {
-        buildRule.executeTarget("xmlcatalogfiles-override");
-    }
-
-    /**
-     * Test nested catalogpath.
-     * Test that the nested dtd element is used when resolver.jar is not
-     * present.  This test should pass either way.
-     */
-    @Test
-    public void testXmlCatalogPath() {
-        buildRule.executeTarget("xmlcatalogpath-override");
-    }
-
-    /**
-     * Test nested xmlcatalog definitions
-     */
-    @Test
-    public void testXmlCatalogNested() {
-        buildRule.executeTarget("xmlcatalognested");
-    }
-
-    /**
-     * Test xml schema validation
-     */
-    @Test
-    public void testXmlSchemaGood() throws BuildException {
-        try {
-            buildRule.executeTarget("testSchemaGood");
-        } catch (BuildException e) {
-            if (e
-                .getMessage()
-                .endsWith(" doesn't recognize feature http://apache.org/xml/features/validation/schema")
-                || e.getMessage().endsWith(
-                    " doesn't support feature http://apache.org/xml/features/validation/schema")) {
-                throw new AssumptionViolatedException("parser doesn't support schema");
-            } else {
-                throw e;
-            }
-        }
-    }
-    /**
-     * Test xml schema validation
-     */
-    @Test
-    public void testXmlSchemaBad() {
-        try {
-            buildRule.executeTarget("testSchemaBad");
-            fail("Should throw BuildException because 'Bad Schema Validation'");
-
-        } catch (BuildException e) {
-            if (e
-                .getMessage()
-                .endsWith(" doesn't recognize feature http://apache.org/xml/features/validation/schema")
-                || e.getMessage().endsWith(
-                    " doesn't support feature http://apache.org/xml/features/validation/schema")) {
-                throw new AssumptionViolatedException("parser doesn't support schema");
-            } else {
-                assertTrue(
-                    e.getMessage().indexOf("not a valid XML document") > -1);
-            }
-        }
-    }
-
-    /**
-     * iso-2022-jp.xml is valid but wouldn't get recognized on systems
-     * with a different native encoding.
-     *
-     * Bug 11279
-     */
-    @Test
-    public void testIso2022Jp() {
-        buildRule.executeTarget("testIso2022Jp");
-    }
-
-    /**
-     * utf-8.xml is invalid as it contains non-UTF-8 characters, but
-     * would pass on systems with a native iso-8859-1 (or similar)
-     * encoding.
-     *
-     * Bug 11279
-     */
-    @Test
-    public void testUtf8() {
-        try {
-            buildRule.executeTarget("testUtf8");
-            fail("Invalid characters in file");
-        } catch(BuildException ex) {
-          //TODO assert exception message
-        }
-    }
-
-    // Tests property element, using XML schema properties as an example.
-    @Test
-    public void testPropertySchemaForValidXML() {
-        buildRule.executeTarget("testProperty.validXML");
-    }
-
-    @Test
-    public void testPropertySchemaForInvalidXML() {
-        try {
-            buildRule.executeTarget("testProperty.invalidXML");
-            fail("XML file does not satisfy schema");
-        } catch(BuildException ex) {
-            //TODO assert exception message
-        }
-    }
-
-}
+/*
+ *  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;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.internal.AssumptionViolatedException;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * Tests the XMLValidate optional task, by running targets in the test script
+ * <code>src/etc/testcases/taskdefs/optional/xmlvalidate.xml</code>
+ * <p>
+ *
+ * @see XmlValidateCatalogTest
+ * @since Ant 1.5
+ */
+public class XmlValidateTest {
+
+    /**
+     * where tasks run
+     */
+    private final static String TASKDEFS_DIR =
+        "src/etc/testcases/taskdefs/optional/";
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject(TASKDEFS_DIR + "xmlvalidate.xml");
+    }
+
+    /**
+     * Basic inline 'dtd' element test.
+     */
+    @Test
+    public void testValidate() throws Exception {
+        buildRule.executeTarget("testValidate");
+    }
+
+    /**
+     * Test indirect validation.
+     */
+    @Test
+    public void testDeepValidate() throws Exception {
+        buildRule.executeTarget("testDeepValidate");
+    }
+
+    @Test
+    public void testXmlCatalog() {
+        buildRule.executeTarget("xmlcatalog");
+    }
+
+    @Test
+    public void testXmlCatalogViaRefid() {
+        buildRule.executeTarget("xmlcatalogViaRefid");
+    }
+
+    /**
+     * Test that the nested dtd element is used when resolver.jar is not
+     * present.  This test should pass either way.
+     */
+    @Test
+    public void testXmlCatalogFiles() {
+        buildRule.executeTarget("xmlcatalogfiles-override");
+    }
+
+    /**
+     * Test nested catalogpath.
+     * Test that the nested dtd element is used when resolver.jar is not
+     * present.  This test should pass either way.
+     */
+    @Test
+    public void testXmlCatalogPath() {
+        buildRule.executeTarget("xmlcatalogpath-override");
+    }
+
+    /**
+     * Test nested xmlcatalog definitions
+     */
+    @Test
+    public void testXmlCatalogNested() {
+        buildRule.executeTarget("xmlcatalognested");
+    }
+
+    /**
+     * Test xml schema validation
+     */
+    @Test
+    public void testXmlSchemaGood() throws BuildException {
+        try {
+            buildRule.executeTarget("testSchemaGood");
+        } catch (BuildException e) {
+            if (e
+                .getMessage()
+                .endsWith(" doesn't recognize feature http://apache.org/xml/features/validation/schema")
+                || e.getMessage().endsWith(
+                    " doesn't support feature http://apache.org/xml/features/validation/schema")) {
+                throw new AssumptionViolatedException("parser doesn't support schema");
+            } else {
+                throw e;
+            }
+        }
+    }
+    /**
+     * Test xml schema validation
+     */
+    @Test
+    public void testXmlSchemaBad() {
+        try {
+            buildRule.executeTarget("testSchemaBad");
+            fail("Should throw BuildException because 'Bad Schema Validation'");
+
+        } catch (BuildException e) {
+            if (e
+                .getMessage()
+                .endsWith(" doesn't recognize feature http://apache.org/xml/features/validation/schema")
+                || e.getMessage().endsWith(
+                    " doesn't support feature http://apache.org/xml/features/validation/schema")) {
+                throw new AssumptionViolatedException("parser doesn't support schema");
+            } else {
+                assertTrue(
+                    e.getMessage().indexOf("not a valid XML document") > -1);
+            }
+        }
+    }
+
+    /**
+     * iso-2022-jp.xml is valid but wouldn't get recognized on systems
+     * with a different native encoding.
+     *
+     * Bug 11279
+     */
+    @Test
+    public void testIso2022Jp() {
+        buildRule.executeTarget("testIso2022Jp");
+    }
+
+    /**
+     * utf-8.xml is invalid as it contains non-UTF-8 characters, but
+     * would pass on systems with a native iso-8859-1 (or similar)
+     * encoding.
+     *
+     * Bug 11279
+     */
+    @Test
+    public void testUtf8() {
+        try {
+            buildRule.executeTarget("testUtf8");
+            fail("Invalid characters in file");
+        } catch(BuildException ex) {
+          //TODO assert exception message
+        }
+    }
+
+    // Tests property element, using XML schema properties as an example.
+    @Test
+    public void testPropertySchemaForValidXML() {
+        buildRule.executeTarget("testProperty.validXML");
+    }
+
+    @Test
+    public void testPropertySchemaForInvalidXML() {
+        try {
+            buildRule.executeTarget("testProperty.invalidXML");
+            fail("XML file does not satisfy schema");
+        } catch(BuildException ex) {
+            //TODO assert exception message
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XsltTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XsltTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XsltTest.java
index 594dada..0a57cc5 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XsltTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XsltTest.java
@@ -1,86 +1,85 @@
-/*
- *  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;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.fail;
-
-/**
- * Tests the {@link org.apache.tools.ant.taskdefs.XSLTProcess} task.
- * TODO merge with {@link org.apache.tools.ant.taskdefs.StyleTest}?
- * @since Ant 1.5
- */
-public class XsltTest {
-
-    /**
-     * where tasks run
-     */
-    private final static String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/";
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject(TASKDEFS_DIR + "xslt.xml");
-    }
-
-
-    @Test
-    public void testCatchNoDtd() {
-        try {
-            buildRule.executeTarget("testCatchNoDtd");
-            fail("Expected failure");
-        } catch(BuildException ex) {
-            //TODO assert exception message
-        }
-    }
-
-    @Test
-    public void testCatalog() throws Exception {
-         buildRule.executeTarget("testCatalog");
-    }
-
-    @Test
-    public void testOutputProperty() throws Exception {
-      buildRule.executeTarget("testOutputProperty");
-    }
-
-    @Test
-    public void testXMLWithEntitiesInNonAsciiPath() throws Exception {
-        buildRule.executeTarget("testXMLWithEntitiesInNonAsciiPath");
-    }
-
-    /**
-     * check that the system id gets set properly on stylesheets.
-     * @throws Exception if something goes wrong.
-     */
-    @Test
-    public void testStyleSheetWithInclude() throws Exception {
-        buildRule.executeTarget("testStyleSheetWithInclude");
-        if (buildRule.getLog().indexOf("java.io.FileNotFoundException") != -1) {
-            fail("xsl:include was not found");
-        }
-    }
-}
-
+/*
+ *  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;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.fail;
+
+/**
+ * Tests the {@link org.apache.tools.ant.taskdefs.XSLTProcess} task.
+ * TODO merge with {@link org.apache.tools.ant.taskdefs.StyleTest}?
+ * @since Ant 1.5
+ */
+public class XsltTest {
+
+    /**
+     * where tasks run
+     */
+    private final static String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/";
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject(TASKDEFS_DIR + "xslt.xml");
+    }
+
+
+    @Test
+    public void testCatchNoDtd() {
+        try {
+            buildRule.executeTarget("testCatchNoDtd");
+            fail("Expected failure");
+        } catch(BuildException ex) {
+            //TODO assert exception message
+        }
+    }
+
+    @Test
+    public void testCatalog() throws Exception {
+         buildRule.executeTarget("testCatalog");
+    }
+
+    @Test
+    public void testOutputProperty() throws Exception {
+      buildRule.executeTarget("testOutputProperty");
+    }
+
+    @Test
+    public void testXMLWithEntitiesInNonAsciiPath() throws Exception {
+        buildRule.executeTarget("testXMLWithEntitiesInNonAsciiPath");
+    }
+
+    /**
+     * check that the system id gets set properly on stylesheets.
+     * @throws Exception if something goes wrong.
+     */
+    @Test
+    public void testStyleSheetWithInclude() throws Exception {
+        buildRule.executeTarget("testStyleSheetWithInclude");
+        if (buildRule.getLog().indexOf("java.io.FileNotFoundException") != -1) {
+            fail("xsl:include was not found");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/depend/DependTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/depend/DependTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/depend/DependTest.java
index 01e0575..b119f37 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/depend/DependTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/depend/DependTest.java
@@ -1,213 +1,213 @@
-/*
- *  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.depend;
-
-import java.io.File;
-import java.util.Hashtable;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.BuildFileRule;
-import org.apache.tools.ant.DirectoryScanner;
-import org.apache.tools.ant.FileUtilities;
-import org.apache.tools.ant.types.FileSet;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.apache.tools.ant.AntAssert.assertContains;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-/**
- * Testcase for the Depend optional task.
- *
- */
-public class DependTest {
-    public static final String RESULT_FILESET = "result";
-
-    public static final String TEST_BUILD_FILE
-        = "src/etc/testcases/taskdefs/optional/depend/depend.xml";
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject(TEST_BUILD_FILE);
-    }
-
-    /**
-     * Test direct dependency removal
-     */
-    @Test
-    public void testDirect() {
-        buildRule.executeTarget("src1setup");
-        buildRule.executeTarget("compile");
-
-        FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("tempsrc.dir")), 5);
-        FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("classes.dir")), 5);
-
-        buildRule.executeTarget("testdirect");
-        Hashtable files = getResultFiles();
-        assertEquals("Depend did not leave correct number of files", 3,
-            files.size());
-        assertTrue("Result did not contain A.class",
-            files.containsKey("A.class"));
-        assertTrue("Result did not contain D.class",
-            files.containsKey("D.class"));
-    }
-
-    /**
-     * Test dependency traversal (closure)
-     */
-    @Test
-    public void testClosure() {
-        buildRule.executeTarget("src1setup");
-        buildRule.executeTarget("compile");
-
-        FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("tempsrc.dir")), 5);
-        FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("classes.dir")), 5);
-
-        buildRule.executeTarget("testclosure");
-        Hashtable files = getResultFiles();
-        assertTrue("Depend did not leave correct number of files", 
-            files.size() <= 2);
-        assertTrue("Result did not contain D.class",
-            files.containsKey("D.class"));
-    }
-
-    /**
-     * Test that inner class dependencies trigger deletion of the outer class
-     */
-    @Test
-    public void testInner() {
-        buildRule.executeTarget("src2setup");
-        buildRule.executeTarget("compile");
-
-        FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("tempsrc.dir")), 5);
-        FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("classes.dir")), 5);
-
-
-        buildRule.executeTarget("testinner");
-        assertEquals("Depend did not leave correct number of files", 0,
-            getResultFiles().size());
-    }
-
-    /**
-     * Test that multi-leve inner class dependencies trigger deletion of
-     * the outer class
-     */
-    @Test
-    public void testInnerInner() {
-        buildRule.executeTarget("src3setup");
-        buildRule.executeTarget("compile");
-
-        FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("tempsrc.dir")), 5);
-        FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("classes.dir")), 5);
-
-        buildRule.executeTarget("testinnerinner");
-        assertEquals("Depend did not leave correct number of files", 0,
-            getResultFiles().size());
-    }
-
-    /**
-     * Test that an exception is thrown when there is no source
-     */
-    @Test
-    public void testNoSource() {
-        try {
-            buildRule.executeTarget("testnosource");
-            fail("Build exception expected: No source specified");
-        } catch(BuildException ex) {
-            assertContains("srcdir attribute must be set", ex.getMessage());
-        }
-    }
-
-    /**
-     * Test that an exception is thrown when the source attribute is empty
-     */
-    @Test
-    public void testEmptySource() {
-        try {
-            buildRule.executeTarget("testemptysource");
-            fail("Build exception expected: No source specified");
-        } catch(BuildException ex) {
-            assertContains("srcdir attribute must be non-empty", ex.getMessage());
-        }
-    }
-
-    /**
-     * Read the result fileset into a Hashtable
-     *
-     * @return a Hashtable containing the names of the files in the result
-     * fileset
-     */
-    private Hashtable getResultFiles() {
-        FileSet resultFileSet = (FileSet) buildRule.getProject().getReference(RESULT_FILESET);
-        DirectoryScanner scanner = resultFileSet.getDirectoryScanner(buildRule.getProject());
-        String[] scannedFiles = scanner.getIncludedFiles();
-        Hashtable files = new Hashtable();
-        for (int i = 0; i < scannedFiles.length; ++i) {
-            files.put(scannedFiles[i], scannedFiles[i]);
-        }
-        return files;
-    }
-
-
-    /**
-     * Test mutual dependency between inner and outer do not cause both to be
-     * deleted
-     */
-    @Test
-    public void testInnerClosure() {
-        buildRule.executeTarget("testinnerclosure");
-        assertEquals("Depend did not leave correct number of files", 4,
-            getResultFiles().size());
-    }
-
-    /**
-     * Test the operation of the cache
-     */
-    @Test
-    public void testCache() {
-        buildRule.executeTarget("testcache");
-    }
-
-    /**
-     * Test the detection and warning of non public classes
-     */
-    @Test
-    public void testNonPublic() {
-        buildRule.executeTarget("src5setup");
-        buildRule.executeTarget("compile");
-
-        FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("tempsrc.dir")), 5);
-        FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("classes.dir")), 5);
-
-        buildRule.executeTarget("testnonpublic");
-        String log = buildRule.getLog();
-        assertContains("Expected warning about APrivate",
-            "The class APrivate in file", log);
-        assertContains("but has not been deleted because its source file "
-            + "could not be determined",
-            "The class APrivate in file", log);
-    }
-
-}
+/*
+ *  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.depend;
+
+import java.io.File;
+import java.util.Hashtable;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileRule;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.FileUtilities;
+import org.apache.tools.ant.types.FileSet;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.apache.tools.ant.AntAssert.assertContains;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * Testcase for the Depend optional task.
+ *
+ */
+public class DependTest {
+    public static final String RESULT_FILESET = "result";
+
+    public static final String TEST_BUILD_FILE
+        = "src/etc/testcases/taskdefs/optional/depend/depend.xml";
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject(TEST_BUILD_FILE);
+    }
+
+    /**
+     * Test direct dependency removal
+     */
+    @Test
+    public void testDirect() {
+        buildRule.executeTarget("src1setup");
+        buildRule.executeTarget("compile");
+
+        FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("tempsrc.dir")), 5);
+        FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("classes.dir")), 5);
+
+        buildRule.executeTarget("testdirect");
+        Hashtable files = getResultFiles();
+        assertEquals("Depend did not leave correct number of files", 3,
+            files.size());
+        assertTrue("Result did not contain A.class",
+            files.containsKey("A.class"));
+        assertTrue("Result did not contain D.class",
+            files.containsKey("D.class"));
+    }
+
+    /**
+     * Test dependency traversal (closure)
+     */
+    @Test
+    public void testClosure() {
+        buildRule.executeTarget("src1setup");
+        buildRule.executeTarget("compile");
+
+        FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("tempsrc.dir")), 5);
+        FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("classes.dir")), 5);
+
+        buildRule.executeTarget("testclosure");
+        Hashtable files = getResultFiles();
+        assertTrue("Depend did not leave correct number of files",
+            files.size() <= 2);
+        assertTrue("Result did not contain D.class",
+            files.containsKey("D.class"));
+    }
+
+    /**
+     * Test that inner class dependencies trigger deletion of the outer class
+     */
+    @Test
+    public void testInner() {
+        buildRule.executeTarget("src2setup");
+        buildRule.executeTarget("compile");
+
+        FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("tempsrc.dir")), 5);
+        FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("classes.dir")), 5);
+
+
+        buildRule.executeTarget("testinner");
+        assertEquals("Depend did not leave correct number of files", 0,
+            getResultFiles().size());
+    }
+
+    /**
+     * Test that multi-leve inner class dependencies trigger deletion of
+     * the outer class
+     */
+    @Test
+    public void testInnerInner() {
+        buildRule.executeTarget("src3setup");
+        buildRule.executeTarget("compile");
+
+        FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("tempsrc.dir")), 5);
+        FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("classes.dir")), 5);
+
+        buildRule.executeTarget("testinnerinner");
+        assertEquals("Depend did not leave correct number of files", 0,
+            getResultFiles().size());
+    }
+
+    /**
+     * Test that an exception is thrown when there is no source
+     */
+    @Test
+    public void testNoSource() {
+        try {
+            buildRule.executeTarget("testnosource");
+            fail("Build exception expected: No source specified");
+        } catch(BuildException ex) {
+            assertContains("srcdir attribute must be set", ex.getMessage());
+        }
+    }
+
+    /**
+     * Test that an exception is thrown when the source attribute is empty
+     */
+    @Test
+    public void testEmptySource() {
+        try {
+            buildRule.executeTarget("testemptysource");
+            fail("Build exception expected: No source specified");
+        } catch(BuildException ex) {
+            assertContains("srcdir attribute must be non-empty", ex.getMessage());
+        }
+    }
+
+    /**
+     * Read the result fileset into a Hashtable
+     *
+     * @return a Hashtable containing the names of the files in the result
+     * fileset
+     */
+    private Hashtable getResultFiles() {
+        FileSet resultFileSet = (FileSet) buildRule.getProject().getReference(RESULT_FILESET);
+        DirectoryScanner scanner = resultFileSet.getDirectoryScanner(buildRule.getProject());
+        String[] scannedFiles = scanner.getIncludedFiles();
+        Hashtable files = new Hashtable();
+        for (int i = 0; i < scannedFiles.length; ++i) {
+            files.put(scannedFiles[i], scannedFiles[i]);
+        }
+        return files;
+    }
+
+
+    /**
+     * Test mutual dependency between inner and outer do not cause both to be
+     * deleted
+     */
+    @Test
+    public void testInnerClosure() {
+        buildRule.executeTarget("testinnerclosure");
+        assertEquals("Depend did not leave correct number of files", 4,
+            getResultFiles().size());
+    }
+
+    /**
+     * Test the operation of the cache
+     */
+    @Test
+    public void testCache() {
+        buildRule.executeTarget("testcache");
+    }
+
+    /**
+     * Test the detection and warning of non public classes
+     */
+    @Test
+    public void testNonPublic() {
+        buildRule.executeTarget("src5setup");
+        buildRule.executeTarget("compile");
+
+        FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("tempsrc.dir")), 5);
+        FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("classes.dir")), 5);
+
+        buildRule.executeTarget("testnonpublic");
+        String log = buildRule.getLog();
+        assertContains("Expected warning about APrivate",
+            "The class APrivate in file", log);
+        assertContains("but has not been deleted because its source file "
+            + "could not be determined",
+            "The class APrivate in file", log);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/i18n/TranslateTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/i18n/TranslateTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/i18n/TranslateTest.java
index b8749c0..812979c 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/i18n/TranslateTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/i18n/TranslateTest.java
@@ -1,87 +1,86 @@
-/*
- *  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.i18n;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-
-import static org.junit.Assert.assertTrue;
-
-/**
- * Tests the Translate task.
- *
- * @since     Ant 1.6
- */
-public class TranslateTest {
-
-    @Rule
-    public final BuildFileRule buildRule = new BuildFileRule();
-
-    static private final int BUF_SIZE = 32768;
-
-    private final static String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/i18n/translate";
-
-
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject(TASKDEFS_DIR + "/translate.xml");
-    }
-
-    @Test
-    public void test1() throws IOException {
-        buildRule.executeTarget("test1");
-        assertTrue("translation of "+ TASKDEFS_DIR + "/input/template.txt",compareFiles(new File(buildRule.getProject().getBaseDir(), "expected/de/template.txt"),
-                new File(buildRule.getOutputDir(), "de/template.txt")));
-    }
-    private boolean compareFiles(File file1, File file2) throws IOException {
-        if (!file1.exists() || !file2.exists()) {
-            return false;
-        }
-
-        if (file1.length() != file2.length()) {
-            return false;
-        }
-
-        // byte - byte compare
-        byte[] buffer1 = new byte[BUF_SIZE];
-        byte[] buffer2 = new byte[BUF_SIZE];
-
-        FileInputStream fis1 = new FileInputStream(file1);
-        FileInputStream fis2 = new FileInputStream(file2);
-        int index = 0;
-        int read = 0;
-        while ((read = fis1.read(buffer1)) != -1) {
-            fis2.read(buffer2);
-            for (int i = 0; i < read; ++i, ++index) {
-                if (buffer1[i] != buffer2[i]) {
-                    return false;
-                }
-            }
-        }
-        return true;
-    }
-}
-
+/*
+ *  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.i18n;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Tests the Translate task.
+ *
+ * @since     Ant 1.6
+ */
+public class TranslateTest {
+
+    @Rule
+    public final BuildFileRule buildRule = new BuildFileRule();
+
+    static private final int BUF_SIZE = 32768;
+
+    private final static String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/i18n/translate";
+
+
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject(TASKDEFS_DIR + "/translate.xml");
+    }
+
+    @Test
+    public void test1() throws IOException {
+        buildRule.executeTarget("test1");
+        assertTrue("translation of "+ TASKDEFS_DIR + "/input/template.txt",compareFiles(new File(buildRule.getProject().getBaseDir(), "expected/de/template.txt"),
+                new File(buildRule.getOutputDir(), "de/template.txt")));
+    }
+    private boolean compareFiles(File file1, File file2) throws IOException {
+        if (!file1.exists() || !file2.exists()) {
+            return false;
+        }
+
+        if (file1.length() != file2.length()) {
+            return false;
+        }
+
+        // byte - byte compare
+        byte[] buffer1 = new byte[BUF_SIZE];
+        byte[] buffer2 = new byte[BUF_SIZE];
+
+        FileInputStream fis1 = new FileInputStream(file1);
+        FileInputStream fis2 = new FileInputStream(file2);
+        int index = 0;
+        int read = 0;
+        while ((read = fis1.read(buffer1)) != -1) {
+            fis2.read(buffer2);
+            for (int i = 0; i < read; ++i, ++index) {
+                if (buffer1[i] != buffer2[i]) {
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageTest.java
index a13a466..eeece1c 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageTest.java
@@ -1,133 +1,132 @@
-/*
- *  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.image;
-
-import org.apache.tools.ant.AntAssert;
-import org.apache.tools.ant.BuildFileRule;
-import org.apache.tools.ant.util.FileUtils;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-
-import java.io.File;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeTrue;
-
-
-/**
- * Tests the Image task.
- *
- * @since     Ant 1.5
- */
-public class ImageTest {
-
-    private final static String TASKDEFS_DIR = 
-        "src/etc/testcases/taskdefs/optional/image/";
-    private final static String LARGEIMAGE = "largeimage.jpg";
-
-    private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject(TASKDEFS_DIR + "image.xml");
-    }
-
-
-    @Test
-    public void testEchoToLog() {
-        buildRule.executeTarget("testEchoToLog");
-        AntAssert.assertContains("Processing File", buildRule.getLog());
-    }
-
-    @Test
-    public void testSimpleScale(){
-        buildRule.executeTarget("testSimpleScale");
-        AntAssert.assertContains("Processing File", buildRule.getLog());
-
-        File f = new File(buildRule.getOutputDir(), LARGEIMAGE);
-        assertTrue(
-                   "Did not create "+f.getAbsolutePath(),
-                   f.exists());
-
-    }
-
-    @Test
-    public void testOverwriteTrue() throws InterruptedException {
-        buildRule.executeTarget("testSimpleScale");
-        AntAssert.assertContains("Processing File", buildRule.getLog());
-        File f = new File(buildRule.getOutputDir(), LARGEIMAGE);
-        assumeTrue("Could not change file modificaiton date",
-                f.setLastModified(f.lastModified() - (FILE_UTILS.getFileTimestampGranularity() * 2)));
-        long lastModified = f.lastModified();
-        buildRule.executeTarget("testOverwriteTrue");
-        AntAssert.assertContains("Processing File", buildRule.getLog());
-        f = new File(buildRule.getOutputDir(), LARGEIMAGE);
-        long overwrittenLastModified = f.lastModified();
-        assertTrue("File was not overwritten.",
-                   lastModified < overwrittenLastModified);
-    }
-
-    @Test
-    public void testOverwriteFalse() {
-        buildRule.executeTarget("testSimpleScale");
-        AntAssert.assertContains("Processing File", buildRule.getLog());
-        File f = new File(buildRule.getOutputDir(), LARGEIMAGE);
-        long lastModified = f.lastModified();
-        buildRule.executeTarget("testOverwriteFalse");
-        AntAssert.assertContains("Processing File", buildRule.getLog());
-        f = new File(buildRule.getOutputDir(), LARGEIMAGE);
-        long overwrittenLastModified = f.lastModified();
-        assertTrue("File was overwritten.",
-                   lastModified == overwrittenLastModified);
-    }
-
-    @Test
-    public void testSimpleScaleWithMapper() {
-        buildRule.executeTarget("testSimpleScaleWithMapper");
-        AntAssert.assertContains("Processing File", buildRule.getLog());
-        File f = new File(buildRule.getOutputDir(), "scaled-" + LARGEIMAGE);
-        assertTrue(
-                   "Did not create "+f.getAbsolutePath(),
-                   f.exists());
-
-    }
-
-    @Test
-    @Ignore("Previously named in a manner to prevent execution")
-    public void testFailOnError() {
-        try {
-            buildRule.executeTarget("testFailOnError");
-            AntAssert.assertContains("Unable to process image stream", buildRule.getLog());
-        }
-        catch (RuntimeException re){
-            assertTrue("Run time exception should say "
-                       + "'Unable to process image stream'. :" 
-                       + re.toString(),
-                       re.toString()
-                       .indexOf("Unable to process image stream") > -1);
-        }
-    }
-
-}
-
+/*
+ *  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.image;
+
+import org.apache.tools.ant.AntAssert;
+import org.apache.tools.ant.BuildFileRule;
+import org.apache.tools.ant.util.FileUtils;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+import java.io.File;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
+
+
+/**
+ * Tests the Image task.
+ *
+ * @since     Ant 1.5
+ */
+public class ImageTest {
+
+    private final static String TASKDEFS_DIR =
+        "src/etc/testcases/taskdefs/optional/image/";
+    private final static String LARGEIMAGE = "largeimage.jpg";
+
+    private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject(TASKDEFS_DIR + "image.xml");
+    }
+
+
+    @Test
+    public void testEchoToLog() {
+        buildRule.executeTarget("testEchoToLog");
+        AntAssert.assertContains("Processing File", buildRule.getLog());
+    }
+
+    @Test
+    public void testSimpleScale(){
+        buildRule.executeTarget("testSimpleScale");
+        AntAssert.assertContains("Processing File", buildRule.getLog());
+
+        File f = new File(buildRule.getOutputDir(), LARGEIMAGE);
+        assertTrue(
+                   "Did not create "+f.getAbsolutePath(),
+                   f.exists());
+
+    }
+
+    @Test
+    public void testOverwriteTrue() throws InterruptedException {
+        buildRule.executeTarget("testSimpleScale");
+        AntAssert.assertContains("Processing File", buildRule.getLog());
+        File f = new File(buildRule.getOutputDir(), LARGEIMAGE);
+        assumeTrue("Could not change file modificaiton date",
+                f.setLastModified(f.lastModified() - (FILE_UTILS.getFileTimestampGranularity() * 2)));
+        long lastModified = f.lastModified();
+        buildRule.executeTarget("testOverwriteTrue");
+        AntAssert.assertContains("Processing File", buildRule.getLog());
+        f = new File(buildRule.getOutputDir(), LARGEIMAGE);
+        long overwrittenLastModified = f.lastModified();
+        assertTrue("File was not overwritten.",
+                   lastModified < overwrittenLastModified);
+    }
+
+    @Test
+    public void testOverwriteFalse() {
+        buildRule.executeTarget("testSimpleScale");
+        AntAssert.assertContains("Processing File", buildRule.getLog());
+        File f = new File(buildRule.getOutputDir(), LARGEIMAGE);
+        long lastModified = f.lastModified();
+        buildRule.executeTarget("testOverwriteFalse");
+        AntAssert.assertContains("Processing File", buildRule.getLog());
+        f = new File(buildRule.getOutputDir(), LARGEIMAGE);
+        long overwrittenLastModified = f.lastModified();
+        assertTrue("File was overwritten.",
+                   lastModified == overwrittenLastModified);
+    }
+
+    @Test
+    public void testSimpleScaleWithMapper() {
+        buildRule.executeTarget("testSimpleScaleWithMapper");
+        AntAssert.assertContains("Processing File", buildRule.getLog());
+        File f = new File(buildRule.getOutputDir(), "scaled-" + LARGEIMAGE);
+        assertTrue(
+                   "Did not create "+f.getAbsolutePath(),
+                   f.exists());
+
+    }
+
+    @Test
+    @Ignore("Previously named in a manner to prevent execution")
+    public void testFailOnError() {
+        try {
+            buildRule.executeTarget("testFailOnError");
+            AntAssert.assertContains("Unable to process image stream", buildRule.getLog());
+        }
+        catch (RuntimeException re){
+            assertTrue("Run time exception should say "
+                       + "'Unable to process image stream'. :"
+                       + re.toString(),
+                       re.toString()
+                       .indexOf("Unable to process image stream") > -1);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTest.java
index 54c6055..545b7cb 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTest.java
@@ -1,99 +1,99 @@
-/*
- *  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.jdepend;
-
-import org.apache.tools.ant.AntAssert;
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-/**
- * Testcase for the JDepend optional task.
- *
- */
-public class JDependTest {
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject(
-                "src/etc/testcases/taskdefs/optional/jdepend/jdepend.xml");
-    }
-
-    /**
-     * Test simple
-     */
-    @Test
-    public void testSimple() {
-        buildRule.executeTarget("simple");
-        AntAssert.assertContains("Package: org.apache.tools.ant.util.facade",
-                buildRule.getOutput());
-    }
-
-    /**
-     * Test xml
-     */
-    @Test
-    public void testXml() {
-        buildRule.executeTarget("xml");
-        AntAssert.assertContains("<DependsUpon>", buildRule.getOutput());
-    }
-
-    /**
-     * Test fork
-     * - forked output goes to log
-     */
-    @Test
-    public void testFork() {
-        buildRule.executeTarget("fork");
-        AntAssert.assertContains("Package: org.apache.tools.ant.util.facade", buildRule.getLog());
-    }
-
-    /**
-     * Test fork xml
-     */
-    @Test
-    public void testForkXml() {
-        buildRule.executeTarget("fork-xml");
-        AntAssert.assertContains("<DependsUpon>", buildRule.getLog());
-    }
-
-    /**
-     * Test timeout
-     */
-    @Test
-    public void testTimeout() {
-        buildRule.executeTarget("fork-xml");
-        AntAssert.assertContains( "JDepend FAILED - Timed out", buildRule.getLog());
-    }
-
-
-    /**
-     * Test timeout without timing out
-     */
-    @Test
-    public void testTimeoutNot() {
-        buildRule.executeTarget("fork-timeout-not");
-        AntAssert.assertContains("Package: org.apache.tools.ant.util.facade", buildRule.getLog());
-    }
-
-}
+/*
+ *  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.jdepend;
+
+import org.apache.tools.ant.AntAssert;
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+/**
+ * Testcase for the JDepend optional task.
+ *
+ */
+public class JDependTest {
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject(
+                "src/etc/testcases/taskdefs/optional/jdepend/jdepend.xml");
+    }
+
+    /**
+     * Test simple
+     */
+    @Test
+    public void testSimple() {
+        buildRule.executeTarget("simple");
+        AntAssert.assertContains("Package: org.apache.tools.ant.util.facade",
+                buildRule.getOutput());
+    }
+
+    /**
+     * Test xml
+     */
+    @Test
+    public void testXml() {
+        buildRule.executeTarget("xml");
+        AntAssert.assertContains("<DependsUpon>", buildRule.getOutput());
+    }
+
+    /**
+     * Test fork
+     * - forked output goes to log
+     */
+    @Test
+    public void testFork() {
+        buildRule.executeTarget("fork");
+        AntAssert.assertContains("Package: org.apache.tools.ant.util.facade", buildRule.getLog());
+    }
+
+    /**
+     * Test fork xml
+     */
+    @Test
+    public void testForkXml() {
+        buildRule.executeTarget("fork-xml");
+        AntAssert.assertContains("<DependsUpon>", buildRule.getLog());
+    }
+
+    /**
+     * Test timeout
+     */
+    @Test
+    public void testTimeout() {
+        buildRule.executeTarget("fork-xml");
+        AntAssert.assertContains( "JDepend FAILED - Timed out", buildRule.getLog());
+    }
+
+
+    /**
+     * Test timeout without timing out
+     */
+    @Test
+    public void testTimeoutNot() {
+        buildRule.executeTarget("fork-timeout-not");
+        AntAssert.assertContains("Package: org.apache.tools.ant.util.facade", buildRule.getLog());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/BatchTestTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/BatchTestTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/BatchTestTest.java
index a969499..aa483f6 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/BatchTestTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/BatchTestTest.java
@@ -1,121 +1,121 @@
-/*
- *  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 static org.junit.Assert.fail;
-import static org.junit.Assert.assertArrayEquals;
-
-import org.junit.Test;
-
-/**
- *
- * @author  Marian Petras
- */
-public class BatchTestTest {
-    
-	@Test
-    public void testParseTestMethodNamesList() {
-        try {
-            JUnitTest.parseTestMethodNamesList(null);
-            fail("IllegalArgumentException expected when the param is <null>");
-        } catch (IllegalArgumentException ex) {
-            //this is an expected exception
-        }
-
-        assertArrayEquals(new String[0], JUnitTest.parseTestMethodNamesList(""));
-        assertArrayEquals(new String[0], JUnitTest.parseTestMethodNamesList(" "));
-        assertArrayEquals(new String[0], JUnitTest.parseTestMethodNamesList("  "));
-
-        checkParseCausesIAE(",");
-        checkParseCausesIAE(" ,");
-        checkParseCausesIAE(", ");
-        checkParseCausesIAE(" , ");
-        checkParseCausesIAE(",a");
-        checkParseCausesIAE(" ,a");
-        checkParseCausesIAE("  ,a");
-        checkParseCausesIAE("  , a");
-        checkParseCausesIAE("  ,a  ");
-        checkParseCausesIAE("  ,a  ,");
-        checkParseCausesIAE("ab,,cd");
-        checkParseCausesIAE("ab, ,cd");
-        checkParseCausesIAE("ab,  ,cd");
-        checkParseCausesIAE("ab,  ,cd,");
-        checkParseCausesIAE(",ab,  ,cd,");
-
-        assertArrayEquals(new String[] {"abc"}, JUnitTest.parseTestMethodNamesList("abc"));
-        assertArrayEquals(new String[] {"abc"}, JUnitTest.parseTestMethodNamesList("abc "));
-        assertArrayEquals(new String[] {"abc"}, JUnitTest.parseTestMethodNamesList(" abc"));
-        assertArrayEquals(new String[] {"abc"}, JUnitTest.parseTestMethodNamesList(" abc "));
-        assertArrayEquals(new String[] {"abc"}, JUnitTest.parseTestMethodNamesList("abc  "));
-        assertArrayEquals(new String[] {"abc"}, JUnitTest.parseTestMethodNamesList("abc,"));
-        assertArrayEquals(new String[] {"abc"}, JUnitTest.parseTestMethodNamesList("abc, "));
-        assertArrayEquals(new String[] {"abc"}, JUnitTest.parseTestMethodNamesList("abc ,"));
-        assertArrayEquals(new String[] {"abc"}, JUnitTest.parseTestMethodNamesList("abc , "));
-        assertArrayEquals(new String[] {"abc"}, JUnitTest.parseTestMethodNamesList(" abc  ,"));
-
-        /* legal Java identifiers: */
-        assertArrayEquals(new String[] {"a"}, JUnitTest.parseTestMethodNamesList("a"));
-        assertArrayEquals(new String[] {"a1"}, JUnitTest.parseTestMethodNamesList("a1"));
-        assertArrayEquals(new String[] {"a$"}, JUnitTest.parseTestMethodNamesList("a$"));
-        assertArrayEquals(new String[] {"a$1"}, JUnitTest.parseTestMethodNamesList("a$1"));
-        assertArrayEquals(new String[] {"_bc"}, JUnitTest.parseTestMethodNamesList("_bc"));
-        assertArrayEquals(new String[] {"___"}, JUnitTest.parseTestMethodNamesList("___"));
-
-        /* illegal Java identifiers: */
-        checkParseCausesIAE("1");
-        checkParseCausesIAE("1a");
-        checkParseCausesIAE("1ab");
-        checkParseCausesIAE("1abc");
-        checkParseCausesIAE("1abc d");
-        checkParseCausesIAE("1abc de");
-        checkParseCausesIAE("1abc def");
-        checkParseCausesIAE("1abc def,");
-        checkParseCausesIAE(",1abc def");
-
-        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList("abc,def"));
-        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList("abc,def,"));
-        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList("abc,def "));
-        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList("abc, def"));
-        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList("abc, def "));
-        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList("abc ,def"));
-        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList("abc ,def "));
-        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList("abc , def"));
-        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList("abc , def "));
-        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList(" abc,def"));
-        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList(" abc,def "));
-        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList(" abc, def"));
-        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList(" abc, def "));
-        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList(" abc ,def"));
-        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList(" abc ,def "));
-        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList(" abc , def"));
-        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList(" abc , def "));
-        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList(" abc , def ,"));
-    }
-
-    private static void checkParseCausesIAE(String param) {
-        try {
-            JUnitTest.parseTestMethodNamesList(param);
-            fail("IllegalArgumentException expected when the param is \"" + param + '"');
-        } catch (IllegalArgumentException ex) {
-            //this is an expected exception
-        }
-    }
-
-}
+/*
+ *  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 static org.junit.Assert.fail;
+import static org.junit.Assert.assertArrayEquals;
+
+import org.junit.Test;
+
+/**
+ *
+ * @author  Marian Petras
+ */
+public class BatchTestTest {
+
+    @Test
+    public void testParseTestMethodNamesList() {
+        try {
+            JUnitTest.parseTestMethodNamesList(null);
+            fail("IllegalArgumentException expected when the param is <null>");
+        } catch (IllegalArgumentException ex) {
+            //this is an expected exception
+        }
+
+        assertArrayEquals(new String[0], JUnitTest.parseTestMethodNamesList(""));
+        assertArrayEquals(new String[0], JUnitTest.parseTestMethodNamesList(" "));
+        assertArrayEquals(new String[0], JUnitTest.parseTestMethodNamesList("  "));
+
+        checkParseCausesIAE(",");
+        checkParseCausesIAE(" ,");
+        checkParseCausesIAE(", ");
+        checkParseCausesIAE(" , ");
+        checkParseCausesIAE(",a");
+        checkParseCausesIAE(" ,a");
+        checkParseCausesIAE("  ,a");
+        checkParseCausesIAE("  , a");
+        checkParseCausesIAE("  ,a  ");
+        checkParseCausesIAE("  ,a  ,");
+        checkParseCausesIAE("ab,,cd");
+        checkParseCausesIAE("ab, ,cd");
+        checkParseCausesIAE("ab,  ,cd");
+        checkParseCausesIAE("ab,  ,cd,");
+        checkParseCausesIAE(",ab,  ,cd,");
+
+        assertArrayEquals(new String[] {"abc"}, JUnitTest.parseTestMethodNamesList("abc"));
+        assertArrayEquals(new String[] {"abc"}, JUnitTest.parseTestMethodNamesList("abc "));
+        assertArrayEquals(new String[] {"abc"}, JUnitTest.parseTestMethodNamesList(" abc"));
+        assertArrayEquals(new String[] {"abc"}, JUnitTest.parseTestMethodNamesList(" abc "));
+        assertArrayEquals(new String[] {"abc"}, JUnitTest.parseTestMethodNamesList("abc  "));
+        assertArrayEquals(new String[] {"abc"}, JUnitTest.parseTestMethodNamesList("abc,"));
+        assertArrayEquals(new String[] {"abc"}, JUnitTest.parseTestMethodNamesList("abc, "));
+        assertArrayEquals(new String[] {"abc"}, JUnitTest.parseTestMethodNamesList("abc ,"));
+        assertArrayEquals(new String[] {"abc"}, JUnitTest.parseTestMethodNamesList("abc , "));
+        assertArrayEquals(new String[] {"abc"}, JUnitTest.parseTestMethodNamesList(" abc  ,"));
+
+        /* legal Java identifiers: */
+        assertArrayEquals(new String[] {"a"}, JUnitTest.parseTestMethodNamesList("a"));
+        assertArrayEquals(new String[] {"a1"}, JUnitTest.parseTestMethodNamesList("a1"));
+        assertArrayEquals(new String[] {"a$"}, JUnitTest.parseTestMethodNamesList("a$"));
+        assertArrayEquals(new String[] {"a$1"}, JUnitTest.parseTestMethodNamesList("a$1"));
+        assertArrayEquals(new String[] {"_bc"}, JUnitTest.parseTestMethodNamesList("_bc"));
+        assertArrayEquals(new String[] {"___"}, JUnitTest.parseTestMethodNamesList("___"));
+
+        /* illegal Java identifiers: */
+        checkParseCausesIAE("1");
+        checkParseCausesIAE("1a");
+        checkParseCausesIAE("1ab");
+        checkParseCausesIAE("1abc");
+        checkParseCausesIAE("1abc d");
+        checkParseCausesIAE("1abc de");
+        checkParseCausesIAE("1abc def");
+        checkParseCausesIAE("1abc def,");
+        checkParseCausesIAE(",1abc def");
+
+        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList("abc,def"));
+        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList("abc,def,"));
+        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList("abc,def "));
+        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList("abc, def"));
+        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList("abc, def "));
+        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList("abc ,def"));
+        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList("abc ,def "));
+        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList("abc , def"));
+        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList("abc , def "));
+        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList(" abc,def"));
+        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList(" abc,def "));
+        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList(" abc, def"));
+        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList(" abc, def "));
+        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList(" abc ,def"));
+        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList(" abc ,def "));
+        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList(" abc , def"));
+        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList(" abc , def "));
+        assertArrayEquals(new String[] {"abc", "def"}, JUnitTest.parseTestMethodNamesList(" abc , def ,"));
+    }
+
+    private static void checkParseCausesIAE(String param) {
+        try {
+            JUnitTest.parseTestMethodNamesList(param);
+            fail("IllegalArgumentException expected when the param is \"" + param + '"');
+        } catch (IllegalArgumentException ex) {
+            //this is an expected exception
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/DOMUtilTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/DOMUtilTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/DOMUtilTest.java
index 7591ada..c322401 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/DOMUtilTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/DOMUtilTest.java
@@ -1,53 +1,53 @@
-/*
- *  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 static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.xml.parsers.DocumentBuilder;
-
-import org.apache.tools.ant.util.JAXPUtils;
-import org.junit.Test;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-
-public class DOMUtilTest {
-	
-	@Test
-    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.getDocumentElement(), new FooNodeFilter(), true);
-        assertEquals("expecting 3", 3, nl.getLength());
-    }
-	
-    public class FooNodeFilter implements DOMUtil.NodeFilter {
-        public boolean accept(Node node) {
-            if (node.getNodeName().equals("foo")) {
-                return true;
-            }
-            return false;
-        }
-    }
-}
+/*
+ *  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 static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.xml.parsers.DocumentBuilder;
+
+import org.apache.tools.ant.util.JAXPUtils;
+import org.junit.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+public class DOMUtilTest {
+
+    @Test
+    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.getDocumentElement(), new FooNodeFilter(), true);
+        assertEquals("expecting 3", 3, nl.getLength());
+    }
+
+    public class FooNodeFilter implements DOMUtil.NodeFilter {
+        public boolean accept(Node node) {
+            if (node.getNodeName().equals("foo")) {
+                return true;
+            }
+            return false;
+        }
+    }
+}


[12/21] ant git commit: Normalise tabulation and line breaks

Posted by gi...@apache.org.
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/MapperTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/MapperTest.java b/src/tests/junit/org/apache/tools/ant/types/MapperTest.java
index 8758238..980f5cc 100644
--- a/src/tests/junit/org/apache/tools/ant/types/MapperTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/MapperTest.java
@@ -1,235 +1,235 @@
-/*
- *  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.types;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.BuildFileRule;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.util.ChainedMapper;
-import org.apache.tools.ant.util.FileNameMapper;
-import org.apache.tools.ant.util.FlatFileNameMapper;
-import org.apache.tools.ant.util.GlobPatternMapper;
-import org.apache.tools.ant.util.MergingMapper;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-/**
- * JUnit testcases for org.apache.tools.ant.types.Mapper.
- *
- */
-
-public class MapperTest {
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    private Project project;
-
-    @Before
-    public void setUp() {
-        project = new Project();
-        project.setBasedir(".");
-    }
-
-    @Test
-    public void testEmptyElementIfIsReference() {
-        Mapper m = new Mapper(project);
-        m.setFrom("*.java");
-        try {
-            m.setRefid(new Reference(project, "dummyref"));
-            fail("Can add reference to Mapper with from attribute set");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute when using refid",
-                    be.getMessage());
-        }
-
-        m = new Mapper(project);
-        m.setRefid(new Reference(project, "dummyref"));
-        try {
-            m.setFrom("*.java");
-            fail("Can set from in Mapper that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute when using refid",
-                    be.getMessage());
-        }
-
-        m = new Mapper(project);
-        m.setRefid(new Reference(project, "dummyref"));
-        try {
-            m.setTo("*.java");
-            fail("Can set to in Mapper that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute when using refid",
-                    be.getMessage());
-        }
-        try {
-            Mapper.MapperType mt = new Mapper.MapperType();
-            mt.setValue("glob");
-            m.setType(mt);
-            fail("Can set type in Mapper that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute when using refid",
-                    be.getMessage());
-        }
-    }
-
-    @Test
-    public void testCircularReferenceCheck() {
-        Mapper m = new Mapper(project);
-        project.addReference("dummy", m);
-        m.setRefid(new Reference(project, "dummy"));
-        try {
-            m.getImplementation();
-            fail("Can make Mapper a Reference to itself.");
-        } catch (BuildException be) {
-            assertEquals("This data type contains a circular reference.",
-                    be.getMessage());
-        }
-
-        // dummy1 --> dummy2 --> dummy3 --> dummy1
-        Mapper m1 = new Mapper(project);
-        project.addReference("dummy1", m1);
-        m1.setRefid(new Reference(project, "dummy2"));
-        Mapper m2 = new Mapper(project);
-        project.addReference("dummy2", m2);
-        m2.setRefid(new Reference(project, "dummy3"));
-        Mapper m3 = new Mapper(project);
-        project.addReference("dummy3", m3);
-        m3.setRefid(new Reference(project, "dummy1"));
-        try {
-            m1.getImplementation();
-            fail("Can make circular reference.");
-        } catch (BuildException be) {
-            assertEquals("This data type contains a circular reference.",
-                    be.getMessage());
-        }
-
-        // dummy1 --> dummy2 --> dummy3
-        // (which holds a glob mapper from "*.java" to "*.class"
-        m1 = new Mapper(project);
-        project.addReference("dummy1", m1);
-        m1.setRefid(new Reference(project, "dummy2"));
-        m2 = new Mapper(project);
-        project.addReference("dummy2", m2);
-        m2.setRefid(new Reference(project, "dummy3"));
-        m3 = new Mapper(project);
-        project.addReference("dummy3", m3);
-        Mapper.MapperType mt = new Mapper.MapperType();
-        mt.setValue("glob");
-        m3.setType(mt);
-        m3.setFrom("*.java");
-        m3.setTo("*.class");
-        FileNameMapper fmm = m1.getImplementation();
-        assertTrue("should be glob", fmm instanceof GlobPatternMapper);
-        String[] result = fmm.mapFileName("a.java");
-        assertEquals("a.java should match", 1, result.length);
-        assertEquals("a.class", result[0]);
-    }
-
-    @Test
-    public void testNested() {
-        Mapper mapper1 = new Mapper(project);
-        Mapper.MapperType mt = new Mapper.MapperType();
-        mt.setValue("glob");
-        mapper1.setType(mt);
-        mapper1.setFrom("from*");
-        mapper1.setTo("to*");
-
-        //mix element types
-        FileNameMapper mapper2 = new FlatFileNameMapper();
-        FileNameMapper mapper3 = new MergingMapper();
-        mapper3.setTo("mergefile");
-
-        Mapper container = new Mapper(project);
-        container.addConfiguredMapper(mapper1);
-        container.add(mapper2);
-        container.add(mapper3);
-
-        FileNameMapper fileNameMapper = container.getImplementation();
-        String[] targets = fileNameMapper.mapFileName("fromfilename");
-        assertNotNull("no filenames mapped", targets);
-        assertEquals("wrong number of filenames mapped", 3, targets.length);
-        List list = Arrays.asList(targets);
-        assertTrue("cannot find expected target \"tofilename\"",
-                list.contains("tofilename"));
-        assertTrue("cannot find expected target \"fromfilename\"",
-                list.contains("fromfilename"));
-        assertTrue("cannot find expected target \"mergefile\"",
-                list.contains("mergefile"));
-    }
-
-    @Test
-    public void testChained() {
-
-        // a --> b --> c --- def
-        //               \-- ghi
-
-        FileNameMapper mapperAB = new GlobPatternMapper();
-        mapperAB.setFrom("a");
-        mapperAB.setTo("b");
-
-        FileNameMapper mapperBC = new GlobPatternMapper();
-        mapperBC.setFrom("b");
-        mapperBC.setTo("c");
-
-        //implicit composite
-        Mapper mapperCX = new Mapper(project);
-
-        FileNameMapper mapperDEF = new GlobPatternMapper();
-        mapperDEF.setFrom("c");
-        mapperDEF.setTo("def");
-
-        FileNameMapper mapperGHI = new GlobPatternMapper();
-        mapperGHI.setFrom("c");
-        mapperGHI.setTo("ghi");
-
-        mapperCX.add(mapperDEF);
-        mapperCX.add(mapperGHI);
-
-        Mapper chained = new Mapper(project);
-        chained.setClassname(ChainedMapper.class.getName());
-        chained.add(mapperAB);
-        chained.add(mapperBC);
-        chained.addConfiguredMapper(mapperCX);
-
-        FileNameMapper fileNameMapper = chained.getImplementation();
-        String[] targets = fileNameMapper.mapFileName("a");
-        assertNotNull("no filenames mapped", targets);
-        assertEquals("wrong number of filenames mapped", 2, targets.length);
-        List list = Arrays.asList(targets);
-        assertTrue("cannot find expected target \"def\"", list.contains("def"));
-        assertTrue("cannot find expected target \"ghi\"", list.contains("ghi"));
-    }
-
-    @Test
-    public void testCopyTaskWithTwoFilesets() {
-        buildRule.configureProject("src/etc/testcases/types/mapper.xml");
-        buildRule.executeTarget("test1");
-    }
-
-}
+/*
+ *  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.types;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileRule;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.util.ChainedMapper;
+import org.apache.tools.ant.util.FileNameMapper;
+import org.apache.tools.ant.util.FlatFileNameMapper;
+import org.apache.tools.ant.util.GlobPatternMapper;
+import org.apache.tools.ant.util.MergingMapper;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * JUnit testcases for org.apache.tools.ant.types.Mapper.
+ *
+ */
+
+public class MapperTest {
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    private Project project;
+
+    @Before
+    public void setUp() {
+        project = new Project();
+        project.setBasedir(".");
+    }
+
+    @Test
+    public void testEmptyElementIfIsReference() {
+        Mapper m = new Mapper(project);
+        m.setFrom("*.java");
+        try {
+            m.setRefid(new Reference(project, "dummyref"));
+            fail("Can add reference to Mapper with from attribute set");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute when using refid",
+                    be.getMessage());
+        }
+
+        m = new Mapper(project);
+        m.setRefid(new Reference(project, "dummyref"));
+        try {
+            m.setFrom("*.java");
+            fail("Can set from in Mapper that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute when using refid",
+                    be.getMessage());
+        }
+
+        m = new Mapper(project);
+        m.setRefid(new Reference(project, "dummyref"));
+        try {
+            m.setTo("*.java");
+            fail("Can set to in Mapper that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute when using refid",
+                    be.getMessage());
+        }
+        try {
+            Mapper.MapperType mt = new Mapper.MapperType();
+            mt.setValue("glob");
+            m.setType(mt);
+            fail("Can set type in Mapper that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute when using refid",
+                    be.getMessage());
+        }
+    }
+
+    @Test
+    public void testCircularReferenceCheck() {
+        Mapper m = new Mapper(project);
+        project.addReference("dummy", m);
+        m.setRefid(new Reference(project, "dummy"));
+        try {
+            m.getImplementation();
+            fail("Can make Mapper a Reference to itself.");
+        } catch (BuildException be) {
+            assertEquals("This data type contains a circular reference.",
+                    be.getMessage());
+        }
+
+        // dummy1 --> dummy2 --> dummy3 --> dummy1
+        Mapper m1 = new Mapper(project);
+        project.addReference("dummy1", m1);
+        m1.setRefid(new Reference(project, "dummy2"));
+        Mapper m2 = new Mapper(project);
+        project.addReference("dummy2", m2);
+        m2.setRefid(new Reference(project, "dummy3"));
+        Mapper m3 = new Mapper(project);
+        project.addReference("dummy3", m3);
+        m3.setRefid(new Reference(project, "dummy1"));
+        try {
+            m1.getImplementation();
+            fail("Can make circular reference.");
+        } catch (BuildException be) {
+            assertEquals("This data type contains a circular reference.",
+                    be.getMessage());
+        }
+
+        // dummy1 --> dummy2 --> dummy3
+        // (which holds a glob mapper from "*.java" to "*.class"
+        m1 = new Mapper(project);
+        project.addReference("dummy1", m1);
+        m1.setRefid(new Reference(project, "dummy2"));
+        m2 = new Mapper(project);
+        project.addReference("dummy2", m2);
+        m2.setRefid(new Reference(project, "dummy3"));
+        m3 = new Mapper(project);
+        project.addReference("dummy3", m3);
+        Mapper.MapperType mt = new Mapper.MapperType();
+        mt.setValue("glob");
+        m3.setType(mt);
+        m3.setFrom("*.java");
+        m3.setTo("*.class");
+        FileNameMapper fmm = m1.getImplementation();
+        assertTrue("should be glob", fmm instanceof GlobPatternMapper);
+        String[] result = fmm.mapFileName("a.java");
+        assertEquals("a.java should match", 1, result.length);
+        assertEquals("a.class", result[0]);
+    }
+
+    @Test
+    public void testNested() {
+        Mapper mapper1 = new Mapper(project);
+        Mapper.MapperType mt = new Mapper.MapperType();
+        mt.setValue("glob");
+        mapper1.setType(mt);
+        mapper1.setFrom("from*");
+        mapper1.setTo("to*");
+
+        //mix element types
+        FileNameMapper mapper2 = new FlatFileNameMapper();
+        FileNameMapper mapper3 = new MergingMapper();
+        mapper3.setTo("mergefile");
+
+        Mapper container = new Mapper(project);
+        container.addConfiguredMapper(mapper1);
+        container.add(mapper2);
+        container.add(mapper3);
+
+        FileNameMapper fileNameMapper = container.getImplementation();
+        String[] targets = fileNameMapper.mapFileName("fromfilename");
+        assertNotNull("no filenames mapped", targets);
+        assertEquals("wrong number of filenames mapped", 3, targets.length);
+        List list = Arrays.asList(targets);
+        assertTrue("cannot find expected target \"tofilename\"",
+                list.contains("tofilename"));
+        assertTrue("cannot find expected target \"fromfilename\"",
+                list.contains("fromfilename"));
+        assertTrue("cannot find expected target \"mergefile\"",
+                list.contains("mergefile"));
+    }
+
+    @Test
+    public void testChained() {
+
+        // a --> b --> c --- def
+        //               \-- ghi
+
+        FileNameMapper mapperAB = new GlobPatternMapper();
+        mapperAB.setFrom("a");
+        mapperAB.setTo("b");
+
+        FileNameMapper mapperBC = new GlobPatternMapper();
+        mapperBC.setFrom("b");
+        mapperBC.setTo("c");
+
+        //implicit composite
+        Mapper mapperCX = new Mapper(project);
+
+        FileNameMapper mapperDEF = new GlobPatternMapper();
+        mapperDEF.setFrom("c");
+        mapperDEF.setTo("def");
+
+        FileNameMapper mapperGHI = new GlobPatternMapper();
+        mapperGHI.setFrom("c");
+        mapperGHI.setTo("ghi");
+
+        mapperCX.add(mapperDEF);
+        mapperCX.add(mapperGHI);
+
+        Mapper chained = new Mapper(project);
+        chained.setClassname(ChainedMapper.class.getName());
+        chained.add(mapperAB);
+        chained.add(mapperBC);
+        chained.addConfiguredMapper(mapperCX);
+
+        FileNameMapper fileNameMapper = chained.getImplementation();
+        String[] targets = fileNameMapper.mapFileName("a");
+        assertNotNull("no filenames mapped", targets);
+        assertEquals("wrong number of filenames mapped", 2, targets.length);
+        List list = Arrays.asList(targets);
+        assertTrue("cannot find expected target \"def\"", list.contains("def"));
+        assertTrue("cannot find expected target \"ghi\"", list.contains("ghi"));
+    }
+
+    @Test
+    public void testCopyTaskWithTwoFilesets() {
+        buildRule.configureProject("src/etc/testcases/types/mapper.xml");
+        buildRule.executeTarget("test1");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/PathTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/PathTest.java b/src/tests/junit/org/apache/tools/ant/types/PathTest.java
index 4580629..2ad1819 100644
--- a/src/tests/junit/org/apache/tools/ant/types/PathTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/PathTest.java
@@ -1,579 +1,579 @@
-/*
- *  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.types;
-
-import java.io.File;
-import java.util.Locale;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.condition.Os;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-/**
- * JUnit testcases for org.apache.tools.ant.types.Path
- *
- */
-
-public class PathTest {
-
-    public static boolean isUnixStyle = File.pathSeparatorChar == ':';
-    public static boolean isNetWare = Os.isFamily("netware");
-
-    private Project project;
-
-    @Before
-    public void setUp() {
-        project = new Project();
-        project.setBasedir(System.getProperty("root"));
-    }
-
-    // actually tests constructor as well as setPath
-    @Test
-    public void testConstructorUnixStyle() {
-        Path p = new Path(project, "/a:/b");
-        String[] l = p.list();
-        assertEquals("two items, Unix style", 2, l.length);
-        if (isUnixStyle) {
-            assertEquals("/a", l[0]);
-            assertEquals("/b", l[1]);
-        } else if (isNetWare) {
-            assertEquals("\\a", l[0]);
-            assertEquals("\\b", l[1]);
-        } else {
-            String base = new File(File.separator).getAbsolutePath();
-            assertEquals(base + "a", l[0]);
-            assertEquals(base + "b", l[1]);
-        }
-    }
-
-    @Test
-    public void testRelativePathUnixStyle() {
-        project.setBasedir(new File(System.getProperty("root"), "src/etc").getAbsolutePath());
-        Path p = new Path(project, "..:testcases");
-        String[] l = p.list();
-        assertEquals("two items, Unix style", 2, l.length);
-        if (isUnixStyle) {
-           assertTrue("test resolved relative to src/etc",
-                 l[0].endsWith("/src"));
-           assertTrue("test resolved relative to src/etc",
-                 l[1].endsWith("/src/etc/testcases"));
-        } else if (isNetWare) {
-           assertTrue("test resolved relative to src/etc",
-                 l[0].endsWith("\\src"));
-           assertTrue("test resolved relative to src/etc",
-                 l[1].endsWith("\\src\\etc\\testcases"));
-        } else {
-           assertTrue("test resolved relative to src/etc",
-                 l[0].endsWith("\\src"));
-           assertTrue("test resolved relative to src/etc",
-                 l[1].endsWith("\\src\\etc\\testcases"));
-        }
-    }
-
-    @Test
-    public void testConstructorWindowsStyle() {
-        Path p = new Path(project, "\\a;\\b");
-        String[] l = p.list();
-        assertEquals("two items, DOS style", 2, l.length);
-        if (isUnixStyle) {
-            assertEquals("/a", l[0]);
-            assertEquals("/b", l[1]);
-        } else if (isNetWare) {
-            assertEquals("\\a", l[0]);
-            assertEquals("\\b", l[1]);
-        } else {
-            String base = new File(File.separator).getAbsolutePath();
-            assertEquals(base + "a", l[0]);
-            assertEquals(base + "b", l[1]);
-        }
-
-        p = new Path(project, "c:\\test");
-        l = p.list();
-        if (isUnixStyle) {
-            assertEquals("no drives on Unix", 2, l.length);
-            assertTrue("c resolved relative to project\'s basedir",
-                   l[0].endsWith("/c"));
-            assertEquals("/test", l[1]);
-        } else if (isNetWare) {
-            assertEquals("volumes on NetWare", 1, l.length);
-            assertEquals("c:\\test", l[0].toLowerCase(Locale.US));
-        } else {
-            assertEquals("drives on DOS", 1, l.length);
-            assertEquals("c:\\test", l[0].toLowerCase(Locale.US));
-        }
-
-        p = new Path(project, "c:\\test;d:\\programs");
-        l = p.list();
-        if (isUnixStyle) {
-            assertEquals("no drives on Unix", 4, l.length);
-            assertTrue("c resolved relative to project\'s basedir",
-                   l[0].endsWith("/c"));
-            assertEquals("/test", l[1]);
-            assertTrue("d resolved relative to project\'s basedir",
-                   l[2].endsWith("/d"));
-            assertEquals("/programs", l[3]);
-        } else if (isNetWare) {
-            assertEquals("volumes on NetWare", 2, l.length);
-            assertEquals("c:\\test", l[0].toLowerCase(Locale.US));
-            assertEquals("d:\\programs", l[1].toLowerCase(Locale.US));
-        } else {
-            assertEquals("drives on DOS", 2, l.length);
-            assertEquals("c:\\test", l[0].toLowerCase(Locale.US));
-            assertEquals("d:\\programs", l[1].toLowerCase(Locale.US));
-        }
-
-        p = new Path(project, "c:/test");
-        l = p.list();
-        if (isUnixStyle) {
-            assertEquals("no drives on Unix", 2, l.length);
-            assertTrue("c resolved relative to project\'s basedir",
-                   l[0].endsWith("/c"));
-            assertEquals("/test", l[1]);
-        } else if (isNetWare) {
-            assertEquals("volumes on NetWare", 1, l.length);
-            assertEquals("c:\\test", l[0].toLowerCase(Locale.US));
-        } else {
-            assertEquals("drives on DOS", 1, l.length);
-            assertEquals("c:\\test", l[0].toLowerCase(Locale.US));
-        }
-
-        p = new Path(project, "c:/test;d:/programs");
-        l = p.list();
-        if (isUnixStyle) {
-            assertEquals("no drives on Unix", 4, l.length);
-            assertTrue("c resolved relative to project\'s basedir",
-                   l[0].endsWith("/c"));
-            assertEquals("/test", l[1]);
-            assertTrue("d resolved relative to project\'s basedir",
-                   l[2].endsWith("/d"));
-            assertEquals("/programs", l[3]);
-        } else if (isNetWare) {
-            assertEquals("volumes on NetWare", 2, l.length);
-            assertEquals("c:\\test", l[0].toLowerCase(Locale.US));
-            assertEquals("d:\\programs", l[1].toLowerCase(Locale.US));
-        } else {
-            assertEquals("drives on DOS", 2, l.length);
-            assertEquals("c:\\test", l[0].toLowerCase(Locale.US));
-            assertEquals("d:\\programs", l[1].toLowerCase(Locale.US));
-        }
-    }
-
-    @Test
-    public void testConstructorNetWareStyle() {
-        // try a netware-volume length path, see how it is handled
-        Path p = new Path(project, "sys:\\test");
-        String[] l = p.list();
-        if (isUnixStyle) {
-            assertEquals("no drives on Unix", 2, l.length);
-            assertTrue("sys resolved relative to project\'s basedir",
-                   l[0].endsWith("/sys"));
-            assertEquals("/test", l[1]);
-        } else if (isNetWare) {
-            assertEquals("sys:\\test", l[0].toLowerCase(Locale.US));
-            assertEquals("volumes on NetWare", 1, l.length);
-        } else {
-            assertEquals("no multiple character-length volumes on Windows", 2, l.length);
-            assertTrue("sys resolved relative to project\'s basedir",
-                   l[0].endsWith("\\sys"));
-            assertTrue("test resolved relative to project\'s basedir",
-                   l[1].endsWith("\\test"));
-        }
-
-        // try a multi-part netware-volume length path, see how it is handled
-        p = new Path(project, "sys:\\test;dev:\\temp");
-        l = p.list();
-        if (isUnixStyle) {
-            assertEquals("no drives on Unix", 4, l.length);
-            assertTrue("sys resolved relative to project\'s basedir",
-                   l[0].endsWith("/sys"));
-            assertEquals("/test", l[1]);
-            assertTrue("dev resolved relative to project\'s basedir",
-                   l[2].endsWith("/dev"));
-            assertEquals("/temp", l[3]);
-        } else if (isNetWare) {
-            assertEquals("volumes on NetWare", 2, l.length);
-            assertEquals("sys:\\test", l[0].toLowerCase(Locale.US));
-            assertEquals("dev:\\temp", l[1].toLowerCase(Locale.US));
-        } else {
-            assertEquals("no multiple character-length volumes on Windows", 4, l.length);
-            assertTrue("sys resolved relative to project\'s basedir",
-                   l[0].endsWith("\\sys"));
-            assertTrue("test resolved relative to project\'s basedir",
-                   l[1].endsWith("\\test"));
-            assertTrue("dev resolved relative to project\'s basedir",
-                   l[2].endsWith("\\dev"));
-            assertTrue("temp resolved relative to project\'s basedir",
-                   l[3].endsWith("\\temp"));
-        }
-
-        // try a netware-volume length path w/forward slash, see how it is handled
-        p = new Path(project, "sys:/test");
-        l = p.list();
-        if (isUnixStyle) {
-            assertEquals("no drives on Unix", 2, l.length);
-            assertTrue("sys resolved relative to project\'s basedir",
-                   l[0].endsWith("/sys"));
-            assertEquals("/test", l[1]);
-        } else if (isNetWare) {
-            assertEquals("volumes on NetWare", 1, l.length);
-            assertEquals("sys:\\test", l[0].toLowerCase(Locale.US));
-        } else {
-            assertEquals("no multiple character-length volumes on Windows", 2, l.length);
-            assertTrue("sys resolved relative to project\'s basedir",
-                   l[0].endsWith("\\sys"));
-            assertTrue("test resolved relative to project\'s basedir",
-                   l[1].endsWith("\\test"));
-        }
-
-        // try a multi-part netware-volume length path w/forward slash, see how it is handled
-        p = new Path(project, "sys:/test;dev:/temp");
-        l = p.list();
-        if (isUnixStyle) {
-            assertEquals("no drives on Unix", 4, l.length);
-            assertTrue("sys resolved relative to project\'s basedir",
-                   l[0].endsWith("/sys"));
-            assertEquals("/test", l[1]);
-            assertTrue("dev resolved relative to project\'s basedir",
-                   l[2].endsWith("/dev"));
-            assertEquals("/temp", l[3]);
-        } else if (isNetWare) {
-            assertEquals("volumes on NetWare", 2, l.length);
-            assertEquals("sys:\\test", l[0].toLowerCase(Locale.US));
-            assertEquals("dev:\\temp", l[1].toLowerCase(Locale.US));
-        } else {
-            assertEquals("no multiple character-length volumes on Windows", 4, l.length);
-            assertTrue("sys resolved relative to project\'s basedir",
-                   l[0].endsWith("\\sys"));
-            assertTrue("test resolved relative to project\'s basedir",
-                   l[1].endsWith("\\test"));
-            assertTrue("dev resolved relative to project\'s basedir",
-                   l[2].endsWith("\\dev"));
-            assertTrue("temp resolved relative to project\'s basedir",
-                   l[3].endsWith("\\temp"));
-         }
-
-        // try a multi-part netware-volume length path with UNIX
-        // separator (this testcase if from an actual bug that was
-        // found, in AvailableTest, which uses PathTokenizer)
-        p = new Path(project,
-                     "SYS:\\JAVA/lib/rt.jar:SYS:\\JAVA/lib/classes.zip");
-        l = p.list();
-        if (isUnixStyle) {
-            assertEquals("no drives on Unix", 3, l.length);
-            assertTrue("sys resolved relative to project\'s basedir",
-                   l[0].endsWith("/SYS"));
-            assertEquals("/JAVA/lib/rt.jar", l[1]);
-            assertEquals("/JAVA/lib/classes.zip", l[2]);
-        } else if (isNetWare) {
-            assertEquals("volumes on NetWare", 2, l.length);
-            assertEquals("sys:\\java\\lib\\rt.jar", l[0].toLowerCase(Locale.US));
-            assertEquals("sys:\\java\\lib\\classes.zip", l[1].toLowerCase(Locale.US));
-        } else {
-            assertEquals("no multiple character-length volumes on Windows", 3, l.length);
-            assertTrue("sys resolved relative to project\'s basedir",
-                   l[0].endsWith("\\SYS"));
-            assertTrue("java/lib/rt.jar resolved relative to project\'s basedir",
-                   l[1].endsWith("\\JAVA\\lib\\rt.jar"));
-            assertTrue("java/lib/classes.zip resolved relative to project\'s basedir",
-                   l[2].endsWith("\\JAVA\\lib\\classes.zip"));
-        }
-    }
-
-    @Test
-    public void testConstructorMixedStyle() {
-        Path p = new Path(project, "\\a;\\b:/c");
-        String[] l = p.list();
-        assertEquals("three items, mixed style", 3, l.length);
-        if (isUnixStyle) {
-            assertEquals("/a", l[0]);
-            assertEquals("/b", l[1]);
-            assertEquals("/c", l[2]);
-        } else if (isNetWare) {
-            assertEquals("\\a", l[0]);
-            assertEquals("\\b", l[1]);
-            assertEquals("\\c", l[2]);
-        } else {
-            String base = new File(File.separator).getAbsolutePath();
-            assertEquals(base + "a", l[0]);
-            assertEquals(base + "b", l[1]);
-            assertEquals(base + "c", l[2]);
-        }
-    }
-
-    @Test
-    public void testSetLocation() {
-        Path p = new Path(project);
-        p.setLocation(new File(File.separatorChar+"a"));
-        String[] l = p.list();
-        if (isUnixStyle) {
-            assertEquals(1, l.length);
-            assertEquals("/a", l[0]);
-        } else if (isNetWare) {
-            assertEquals(1, l.length);
-            assertEquals("\\a", l[0]);
-        } else {
-            assertEquals(1, l.length);
-            assertEquals(":\\a", l[0].substring(1));
-        }
-    }
-
-    @Test
-    public void testAppending() {
-        Path p = new Path(project, "/a:/b");
-        String[] l = p.list();
-        assertEquals("2 after construction", 2, l.length);
-        p.setLocation(new File("/c"));
-        l = p.list();
-        assertEquals("3 after setLocation", 3, l.length);
-        p.setPath("\\d;\\e");
-        l = p.list();
-        assertEquals("5 after setPath", 5, l.length);
-        p.append(new Path(project, "\\f"));
-        l = p.list();
-        assertEquals("6 after append", 6, l.length);
-        p.createPath().setLocation(new File("/g"));
-        l = p.list();
-        assertEquals("7 after append", 7, l.length);
-    }
-
-    @Test
-    public void testEmpyPath() {
-        Path p = new Path(project, "");
-        String[] l = p.list();
-        assertEquals("0 after construction", 0, l.length);
-        p.setPath("");
-        l = p.list();
-        assertEquals("0 after setPath", 0, l.length);
-        p.append(new Path(project));
-        l = p.list();
-        assertEquals("0 after append", 0, l.length);
-        p.createPath();
-        l = p.list();
-        assertEquals("0 after append", 0, l.length);
-    }
-
-    @Test
-    public void testUnique() {
-        Path p = new Path(project, "/a:/a");
-        String[] l = p.list();
-        assertEquals("1 after construction", 1, l.length);
-        String base = new File(File.separator).getAbsolutePath();
-        p.setLocation(new File(base, "a"));
-        l = p.list();
-        assertEquals("1 after setLocation", 1, l.length);
-        p.setPath("\\a;/a");
-        l = p.list();
-        assertEquals("1 after setPath", 1, l.length);
-        p.append(new Path(project, "/a;\\a:\\a"));
-        l = p.list();
-        assertEquals("1 after append", 1, l.length);
-        p.createPath().setPath("\\a:/a");
-        l = p.list();
-        assertEquals("1 after append", 1, l.length);
-    }
-
-    @Test
-    public void testEmptyElementIfIsReference() {
-        Path p = new Path(project, "/a:/a");
-        try {
-            p.setRefid(new Reference(project, "dummyref"));
-            fail("Can add reference to Path with elements from constructor");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute when using refid",
-                         be.getMessage());
-        }
-
-        p = new Path(project);
-        p.setLocation(new File("/a"));
-        try {
-            p.setRefid(new Reference(project, "dummyref"));
-            fail("Can add reference to Path with elements from setLocation");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute when using refid",
-                         be.getMessage());
-        }
-
-        Path another = new Path(project, "/a:/a");
-        project.addReference("dummyref", another);
-        p = new Path(project);
-        p.setRefid(new Reference(project, "dummyref"));
-        try {
-            p.setLocation(new File("/a"));
-            fail("Can set location in Path that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute when using refid",
-                         be.getMessage());
-        }
-
-        try {
-            p.setPath("/a;\\a");
-            fail("Can set path in Path that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute when using refid",
-                         be.getMessage());
-        }
-
-        try {
-            p.createPath();
-            fail("Can create nested Path in Path that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify nested elements when using refid",
-                         be.getMessage());
-        }
-
-        try {
-            p.createPathElement();
-            fail("Can create nested PathElement in Path that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify nested elements when using refid",
-                         be.getMessage());
-        }
-
-        try {
-            p.addFileset(new FileSet());
-            fail("Can add nested FileSet in Path that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify nested elements when using refid",
-                         be.getMessage());
-        }
-
-        try {
-            p.addFilelist(new FileList());
-            fail("Can add nested FileList in Path that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify nested elements when using refid",
-                         be.getMessage());
-        }
-
-        try {
-            p.addDirset(new DirSet());
-            fail("Can add nested Dirset in Path that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify nested elements when using refid",
-                         be.getMessage());
-        }
-    }
-
-    @Test
-    public void testCircularReferenceCheck() {
-        Path p = new Path(project);
-        project.addReference("dummy", p);
-        p.setRefid(new Reference(project, "dummy"));
-        try {
-            p.list();
-            fail("Can make Path a Reference to itself.");
-        } catch (BuildException be) {
-            assertEquals("This data type contains a circular reference.",
-                         be.getMessage());
-        }
-
-        // dummy1 --> dummy2 --> dummy3 --> dummy1
-        Path p1 = new Path(project);
-        project.addReference("dummy1", p1);
-        Path p2 = p1.createPath();
-        project.addReference("dummy2", p2);
-        Path p3 = p2.createPath();
-        project.addReference("dummy3", p3);
-        p3.setRefid(new Reference(project, "dummy1"));
-        try {
-            p1.list();
-            fail("Can make circular reference.");
-        } catch (BuildException be) {
-            assertEquals("This data type contains a circular reference.",
-                         be.getMessage());
-        }
-
-        // dummy1 --> dummy2 --> dummy3 (with Path "/a")
-        p1 = new Path(project);
-        project.addReference("dummy1", p1);
-        p2 = p1.createPath();
-        project.addReference("dummy2", p2);
-        p3 = p2.createPath();
-        project.addReference("dummy3", p3);
-        p3.setLocation(new File("/a"));
-        String[] l = p1.list();
-        assertEquals("One element buried deep inside a nested path structure",
-                     1, l.length);
-        if (isUnixStyle) {
-            assertEquals("/a", l[0]);
-        } else if (isNetWare) {
-            assertEquals("\\a", l[0]);
-        } else {
-            assertEquals(":\\a", l[0].substring(1));
-        }
-    }
-
-    @Test
-    public void testFileList() {
-        Path p = new Path(project);
-        FileList f = new FileList();
-        f.setProject(project);
-        f.setDir(project.resolveFile("."));
-        f.setFiles("build.xml");
-        p.addFilelist(f);
-        String[] l = p.list();
-        assertEquals(1, l.length);
-        assertEquals(project.resolveFile("build.xml").getAbsolutePath(), l[0]);
-    }
-
-    @Test
-    public void testFileSet() {
-        Path p = new Path(project);
-        FileSet f = new FileSet();
-        f.setProject(project);
-        f.setDir(project.resolveFile("."));
-        f.setIncludes("build.xml");
-        p.addFileset(f);
-        String[] l = p.list();
-        assertEquals(1, l.length);
-        assertEquals(project.resolveFile("build.xml").getAbsolutePath(), l[0]);
-    }
-
-    @Test
-    public void testDirSet() {
-        Path p = new Path(project);
-        DirSet d = new DirSet();
-        d.setProject(project);
-        d.setDir(project.resolveFile("."));
-        d.setIncludes("build");
-        p.addDirset(d);
-        String[] l = p.list();
-        assertEquals(1, l.length);
-        assertEquals(project.resolveFile("build").getAbsolutePath(), l[0]);
-    }
-
-    @Test
-    public void testRecursion() {
-        Path p = new Path(project);
-        try {
-            p.append(p);
-            assertEquals(0, p.list().length);
-        } catch (BuildException x) {
-            String m = x.toString();
-            assertTrue(m, m.indexOf("circular") != -1);
-        }
-    }
-
-}
+/*
+ *  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.types;
+
+import java.io.File;
+import java.util.Locale;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.condition.Os;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * JUnit testcases for org.apache.tools.ant.types.Path
+ *
+ */
+
+public class PathTest {
+
+    public static boolean isUnixStyle = File.pathSeparatorChar == ':';
+    public static boolean isNetWare = Os.isFamily("netware");
+
+    private Project project;
+
+    @Before
+    public void setUp() {
+        project = new Project();
+        project.setBasedir(System.getProperty("root"));
+    }
+
+    // actually tests constructor as well as setPath
+    @Test
+    public void testConstructorUnixStyle() {
+        Path p = new Path(project, "/a:/b");
+        String[] l = p.list();
+        assertEquals("two items, Unix style", 2, l.length);
+        if (isUnixStyle) {
+            assertEquals("/a", l[0]);
+            assertEquals("/b", l[1]);
+        } else if (isNetWare) {
+            assertEquals("\\a", l[0]);
+            assertEquals("\\b", l[1]);
+        } else {
+            String base = new File(File.separator).getAbsolutePath();
+            assertEquals(base + "a", l[0]);
+            assertEquals(base + "b", l[1]);
+        }
+    }
+
+    @Test
+    public void testRelativePathUnixStyle() {
+        project.setBasedir(new File(System.getProperty("root"), "src/etc").getAbsolutePath());
+        Path p = new Path(project, "..:testcases");
+        String[] l = p.list();
+        assertEquals("two items, Unix style", 2, l.length);
+        if (isUnixStyle) {
+           assertTrue("test resolved relative to src/etc",
+                 l[0].endsWith("/src"));
+           assertTrue("test resolved relative to src/etc",
+                 l[1].endsWith("/src/etc/testcases"));
+        } else if (isNetWare) {
+           assertTrue("test resolved relative to src/etc",
+                 l[0].endsWith("\\src"));
+           assertTrue("test resolved relative to src/etc",
+                 l[1].endsWith("\\src\\etc\\testcases"));
+        } else {
+           assertTrue("test resolved relative to src/etc",
+                 l[0].endsWith("\\src"));
+           assertTrue("test resolved relative to src/etc",
+                 l[1].endsWith("\\src\\etc\\testcases"));
+        }
+    }
+
+    @Test
+    public void testConstructorWindowsStyle() {
+        Path p = new Path(project, "\\a;\\b");
+        String[] l = p.list();
+        assertEquals("two items, DOS style", 2, l.length);
+        if (isUnixStyle) {
+            assertEquals("/a", l[0]);
+            assertEquals("/b", l[1]);
+        } else if (isNetWare) {
+            assertEquals("\\a", l[0]);
+            assertEquals("\\b", l[1]);
+        } else {
+            String base = new File(File.separator).getAbsolutePath();
+            assertEquals(base + "a", l[0]);
+            assertEquals(base + "b", l[1]);
+        }
+
+        p = new Path(project, "c:\\test");
+        l = p.list();
+        if (isUnixStyle) {
+            assertEquals("no drives on Unix", 2, l.length);
+            assertTrue("c resolved relative to project\'s basedir",
+                   l[0].endsWith("/c"));
+            assertEquals("/test", l[1]);
+        } else if (isNetWare) {
+            assertEquals("volumes on NetWare", 1, l.length);
+            assertEquals("c:\\test", l[0].toLowerCase(Locale.US));
+        } else {
+            assertEquals("drives on DOS", 1, l.length);
+            assertEquals("c:\\test", l[0].toLowerCase(Locale.US));
+        }
+
+        p = new Path(project, "c:\\test;d:\\programs");
+        l = p.list();
+        if (isUnixStyle) {
+            assertEquals("no drives on Unix", 4, l.length);
+            assertTrue("c resolved relative to project\'s basedir",
+                   l[0].endsWith("/c"));
+            assertEquals("/test", l[1]);
+            assertTrue("d resolved relative to project\'s basedir",
+                   l[2].endsWith("/d"));
+            assertEquals("/programs", l[3]);
+        } else if (isNetWare) {
+            assertEquals("volumes on NetWare", 2, l.length);
+            assertEquals("c:\\test", l[0].toLowerCase(Locale.US));
+            assertEquals("d:\\programs", l[1].toLowerCase(Locale.US));
+        } else {
+            assertEquals("drives on DOS", 2, l.length);
+            assertEquals("c:\\test", l[0].toLowerCase(Locale.US));
+            assertEquals("d:\\programs", l[1].toLowerCase(Locale.US));
+        }
+
+        p = new Path(project, "c:/test");
+        l = p.list();
+        if (isUnixStyle) {
+            assertEquals("no drives on Unix", 2, l.length);
+            assertTrue("c resolved relative to project\'s basedir",
+                   l[0].endsWith("/c"));
+            assertEquals("/test", l[1]);
+        } else if (isNetWare) {
+            assertEquals("volumes on NetWare", 1, l.length);
+            assertEquals("c:\\test", l[0].toLowerCase(Locale.US));
+        } else {
+            assertEquals("drives on DOS", 1, l.length);
+            assertEquals("c:\\test", l[0].toLowerCase(Locale.US));
+        }
+
+        p = new Path(project, "c:/test;d:/programs");
+        l = p.list();
+        if (isUnixStyle) {
+            assertEquals("no drives on Unix", 4, l.length);
+            assertTrue("c resolved relative to project\'s basedir",
+                   l[0].endsWith("/c"));
+            assertEquals("/test", l[1]);
+            assertTrue("d resolved relative to project\'s basedir",
+                   l[2].endsWith("/d"));
+            assertEquals("/programs", l[3]);
+        } else if (isNetWare) {
+            assertEquals("volumes on NetWare", 2, l.length);
+            assertEquals("c:\\test", l[0].toLowerCase(Locale.US));
+            assertEquals("d:\\programs", l[1].toLowerCase(Locale.US));
+        } else {
+            assertEquals("drives on DOS", 2, l.length);
+            assertEquals("c:\\test", l[0].toLowerCase(Locale.US));
+            assertEquals("d:\\programs", l[1].toLowerCase(Locale.US));
+        }
+    }
+
+    @Test
+    public void testConstructorNetWareStyle() {
+        // try a netware-volume length path, see how it is handled
+        Path p = new Path(project, "sys:\\test");
+        String[] l = p.list();
+        if (isUnixStyle) {
+            assertEquals("no drives on Unix", 2, l.length);
+            assertTrue("sys resolved relative to project\'s basedir",
+                   l[0].endsWith("/sys"));
+            assertEquals("/test", l[1]);
+        } else if (isNetWare) {
+            assertEquals("sys:\\test", l[0].toLowerCase(Locale.US));
+            assertEquals("volumes on NetWare", 1, l.length);
+        } else {
+            assertEquals("no multiple character-length volumes on Windows", 2, l.length);
+            assertTrue("sys resolved relative to project\'s basedir",
+                   l[0].endsWith("\\sys"));
+            assertTrue("test resolved relative to project\'s basedir",
+                   l[1].endsWith("\\test"));
+        }
+
+        // try a multi-part netware-volume length path, see how it is handled
+        p = new Path(project, "sys:\\test;dev:\\temp");
+        l = p.list();
+        if (isUnixStyle) {
+            assertEquals("no drives on Unix", 4, l.length);
+            assertTrue("sys resolved relative to project\'s basedir",
+                   l[0].endsWith("/sys"));
+            assertEquals("/test", l[1]);
+            assertTrue("dev resolved relative to project\'s basedir",
+                   l[2].endsWith("/dev"));
+            assertEquals("/temp", l[3]);
+        } else if (isNetWare) {
+            assertEquals("volumes on NetWare", 2, l.length);
+            assertEquals("sys:\\test", l[0].toLowerCase(Locale.US));
+            assertEquals("dev:\\temp", l[1].toLowerCase(Locale.US));
+        } else {
+            assertEquals("no multiple character-length volumes on Windows", 4, l.length);
+            assertTrue("sys resolved relative to project\'s basedir",
+                   l[0].endsWith("\\sys"));
+            assertTrue("test resolved relative to project\'s basedir",
+                   l[1].endsWith("\\test"));
+            assertTrue("dev resolved relative to project\'s basedir",
+                   l[2].endsWith("\\dev"));
+            assertTrue("temp resolved relative to project\'s basedir",
+                   l[3].endsWith("\\temp"));
+        }
+
+        // try a netware-volume length path w/forward slash, see how it is handled
+        p = new Path(project, "sys:/test");
+        l = p.list();
+        if (isUnixStyle) {
+            assertEquals("no drives on Unix", 2, l.length);
+            assertTrue("sys resolved relative to project\'s basedir",
+                   l[0].endsWith("/sys"));
+            assertEquals("/test", l[1]);
+        } else if (isNetWare) {
+            assertEquals("volumes on NetWare", 1, l.length);
+            assertEquals("sys:\\test", l[0].toLowerCase(Locale.US));
+        } else {
+            assertEquals("no multiple character-length volumes on Windows", 2, l.length);
+            assertTrue("sys resolved relative to project\'s basedir",
+                   l[0].endsWith("\\sys"));
+            assertTrue("test resolved relative to project\'s basedir",
+                   l[1].endsWith("\\test"));
+        }
+
+        // try a multi-part netware-volume length path w/forward slash, see how it is handled
+        p = new Path(project, "sys:/test;dev:/temp");
+        l = p.list();
+        if (isUnixStyle) {
+            assertEquals("no drives on Unix", 4, l.length);
+            assertTrue("sys resolved relative to project\'s basedir",
+                   l[0].endsWith("/sys"));
+            assertEquals("/test", l[1]);
+            assertTrue("dev resolved relative to project\'s basedir",
+                   l[2].endsWith("/dev"));
+            assertEquals("/temp", l[3]);
+        } else if (isNetWare) {
+            assertEquals("volumes on NetWare", 2, l.length);
+            assertEquals("sys:\\test", l[0].toLowerCase(Locale.US));
+            assertEquals("dev:\\temp", l[1].toLowerCase(Locale.US));
+        } else {
+            assertEquals("no multiple character-length volumes on Windows", 4, l.length);
+            assertTrue("sys resolved relative to project\'s basedir",
+                   l[0].endsWith("\\sys"));
+            assertTrue("test resolved relative to project\'s basedir",
+                   l[1].endsWith("\\test"));
+            assertTrue("dev resolved relative to project\'s basedir",
+                   l[2].endsWith("\\dev"));
+            assertTrue("temp resolved relative to project\'s basedir",
+                   l[3].endsWith("\\temp"));
+         }
+
+        // try a multi-part netware-volume length path with UNIX
+        // separator (this testcase if from an actual bug that was
+        // found, in AvailableTest, which uses PathTokenizer)
+        p = new Path(project,
+                     "SYS:\\JAVA/lib/rt.jar:SYS:\\JAVA/lib/classes.zip");
+        l = p.list();
+        if (isUnixStyle) {
+            assertEquals("no drives on Unix", 3, l.length);
+            assertTrue("sys resolved relative to project\'s basedir",
+                   l[0].endsWith("/SYS"));
+            assertEquals("/JAVA/lib/rt.jar", l[1]);
+            assertEquals("/JAVA/lib/classes.zip", l[2]);
+        } else if (isNetWare) {
+            assertEquals("volumes on NetWare", 2, l.length);
+            assertEquals("sys:\\java\\lib\\rt.jar", l[0].toLowerCase(Locale.US));
+            assertEquals("sys:\\java\\lib\\classes.zip", l[1].toLowerCase(Locale.US));
+        } else {
+            assertEquals("no multiple character-length volumes on Windows", 3, l.length);
+            assertTrue("sys resolved relative to project\'s basedir",
+                   l[0].endsWith("\\SYS"));
+            assertTrue("java/lib/rt.jar resolved relative to project\'s basedir",
+                   l[1].endsWith("\\JAVA\\lib\\rt.jar"));
+            assertTrue("java/lib/classes.zip resolved relative to project\'s basedir",
+                   l[2].endsWith("\\JAVA\\lib\\classes.zip"));
+        }
+    }
+
+    @Test
+    public void testConstructorMixedStyle() {
+        Path p = new Path(project, "\\a;\\b:/c");
+        String[] l = p.list();
+        assertEquals("three items, mixed style", 3, l.length);
+        if (isUnixStyle) {
+            assertEquals("/a", l[0]);
+            assertEquals("/b", l[1]);
+            assertEquals("/c", l[2]);
+        } else if (isNetWare) {
+            assertEquals("\\a", l[0]);
+            assertEquals("\\b", l[1]);
+            assertEquals("\\c", l[2]);
+        } else {
+            String base = new File(File.separator).getAbsolutePath();
+            assertEquals(base + "a", l[0]);
+            assertEquals(base + "b", l[1]);
+            assertEquals(base + "c", l[2]);
+        }
+    }
+
+    @Test
+    public void testSetLocation() {
+        Path p = new Path(project);
+        p.setLocation(new File(File.separatorChar+"a"));
+        String[] l = p.list();
+        if (isUnixStyle) {
+            assertEquals(1, l.length);
+            assertEquals("/a", l[0]);
+        } else if (isNetWare) {
+            assertEquals(1, l.length);
+            assertEquals("\\a", l[0]);
+        } else {
+            assertEquals(1, l.length);
+            assertEquals(":\\a", l[0].substring(1));
+        }
+    }
+
+    @Test
+    public void testAppending() {
+        Path p = new Path(project, "/a:/b");
+        String[] l = p.list();
+        assertEquals("2 after construction", 2, l.length);
+        p.setLocation(new File("/c"));
+        l = p.list();
+        assertEquals("3 after setLocation", 3, l.length);
+        p.setPath("\\d;\\e");
+        l = p.list();
+        assertEquals("5 after setPath", 5, l.length);
+        p.append(new Path(project, "\\f"));
+        l = p.list();
+        assertEquals("6 after append", 6, l.length);
+        p.createPath().setLocation(new File("/g"));
+        l = p.list();
+        assertEquals("7 after append", 7, l.length);
+    }
+
+    @Test
+    public void testEmpyPath() {
+        Path p = new Path(project, "");
+        String[] l = p.list();
+        assertEquals("0 after construction", 0, l.length);
+        p.setPath("");
+        l = p.list();
+        assertEquals("0 after setPath", 0, l.length);
+        p.append(new Path(project));
+        l = p.list();
+        assertEquals("0 after append", 0, l.length);
+        p.createPath();
+        l = p.list();
+        assertEquals("0 after append", 0, l.length);
+    }
+
+    @Test
+    public void testUnique() {
+        Path p = new Path(project, "/a:/a");
+        String[] l = p.list();
+        assertEquals("1 after construction", 1, l.length);
+        String base = new File(File.separator).getAbsolutePath();
+        p.setLocation(new File(base, "a"));
+        l = p.list();
+        assertEquals("1 after setLocation", 1, l.length);
+        p.setPath("\\a;/a");
+        l = p.list();
+        assertEquals("1 after setPath", 1, l.length);
+        p.append(new Path(project, "/a;\\a:\\a"));
+        l = p.list();
+        assertEquals("1 after append", 1, l.length);
+        p.createPath().setPath("\\a:/a");
+        l = p.list();
+        assertEquals("1 after append", 1, l.length);
+    }
+
+    @Test
+    public void testEmptyElementIfIsReference() {
+        Path p = new Path(project, "/a:/a");
+        try {
+            p.setRefid(new Reference(project, "dummyref"));
+            fail("Can add reference to Path with elements from constructor");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute when using refid",
+                         be.getMessage());
+        }
+
+        p = new Path(project);
+        p.setLocation(new File("/a"));
+        try {
+            p.setRefid(new Reference(project, "dummyref"));
+            fail("Can add reference to Path with elements from setLocation");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute when using refid",
+                         be.getMessage());
+        }
+
+        Path another = new Path(project, "/a:/a");
+        project.addReference("dummyref", another);
+        p = new Path(project);
+        p.setRefid(new Reference(project, "dummyref"));
+        try {
+            p.setLocation(new File("/a"));
+            fail("Can set location in Path that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute when using refid",
+                         be.getMessage());
+        }
+
+        try {
+            p.setPath("/a;\\a");
+            fail("Can set path in Path that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute when using refid",
+                         be.getMessage());
+        }
+
+        try {
+            p.createPath();
+            fail("Can create nested Path in Path that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify nested elements when using refid",
+                         be.getMessage());
+        }
+
+        try {
+            p.createPathElement();
+            fail("Can create nested PathElement in Path that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify nested elements when using refid",
+                         be.getMessage());
+        }
+
+        try {
+            p.addFileset(new FileSet());
+            fail("Can add nested FileSet in Path that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify nested elements when using refid",
+                         be.getMessage());
+        }
+
+        try {
+            p.addFilelist(new FileList());
+            fail("Can add nested FileList in Path that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify nested elements when using refid",
+                         be.getMessage());
+        }
+
+        try {
+            p.addDirset(new DirSet());
+            fail("Can add nested Dirset in Path that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify nested elements when using refid",
+                         be.getMessage());
+        }
+    }
+
+    @Test
+    public void testCircularReferenceCheck() {
+        Path p = new Path(project);
+        project.addReference("dummy", p);
+        p.setRefid(new Reference(project, "dummy"));
+        try {
+            p.list();
+            fail("Can make Path a Reference to itself.");
+        } catch (BuildException be) {
+            assertEquals("This data type contains a circular reference.",
+                         be.getMessage());
+        }
+
+        // dummy1 --> dummy2 --> dummy3 --> dummy1
+        Path p1 = new Path(project);
+        project.addReference("dummy1", p1);
+        Path p2 = p1.createPath();
+        project.addReference("dummy2", p2);
+        Path p3 = p2.createPath();
+        project.addReference("dummy3", p3);
+        p3.setRefid(new Reference(project, "dummy1"));
+        try {
+            p1.list();
+            fail("Can make circular reference.");
+        } catch (BuildException be) {
+            assertEquals("This data type contains a circular reference.",
+                         be.getMessage());
+        }
+
+        // dummy1 --> dummy2 --> dummy3 (with Path "/a")
+        p1 = new Path(project);
+        project.addReference("dummy1", p1);
+        p2 = p1.createPath();
+        project.addReference("dummy2", p2);
+        p3 = p2.createPath();
+        project.addReference("dummy3", p3);
+        p3.setLocation(new File("/a"));
+        String[] l = p1.list();
+        assertEquals("One element buried deep inside a nested path structure",
+                     1, l.length);
+        if (isUnixStyle) {
+            assertEquals("/a", l[0]);
+        } else if (isNetWare) {
+            assertEquals("\\a", l[0]);
+        } else {
+            assertEquals(":\\a", l[0].substring(1));
+        }
+    }
+
+    @Test
+    public void testFileList() {
+        Path p = new Path(project);
+        FileList f = new FileList();
+        f.setProject(project);
+        f.setDir(project.resolveFile("."));
+        f.setFiles("build.xml");
+        p.addFilelist(f);
+        String[] l = p.list();
+        assertEquals(1, l.length);
+        assertEquals(project.resolveFile("build.xml").getAbsolutePath(), l[0]);
+    }
+
+    @Test
+    public void testFileSet() {
+        Path p = new Path(project);
+        FileSet f = new FileSet();
+        f.setProject(project);
+        f.setDir(project.resolveFile("."));
+        f.setIncludes("build.xml");
+        p.addFileset(f);
+        String[] l = p.list();
+        assertEquals(1, l.length);
+        assertEquals(project.resolveFile("build.xml").getAbsolutePath(), l[0]);
+    }
+
+    @Test
+    public void testDirSet() {
+        Path p = new Path(project);
+        DirSet d = new DirSet();
+        d.setProject(project);
+        d.setDir(project.resolveFile("."));
+        d.setIncludes("build");
+        p.addDirset(d);
+        String[] l = p.list();
+        assertEquals(1, l.length);
+        assertEquals(project.resolveFile("build").getAbsolutePath(), l[0]);
+    }
+
+    @Test
+    public void testRecursion() {
+        Path p = new Path(project);
+        try {
+            p.append(p);
+            assertEquals(0, p.list().length);
+        } catch (BuildException x) {
+            String m = x.toString();
+            assertTrue(m, m.indexOf("circular") != -1);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/PatternSetTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/PatternSetTest.java b/src/tests/junit/org/apache/tools/ant/types/PatternSetTest.java
index c88b49a..065d757 100644
--- a/src/tests/junit/org/apache/tools/ant/types/PatternSetTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/PatternSetTest.java
@@ -1,206 +1,206 @@
-/*
- *  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.types;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.io.File;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-/**
- * JUnit 3 testcases for org.apache.tools.ant.types.PatternSet.
- *
- * <p>This doesn't actually test much, mainly reference handling.</p>
- *
- */
-
-public class PatternSetTest {
-
-    private Project project;
-
-    @Before
-    public void setUp() {
-        project = new Project();
-        project.setBasedir(".");
-    }
-
-    @Test
-    public void testEmptyElementIfIsReference() {
-        PatternSet p = new PatternSet();
-        p.setIncludes("**/*.java");
-        try {
-            p.setRefid(new Reference(project, "dummyref"));
-            fail("Can add reference to PatternSet with elements from setIncludes");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute when using refid",
-                         be.getMessage());
-        }
-
-        p = new PatternSet();
-        p.setRefid(new Reference(project, "dummyref"));
-        try {
-            p.setIncludes("**/*.java");
-            fail("Can set includes in PatternSet that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute when using refid",
-                         be.getMessage());
-        }
-
-        p = new PatternSet();
-        p.setRefid(new Reference(project, "dummyref"));
-        try {
-            p.setIncludesfile(new File("/a"));
-            fail("Can set includesfile in PatternSet that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute when using refid",
-                         be.getMessage());
-        }
-        try {
-            p.setExcludes("**/*.java");
-            fail("Can set excludes in PatternSet that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute when using refid",
-                         be.getMessage());
-        }
-        try {
-            p.setExcludesfile(new File("/a"));
-            fail("Can set excludesfile in PatternSet that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute when using refid",
-                         be.getMessage());
-        }
-        try {
-            p.createInclude();
-            fail("Can add nested include in PatternSet that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify nested elements when using refid",
-                         be.getMessage());
-        }
-        try {
-            p.createExclude();
-            fail("Can add nested exclude in PatternSet that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify nested elements when using refid",
-                         be.getMessage());
-        }
-        try {
-            p.createIncludesFile();
-            fail("Can add nested includesfile in PatternSet that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify nested elements when using refid",
-                         be.getMessage());
-        }
-        try {
-            p.createExcludesFile();
-            fail("Can add nested excludesfile in PatternSet that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify nested elements when using refid",
-                         be.getMessage());
-        }
-    }
-
-    @Test
-    public void testCircularReferenceCheck() {
-        PatternSet p = new PatternSet();
-        project.addReference("dummy", p);
-        p.setRefid(new Reference(project, "dummy"));
-        try {
-            p.getIncludePatterns(project);
-            fail("Can make PatternSet a Reference to itself.");
-        } catch (BuildException be) {
-            assertEquals("This data type contains a circular reference.",
-                         be.getMessage());
-        }
-        try {
-            p.getExcludePatterns(project);
-            fail("Can make PatternSet a Reference to itself.");
-        } catch (BuildException be) {
-            assertEquals("This data type contains a circular reference.",
-                         be.getMessage());
-        }
-
-        // dummy1 --> dummy2 --> dummy3 --> dummy1
-        PatternSet p1 = new PatternSet();
-        project.addReference("dummy1", p1);
-        p1.setRefid(new Reference(project, "dummy2"));
-        PatternSet p2 = new PatternSet();
-        project.addReference("dummy2", p2);
-        p2.setRefid(new Reference(project, "dummy3"));
-        PatternSet p3 = new PatternSet();
-        project.addReference("dummy3", p3);
-        p3.setRefid(new Reference(project, "dummy1"));
-        try {
-            p1.getIncludePatterns(project);
-            fail("Can make circular reference.");
-        } catch (BuildException be) {
-            assertEquals("This data type contains a circular reference.",
-                         be.getMessage());
-        }
-        try {
-            p1.getExcludePatterns(project);
-            fail("Can make circular reference.");
-        } catch (BuildException be) {
-            assertEquals("This data type contains a circular reference.",
-                         be.getMessage());
-        }
-
-        // dummy1 --> dummy2 --> dummy3
-        // (which holds patterns "include" and "exclude")
-        p1 = new PatternSet();
-        project.addReference("dummy1", p1);
-        p1.setRefid(new Reference(project, "dummy2"));
-        p2 = new PatternSet();
-        project.addReference("dummy2", p2);
-        p2.setRefid(new Reference(project, "dummy3"));
-        p3 = new PatternSet();
-        project.addReference("dummy3", p3);
-        p3.setIncludes("include");
-        p3.createExclude().setName("exclude");
-        String[] i = p1.getIncludePatterns(project);
-        assertEquals("One include pattern buried deep inside a nested patternset structure",
-                     1, i.length);
-        assertEquals("include", i[0]);
-        i = p3.getExcludePatterns(project);
-        assertEquals("One exclude pattern buried deep inside a nested patternset structure",
-                     1, i.length);
-        assertEquals("exclude", i[0]);
-    }
-
-    @Test
-    public void testNestedPatternset() {
-        PatternSet p = new PatternSet();
-        p.setIncludes("**/*.java");
-
-        PatternSet nested = new PatternSet();
-        nested.setExcludes("**/*.class");
-
-        p.addConfiguredPatternset(nested);
-
-        String[] excludes = p.getExcludePatterns(project);
-        String[] includes = p.getIncludePatterns(project);
-
-        assertEquals("Includes","**/*.java", includes[0]);
-        assertEquals("Excludes","**/*.class", excludes[0]);
-    }
-}
+/*
+ *  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.types;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.File;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * JUnit 3 testcases for org.apache.tools.ant.types.PatternSet.
+ *
+ * <p>This doesn't actually test much, mainly reference handling.</p>
+ *
+ */
+
+public class PatternSetTest {
+
+    private Project project;
+
+    @Before
+    public void setUp() {
+        project = new Project();
+        project.setBasedir(".");
+    }
+
+    @Test
+    public void testEmptyElementIfIsReference() {
+        PatternSet p = new PatternSet();
+        p.setIncludes("**/*.java");
+        try {
+            p.setRefid(new Reference(project, "dummyref"));
+            fail("Can add reference to PatternSet with elements from setIncludes");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute when using refid",
+                         be.getMessage());
+        }
+
+        p = new PatternSet();
+        p.setRefid(new Reference(project, "dummyref"));
+        try {
+            p.setIncludes("**/*.java");
+            fail("Can set includes in PatternSet that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute when using refid",
+                         be.getMessage());
+        }
+
+        p = new PatternSet();
+        p.setRefid(new Reference(project, "dummyref"));
+        try {
+            p.setIncludesfile(new File("/a"));
+            fail("Can set includesfile in PatternSet that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute when using refid",
+                         be.getMessage());
+        }
+        try {
+            p.setExcludes("**/*.java");
+            fail("Can set excludes in PatternSet that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute when using refid",
+                         be.getMessage());
+        }
+        try {
+            p.setExcludesfile(new File("/a"));
+            fail("Can set excludesfile in PatternSet that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute when using refid",
+                         be.getMessage());
+        }
+        try {
+            p.createInclude();
+            fail("Can add nested include in PatternSet that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify nested elements when using refid",
+                         be.getMessage());
+        }
+        try {
+            p.createExclude();
+            fail("Can add nested exclude in PatternSet that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify nested elements when using refid",
+                         be.getMessage());
+        }
+        try {
+            p.createIncludesFile();
+            fail("Can add nested includesfile in PatternSet that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify nested elements when using refid",
+                         be.getMessage());
+        }
+        try {
+            p.createExcludesFile();
+            fail("Can add nested excludesfile in PatternSet that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify nested elements when using refid",
+                         be.getMessage());
+        }
+    }
+
+    @Test
+    public void testCircularReferenceCheck() {
+        PatternSet p = new PatternSet();
+        project.addReference("dummy", p);
+        p.setRefid(new Reference(project, "dummy"));
+        try {
+            p.getIncludePatterns(project);
+            fail("Can make PatternSet a Reference to itself.");
+        } catch (BuildException be) {
+            assertEquals("This data type contains a circular reference.",
+                         be.getMessage());
+        }
+        try {
+            p.getExcludePatterns(project);
+            fail("Can make PatternSet a Reference to itself.");
+        } catch (BuildException be) {
+            assertEquals("This data type contains a circular reference.",
+                         be.getMessage());
+        }
+
+        // dummy1 --> dummy2 --> dummy3 --> dummy1
+        PatternSet p1 = new PatternSet();
+        project.addReference("dummy1", p1);
+        p1.setRefid(new Reference(project, "dummy2"));
+        PatternSet p2 = new PatternSet();
+        project.addReference("dummy2", p2);
+        p2.setRefid(new Reference(project, "dummy3"));
+        PatternSet p3 = new PatternSet();
+        project.addReference("dummy3", p3);
+        p3.setRefid(new Reference(project, "dummy1"));
+        try {
+            p1.getIncludePatterns(project);
+            fail("Can make circular reference.");
+        } catch (BuildException be) {
+            assertEquals("This data type contains a circular reference.",
+                         be.getMessage());
+        }
+        try {
+            p1.getExcludePatterns(project);
+            fail("Can make circular reference.");
+        } catch (BuildException be) {
+            assertEquals("This data type contains a circular reference.",
+                         be.getMessage());
+        }
+
+        // dummy1 --> dummy2 --> dummy3
+        // (which holds patterns "include" and "exclude")
+        p1 = new PatternSet();
+        project.addReference("dummy1", p1);
+        p1.setRefid(new Reference(project, "dummy2"));
+        p2 = new PatternSet();
+        project.addReference("dummy2", p2);
+        p2.setRefid(new Reference(project, "dummy3"));
+        p3 = new PatternSet();
+        project.addReference("dummy3", p3);
+        p3.setIncludes("include");
+        p3.createExclude().setName("exclude");
+        String[] i = p1.getIncludePatterns(project);
+        assertEquals("One include pattern buried deep inside a nested patternset structure",
+                     1, i.length);
+        assertEquals("include", i[0]);
+        i = p3.getExcludePatterns(project);
+        assertEquals("One exclude pattern buried deep inside a nested patternset structure",
+                     1, i.length);
+        assertEquals("exclude", i[0]);
+    }
+
+    @Test
+    public void testNestedPatternset() {
+        PatternSet p = new PatternSet();
+        p.setIncludes("**/*.java");
+
+        PatternSet nested = new PatternSet();
+        nested.setExcludes("**/*.class");
+
+        p.addConfiguredPatternset(nested);
+
+        String[] excludes = p.getExcludePatterns(project);
+        String[] includes = p.getIncludePatterns(project);
+
+        assertEquals("Includes","**/*.java", includes[0]);
+        assertEquals("Excludes","**/*.class", excludes[0]);
+    }
+}


[05/21] ant git commit: Normalise tabulation and line breaks

Posted by gi...@apache.org.
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java b/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java
index b6c3f96..89cd3da 100644
--- a/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java
@@ -1,316 +1,316 @@
-/*
- *  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.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStreamReader;
-import java.io.IOException;
-import java.util.Properties;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-public class LayoutPreservingPropertiesTest {
-
-    /**
-     * Tests that a properties file read by the
-     * LayoutPreservingPropertiesFile and then saves the properties in
-     * it.
-     */
-    @Test
-    public void testPreserve() throws Exception {
-        File simple = new File(System.getProperty("root"),
-                               "src/etc/testcases/util/simple.properties");
-        FileInputStream fis = new FileInputStream(simple);
-        LayoutPreservingProperties lpf = new LayoutPreservingProperties();
-        lpf.load(fis);
-
-        File tmp = File.createTempFile("tmp", "props");
-        tmp.deleteOnExit();
-        lpf.saveAs(tmp);
-
-        // now compare original and tmp for property equivalence
-        Properties originalProps = new Properties();
-        originalProps.load(new FileInputStream(simple));
-
-        Properties tmpProps = new Properties();
-        tmpProps.load(new FileInputStream(tmp));
-
-        assertEquals("properties corrupted", originalProps, tmpProps);
-
-        // and now make sure that the comments made it into the new file
-        String s = readFile(tmp);
-        assertTrue("missing comment", s.indexOf("# a comment") > -1);
-        assertTrue("missing comment", s.indexOf("! more comment") > -1);
-    }
-
-    /**
-     * Tests that names and value are properly escaped when being
-     * written out.
-     */
-    @Test
-    public void testEscaping() throws Exception {
-        LayoutPreservingProperties lpf = new LayoutPreservingProperties();
-
-        lpf.setProperty(" prop one ", "  leading and trailing spaces ");
-        lpf.setProperty("prop\ttwo", "contains\ttab");
-        lpf.setProperty("prop\nthree", "contains\nnewline");
-        lpf.setProperty("prop\rfour", "contains\rcarraige return");
-        lpf.setProperty("prop\ffive", "contains\fform feed");
-        lpf.setProperty("prop\\six", "contains\\backslash");
-        lpf.setProperty("prop:seven", "contains:colon");
-        lpf.setProperty("prop=eight", "contains=equals");
-        lpf.setProperty("prop#nine", "contains#hash");
-        lpf.setProperty("prop!ten", "contains!exclamation");
-
-        File tmp = File.createTempFile("tmp", "props");
-        tmp.deleteOnExit();
-        lpf.saveAs(tmp);
-
-        // and check that the resulting file looks okay
-        String s = readFile(tmp);
-
-        assertTrue(s.indexOf("\\ prop\\ one\\ =\\ \\ leading and trailing"
-                             + " spaces ") > -1);
-        assertTrue(s.indexOf("prop\\ttwo=contains\\ttab") > -1);
-        assertTrue(s.indexOf("prop\\nthree=contains\\nnewline") > -1);
-        assertTrue(s.indexOf("prop\\rfour=contains\\rcarraige return") > -1);
-        assertTrue(s.indexOf("prop\\\\six=contains\\\\backslash") > -1);
-        assertTrue(s.indexOf("prop\\:seven=contains\\:colon") > -1);
-        assertTrue(s.indexOf("prop\\=eight=contains\\=equals") > -1);
-        assertTrue(s.indexOf("prop\\#nine=contains\\#hash") > -1);
-        assertTrue(s.indexOf("prop\\!ten=contains\\!exclamation") > -1);
-    }
-
-    /**
-     * Tests that properties are correctly indexed, so that when we set
-     * an existing property, it updates the logical line, and it doesn't
-     * append a new one.
-     */
-    @Test
-    public void testOverwrite() throws Exception {
-        File unusual = new File(System.getProperty("root"),
-                                "src/etc/testcases/util/unusual.properties");
-        FileInputStream fis = new FileInputStream(unusual);
-        LayoutPreservingProperties lpf = new LayoutPreservingProperties();
-        lpf.load(fis);
-
-        lpf.setProperty(" prop one ", "new one");
-        lpf.setProperty("prop\ttwo", "new two");
-        lpf.setProperty("prop\nthree", "new three");
-
-        File tmp = File.createTempFile("tmp", "props");
-        tmp.deleteOnExit();
-        lpf.saveAs(tmp);
-
-        // and check that the resulting file looks okay
-        String s = readFile(tmp);
-
-        assertTrue(s.indexOf("\\ prop\\ one\\ =\\ \\ leading and"
-                             + " trailing spaces ") == -1);
-        assertTrue(s.indexOf("\\ prop\\ one\\ =new one") > -1);
-        assertTrue(s.indexOf("prop\\ttwo=contains\\ttab") == -1);
-        assertTrue(s.indexOf("prop\\ttwo=new two") > -1);
-        assertTrue(s.indexOf("prop\\nthree=contains\\nnewline") == -1);
-        assertTrue(s.indexOf("prop\\nthree=new three") > -1);
-    }
-
-    @Test
-    public void testStoreWithHeader() throws Exception {
-        File simple = new File(System.getProperty("root"),
-                               "src/etc/testcases/util/simple.properties");
-        FileInputStream fis = new FileInputStream(simple);
-        LayoutPreservingProperties lpf = new LayoutPreservingProperties();
-        lpf.load(fis);
-
-        File tmp = File.createTempFile("tmp", "props");
-        tmp.deleteOnExit();
-        FileOutputStream fos = new FileOutputStream(tmp);
-        lpf.store(fos, "file-header");
-        fos.close();
-
-        // and check that the resulting file looks okay
-        String s = readFile(tmp);
-
-        assertTrue("should have had header ", s.startsWith("#file-header"));
-    }
-
-    @Test
-    public void testClear() throws Exception {
-        File simple = new File(System.getProperty("root"),
-                               "src/etc/testcases/util/simple.properties");
-        FileInputStream fis = new FileInputStream(simple);
-        LayoutPreservingProperties lpf = new LayoutPreservingProperties();
-        lpf.load(fis);
-
-        lpf.clear();
-
-        File tmp = File.createTempFile("tmp", "props");
-        tmp.deleteOnExit();
-        lpf.saveAs(tmp);
-
-        // and check that the resulting file looks okay
-        String s = readFile(tmp);
-
-        assertTrue("should have had no properties ",
-                   s.indexOf("prop.alpha") == -1);
-        assertTrue("should have had no properties ",
-                   s.indexOf("prop.beta") == -1);
-        assertTrue("should have had no properties ",
-                   s.indexOf("prop.gamma") == -1);
-
-        assertTrue("should have had no comments",
-                   s.indexOf("# a comment") == -1);
-        assertTrue("should have had no comments",
-                   s.indexOf("! more comment") == -1);
-        assertTrue("should have had no comments",
-                   s.indexOf("# now a line wrapping one") == -1);
-    }
-
-    @Test
-    public void testRemove() throws Exception {
-        File simple = new File(System.getProperty("root"),
-                               "src/etc/testcases/util/simple.properties");
-        FileInputStream fis = new FileInputStream(simple);
-        LayoutPreservingProperties lpf = new LayoutPreservingProperties();
-        lpf.load(fis);
-
-        lpf.remove("prop.beta");
-
-        File tmp = File.createTempFile("tmp", "props");
-        tmp.deleteOnExit();
-        lpf.saveAs(tmp);
-
-        // and check that the resulting file looks okay
-        String s = readFile(tmp);
-
-        assertTrue("should not have had prop.beta",
-                   s.indexOf("prop.beta") == -1);
-        assertTrue("should have had prop.beta's comment",
-                   s.indexOf("! more comment") > -1);
-    }
-
-    @Test
-    public void testRemoveWithComment() throws Exception {
-        File simple = new File(System.getProperty("root"),
-                               "src/etc/testcases/util/simple.properties");
-        FileInputStream fis = new FileInputStream(simple);
-        LayoutPreservingProperties lpf = new LayoutPreservingProperties();
-        lpf.load(fis);
-
-        lpf.setRemoveComments(true);
-
-        lpf.remove("prop.beta");
-
-        File tmp = File.createTempFile("tmp", "props");
-        tmp.deleteOnExit();
-        lpf.saveAs(tmp);
-
-        // and check that the resulting file looks okay
-        String s = readFile(tmp);
-
-        assertTrue("should not have had prop.beta",
-                   s.indexOf("prop.beta") == -1);
-        assertTrue("should not have had prop.beta's comment",
-                   s.indexOf("! more comment") == -1);
-    }
-
-    @Test
-    public void testClone() throws Exception {
-        File simple = new File(System.getProperty("root"),
-                               "src/etc/testcases/util/simple.properties");
-        FileInputStream fis = new FileInputStream(simple);
-        LayoutPreservingProperties lpf1 = new LayoutPreservingProperties();
-        lpf1.load(fis);
-
-        LayoutPreservingProperties lpf2 =
-            (LayoutPreservingProperties) lpf1.clone();
-
-        lpf2.setProperty("prop.new", "a new property");
-        lpf2.setProperty("prop.beta", "a new value for beta");
-
-        assertEquals("size of original is wrong", 3, lpf1.size());
-        assertEquals("size of clone is wrong", 4, lpf2.size());
-
-        File tmp1 = File.createTempFile("tmp", "props");
-        tmp1.deleteOnExit();
-        lpf1.saveAs(tmp1);
-        String s1 = readFile(tmp1);
-
-        File tmp2 = File.createTempFile("tmp", "props");
-        tmp2.deleteOnExit();
-        lpf2.saveAs(tmp2);
-        String s2 = readFile(tmp2);
-
-        // check original is untouched
-        assertTrue("should have had 'simple'", s1.indexOf("simple") > -1);
-        assertTrue("should not have had prop.new", s1.indexOf("prop.new") == -1);
-
-        // check clone has the changes
-        assertTrue("should have had 'a new value for beta'",
-                   s2.indexOf("a new value for beta") > -1);
-        assertTrue("should have had prop.new", s2.indexOf("prop.new") > -1);
-    }
-
-    @Test
-    public void testPreserveEscapeName() throws Exception {
-        LayoutPreservingProperties lpf = new LayoutPreservingProperties();
-        File unusual = new File(System.getProperty("root"),
-                                "src/etc/testcases/util/unusual.properties");
-        FileInputStream fis = new FileInputStream(unusual);
-        lpf.load(fis);
-
-        lpf.setProperty("prop:seven", "new value for seven");
-        lpf.setProperty("prop=eight", "new value for eight");
-        lpf.setProperty("prop eleven", "new value for eleven");
-
-        lpf.setProperty("alpha", "new value for alpha");
-        lpf.setProperty("beta", "new value for beta");
-
-        File tmp = File.createTempFile("tmp", "props");
-        tmp.deleteOnExit();
-        lpf.saveAs(tmp);
-
-        // and check that the resulting file looks okay
-        String s = readFile(tmp);
-
-        assertTrue(s.indexOf("prop\\:seven=new value for seven") > -1);
-        assertTrue(s.indexOf("prop\\=eight=new value for eight") > -1);
-        assertTrue(s.indexOf("prop\\ eleven=new value for eleven") > -1);
-        assertTrue(s.indexOf("alpha=new value for alpha") > -1);
-        assertTrue(s.indexOf("beta=new value for beta") > -1);
-
-        assertTrue(s.indexOf("prop\\:seven=contains\\:colon") == -1);
-        assertTrue(s.indexOf("prop\\=eight=contains\\=equals") == -1);
-        assertTrue(s.indexOf("alpha:set with a colon") == -1);
-        assertTrue(s.indexOf("beta set with a space") == -1);
-    }
-
-    private static String readFile(File f) throws IOException {
-        FileInputStream fis = new FileInputStream(f);
-        InputStreamReader isr = new InputStreamReader(fis);
-        String s = FileUtils.readFully(isr);
-        isr.close();
-        fis.close();
-        return s;
-    }
-}
+/*
+ *  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.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.util.Properties;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class LayoutPreservingPropertiesTest {
+
+    /**
+     * Tests that a properties file read by the
+     * LayoutPreservingPropertiesFile and then saves the properties in
+     * it.
+     */
+    @Test
+    public void testPreserve() throws Exception {
+        File simple = new File(System.getProperty("root"),
+                               "src/etc/testcases/util/simple.properties");
+        FileInputStream fis = new FileInputStream(simple);
+        LayoutPreservingProperties lpf = new LayoutPreservingProperties();
+        lpf.load(fis);
+
+        File tmp = File.createTempFile("tmp", "props");
+        tmp.deleteOnExit();
+        lpf.saveAs(tmp);
+
+        // now compare original and tmp for property equivalence
+        Properties originalProps = new Properties();
+        originalProps.load(new FileInputStream(simple));
+
+        Properties tmpProps = new Properties();
+        tmpProps.load(new FileInputStream(tmp));
+
+        assertEquals("properties corrupted", originalProps, tmpProps);
+
+        // and now make sure that the comments made it into the new file
+        String s = readFile(tmp);
+        assertTrue("missing comment", s.indexOf("# a comment") > -1);
+        assertTrue("missing comment", s.indexOf("! more comment") > -1);
+    }
+
+    /**
+     * Tests that names and value are properly escaped when being
+     * written out.
+     */
+    @Test
+    public void testEscaping() throws Exception {
+        LayoutPreservingProperties lpf = new LayoutPreservingProperties();
+
+        lpf.setProperty(" prop one ", "  leading and trailing spaces ");
+        lpf.setProperty("prop\ttwo", "contains\ttab");
+        lpf.setProperty("prop\nthree", "contains\nnewline");
+        lpf.setProperty("prop\rfour", "contains\rcarraige return");
+        lpf.setProperty("prop\ffive", "contains\fform feed");
+        lpf.setProperty("prop\\six", "contains\\backslash");
+        lpf.setProperty("prop:seven", "contains:colon");
+        lpf.setProperty("prop=eight", "contains=equals");
+        lpf.setProperty("prop#nine", "contains#hash");
+        lpf.setProperty("prop!ten", "contains!exclamation");
+
+        File tmp = File.createTempFile("tmp", "props");
+        tmp.deleteOnExit();
+        lpf.saveAs(tmp);
+
+        // and check that the resulting file looks okay
+        String s = readFile(tmp);
+
+        assertTrue(s.indexOf("\\ prop\\ one\\ =\\ \\ leading and trailing"
+                             + " spaces ") > -1);
+        assertTrue(s.indexOf("prop\\ttwo=contains\\ttab") > -1);
+        assertTrue(s.indexOf("prop\\nthree=contains\\nnewline") > -1);
+        assertTrue(s.indexOf("prop\\rfour=contains\\rcarraige return") > -1);
+        assertTrue(s.indexOf("prop\\\\six=contains\\\\backslash") > -1);
+        assertTrue(s.indexOf("prop\\:seven=contains\\:colon") > -1);
+        assertTrue(s.indexOf("prop\\=eight=contains\\=equals") > -1);
+        assertTrue(s.indexOf("prop\\#nine=contains\\#hash") > -1);
+        assertTrue(s.indexOf("prop\\!ten=contains\\!exclamation") > -1);
+    }
+
+    /**
+     * Tests that properties are correctly indexed, so that when we set
+     * an existing property, it updates the logical line, and it doesn't
+     * append a new one.
+     */
+    @Test
+    public void testOverwrite() throws Exception {
+        File unusual = new File(System.getProperty("root"),
+                                "src/etc/testcases/util/unusual.properties");
+        FileInputStream fis = new FileInputStream(unusual);
+        LayoutPreservingProperties lpf = new LayoutPreservingProperties();
+        lpf.load(fis);
+
+        lpf.setProperty(" prop one ", "new one");
+        lpf.setProperty("prop\ttwo", "new two");
+        lpf.setProperty("prop\nthree", "new three");
+
+        File tmp = File.createTempFile("tmp", "props");
+        tmp.deleteOnExit();
+        lpf.saveAs(tmp);
+
+        // and check that the resulting file looks okay
+        String s = readFile(tmp);
+
+        assertTrue(s.indexOf("\\ prop\\ one\\ =\\ \\ leading and"
+                             + " trailing spaces ") == -1);
+        assertTrue(s.indexOf("\\ prop\\ one\\ =new one") > -1);
+        assertTrue(s.indexOf("prop\\ttwo=contains\\ttab") == -1);
+        assertTrue(s.indexOf("prop\\ttwo=new two") > -1);
+        assertTrue(s.indexOf("prop\\nthree=contains\\nnewline") == -1);
+        assertTrue(s.indexOf("prop\\nthree=new three") > -1);
+    }
+
+    @Test
+    public void testStoreWithHeader() throws Exception {
+        File simple = new File(System.getProperty("root"),
+                               "src/etc/testcases/util/simple.properties");
+        FileInputStream fis = new FileInputStream(simple);
+        LayoutPreservingProperties lpf = new LayoutPreservingProperties();
+        lpf.load(fis);
+
+        File tmp = File.createTempFile("tmp", "props");
+        tmp.deleteOnExit();
+        FileOutputStream fos = new FileOutputStream(tmp);
+        lpf.store(fos, "file-header");
+        fos.close();
+
+        // and check that the resulting file looks okay
+        String s = readFile(tmp);
+
+        assertTrue("should have had header ", s.startsWith("#file-header"));
+    }
+
+    @Test
+    public void testClear() throws Exception {
+        File simple = new File(System.getProperty("root"),
+                               "src/etc/testcases/util/simple.properties");
+        FileInputStream fis = new FileInputStream(simple);
+        LayoutPreservingProperties lpf = new LayoutPreservingProperties();
+        lpf.load(fis);
+
+        lpf.clear();
+
+        File tmp = File.createTempFile("tmp", "props");
+        tmp.deleteOnExit();
+        lpf.saveAs(tmp);
+
+        // and check that the resulting file looks okay
+        String s = readFile(tmp);
+
+        assertTrue("should have had no properties ",
+                   s.indexOf("prop.alpha") == -1);
+        assertTrue("should have had no properties ",
+                   s.indexOf("prop.beta") == -1);
+        assertTrue("should have had no properties ",
+                   s.indexOf("prop.gamma") == -1);
+
+        assertTrue("should have had no comments",
+                   s.indexOf("# a comment") == -1);
+        assertTrue("should have had no comments",
+                   s.indexOf("! more comment") == -1);
+        assertTrue("should have had no comments",
+                   s.indexOf("# now a line wrapping one") == -1);
+    }
+
+    @Test
+    public void testRemove() throws Exception {
+        File simple = new File(System.getProperty("root"),
+                               "src/etc/testcases/util/simple.properties");
+        FileInputStream fis = new FileInputStream(simple);
+        LayoutPreservingProperties lpf = new LayoutPreservingProperties();
+        lpf.load(fis);
+
+        lpf.remove("prop.beta");
+
+        File tmp = File.createTempFile("tmp", "props");
+        tmp.deleteOnExit();
+        lpf.saveAs(tmp);
+
+        // and check that the resulting file looks okay
+        String s = readFile(tmp);
+
+        assertTrue("should not have had prop.beta",
+                   s.indexOf("prop.beta") == -1);
+        assertTrue("should have had prop.beta's comment",
+                   s.indexOf("! more comment") > -1);
+    }
+
+    @Test
+    public void testRemoveWithComment() throws Exception {
+        File simple = new File(System.getProperty("root"),
+                               "src/etc/testcases/util/simple.properties");
+        FileInputStream fis = new FileInputStream(simple);
+        LayoutPreservingProperties lpf = new LayoutPreservingProperties();
+        lpf.load(fis);
+
+        lpf.setRemoveComments(true);
+
+        lpf.remove("prop.beta");
+
+        File tmp = File.createTempFile("tmp", "props");
+        tmp.deleteOnExit();
+        lpf.saveAs(tmp);
+
+        // and check that the resulting file looks okay
+        String s = readFile(tmp);
+
+        assertTrue("should not have had prop.beta",
+                   s.indexOf("prop.beta") == -1);
+        assertTrue("should not have had prop.beta's comment",
+                   s.indexOf("! more comment") == -1);
+    }
+
+    @Test
+    public void testClone() throws Exception {
+        File simple = new File(System.getProperty("root"),
+                               "src/etc/testcases/util/simple.properties");
+        FileInputStream fis = new FileInputStream(simple);
+        LayoutPreservingProperties lpf1 = new LayoutPreservingProperties();
+        lpf1.load(fis);
+
+        LayoutPreservingProperties lpf2 =
+            (LayoutPreservingProperties) lpf1.clone();
+
+        lpf2.setProperty("prop.new", "a new property");
+        lpf2.setProperty("prop.beta", "a new value for beta");
+
+        assertEquals("size of original is wrong", 3, lpf1.size());
+        assertEquals("size of clone is wrong", 4, lpf2.size());
+
+        File tmp1 = File.createTempFile("tmp", "props");
+        tmp1.deleteOnExit();
+        lpf1.saveAs(tmp1);
+        String s1 = readFile(tmp1);
+
+        File tmp2 = File.createTempFile("tmp", "props");
+        tmp2.deleteOnExit();
+        lpf2.saveAs(tmp2);
+        String s2 = readFile(tmp2);
+
+        // check original is untouched
+        assertTrue("should have had 'simple'", s1.indexOf("simple") > -1);
+        assertTrue("should not have had prop.new", s1.indexOf("prop.new") == -1);
+
+        // check clone has the changes
+        assertTrue("should have had 'a new value for beta'",
+                   s2.indexOf("a new value for beta") > -1);
+        assertTrue("should have had prop.new", s2.indexOf("prop.new") > -1);
+    }
+
+    @Test
+    public void testPreserveEscapeName() throws Exception {
+        LayoutPreservingProperties lpf = new LayoutPreservingProperties();
+        File unusual = new File(System.getProperty("root"),
+                                "src/etc/testcases/util/unusual.properties");
+        FileInputStream fis = new FileInputStream(unusual);
+        lpf.load(fis);
+
+        lpf.setProperty("prop:seven", "new value for seven");
+        lpf.setProperty("prop=eight", "new value for eight");
+        lpf.setProperty("prop eleven", "new value for eleven");
+
+        lpf.setProperty("alpha", "new value for alpha");
+        lpf.setProperty("beta", "new value for beta");
+
+        File tmp = File.createTempFile("tmp", "props");
+        tmp.deleteOnExit();
+        lpf.saveAs(tmp);
+
+        // and check that the resulting file looks okay
+        String s = readFile(tmp);
+
+        assertTrue(s.indexOf("prop\\:seven=new value for seven") > -1);
+        assertTrue(s.indexOf("prop\\=eight=new value for eight") > -1);
+        assertTrue(s.indexOf("prop\\ eleven=new value for eleven") > -1);
+        assertTrue(s.indexOf("alpha=new value for alpha") > -1);
+        assertTrue(s.indexOf("beta=new value for beta") > -1);
+
+        assertTrue(s.indexOf("prop\\:seven=contains\\:colon") == -1);
+        assertTrue(s.indexOf("prop\\=eight=contains\\=equals") == -1);
+        assertTrue(s.indexOf("alpha:set with a colon") == -1);
+        assertTrue(s.indexOf("beta set with a space") == -1);
+    }
+
+    private static String readFile(File f) throws IOException {
+        FileInputStream fis = new FileInputStream(f);
+        InputStreamReader isr = new InputStreamReader(fis);
+        String s = FileUtils.readFully(isr);
+        isr.close();
+        fis.close();
+        return s;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/LazyFileOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/LazyFileOutputStreamTest.java b/src/tests/junit/org/apache/tools/ant/util/LazyFileOutputStreamTest.java
index d7da277..82c3634 100644
--- a/src/tests/junit/org/apache/tools/ant/util/LazyFileOutputStreamTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/LazyFileOutputStreamTest.java
@@ -1,75 +1,75 @@
-/*
- *  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.File;
-import java.io.IOException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertTrue;
-
-/**
- * @since Ant 1.6
- */
-public class LazyFileOutputStreamTest {
-    private LazyFileOutputStream los;
-    private final static File f = new File("test.txt");
-
-    @Before
-    public void setUp() {
-        los = new LazyFileOutputStream(f);
-    }
-
-    @After
-    public void tearDown() throws IOException {
-        try {
-            los.close();
-        } finally {
-            f.delete();
-        }
-    }
-
-    @Test
-    public void testNoFileWithoutWrite() throws IOException {
-        los.close();
-        assertTrue(f + " has not been written.", !f.exists());
-    }
-
-    @Test
-    public void testOpen() throws IOException {
-        los.open();
-        los.close();
-        assertTrue(f + " has been written.", f.exists());
-    }
-
-    @Test
-    public void testSingleByte() throws IOException {
-        los.write(0);
-        los.close();
-        assertTrue(f + " has been written.", f.exists());
-    }
-
-    @Test
-    public void testByteArray() throws IOException {
-        los.write(new byte[] {0});
-        los.close();
-        assertTrue(f + " has been written.", f.exists());
-    }
-}
+/*
+ *  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.File;
+import java.io.IOException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+
+/**
+ * @since Ant 1.6
+ */
+public class LazyFileOutputStreamTest {
+    private LazyFileOutputStream los;
+    private final static File f = new File("test.txt");
+
+    @Before
+    public void setUp() {
+        los = new LazyFileOutputStream(f);
+    }
+
+    @After
+    public void tearDown() throws IOException {
+        try {
+            los.close();
+        } finally {
+            f.delete();
+        }
+    }
+
+    @Test
+    public void testNoFileWithoutWrite() throws IOException {
+        los.close();
+        assertTrue(f + " has not been written.", !f.exists());
+    }
+
+    @Test
+    public void testOpen() throws IOException {
+        los.open();
+        los.close();
+        assertTrue(f + " has been written.", f.exists());
+    }
+
+    @Test
+    public void testSingleByte() throws IOException {
+        los.write(0);
+        los.close();
+        assertTrue(f + " has been written.", f.exists());
+    }
+
+    @Test
+    public void testByteArray() throws IOException {
+        los.write(new byte[] {0});
+        los.close();
+        assertTrue(f + " has been written.", f.exists());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/LineOrientedOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/LineOrientedOutputStreamTest.java b/src/tests/junit/org/apache/tools/ant/util/LineOrientedOutputStreamTest.java
index 0ffd997..1fa23e8 100644
--- a/src/tests/junit/org/apache/tools/ant/util/LineOrientedOutputStreamTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/LineOrientedOutputStreamTest.java
@@ -1,153 +1,153 @@
-/*
- *  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.IOException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-
-public class LineOrientedOutputStreamTest {
-
-    private static String LINE = "This is a line";
-    private DummyStream stream;
-
-
-    @Before
-    public void setUp() {
-        stream = new DummyStream();
-    }
-
-    @After
-    public void tearDown() throws IOException {
-        if (stream != null) {
-            stream.close();
-        }
-    }
-
-    @Test
-    public void testLineWithLinefeedArray() throws IOException {
-        writeByteArray();
-        writeAsArray('\n');
-        stream.assertInvoked();
-    }
-
-    @Test
-    public void testLineWithLinefeedSingleBytes() throws IOException {
-        writeSingleBytes();
-        stream.write('\n');
-        stream.assertInvoked();
-    }
-
-    @Test
-    public void testLineWithCariagereturnArray() throws IOException {
-        writeByteArray();
-        writeAsArray('\r');
-        stream.assertInvoked();
-    }
-
-    @Test
-    public void testLineWithCariagereturnSingleBytes() throws IOException {
-        writeSingleBytes();
-        stream.write('\r');
-        stream.assertInvoked();
-    }
-
-    @Test
-    public void testLineWithCariagereturnLinefeedArray() throws IOException {
-        writeByteArray();
-        writeAsArray('\r');
-        writeAsArray('\n');
-        stream.assertInvoked();
-    }
-
-    @Test
-    public void testLineWithCariagereturnLinefeedSingleBytes() throws IOException {
-        writeSingleBytes();
-        stream.write('\r');
-        stream.write('\n');
-        stream.assertInvoked();
-    }
-
-    @Test
-    public void testFlushArray() throws IOException {
-        writeByteArray();
-        stream.flush();
-        stream.assertNotInvoked();
-    }
-
-    @Test
-    public void testFlushSingleBytes() throws IOException {
-        writeSingleBytes();
-        stream.flush();
-        stream.assertNotInvoked();
-    }
-
-    @Test
-    public void testCloseArray() throws IOException {
-        writeByteArray();
-        stream.close();
-        stream.assertInvoked();
-        stream = null;
-    }
-
-    @Test
-    public void testCloseSingleBytes() throws IOException {
-        writeSingleBytes();
-        stream.close();
-        stream.assertInvoked();
-        stream = null;
-    }
-
-    private void writeByteArray() throws IOException {
-        stream.write(LINE.getBytes(), 0, LINE.length());
-    }
-
-    private void writeSingleBytes() throws IOException {
-        byte[] b = LINE.getBytes();
-        for (int i = 0; i < b.length; i++) {
-            stream.write(b[i]);
-        }
-    }
-
-    private void writeAsArray(char c) throws IOException {
-        stream.write(new byte[] {(byte) c}, 0, 1);
-    }
-
-    private class DummyStream extends LineOrientedOutputStream {
-        private boolean invoked;
-        protected void processLine(String line) {
-            assertFalse("Only one line", invoked);
-            assertEquals(LINE, line);
-            invoked = true;
-        }
-
-        private void assertInvoked() {
-            assertTrue("At least one line", invoked);
-        }
-        private void assertNotInvoked() {
-            assertTrue("No output", !invoked);
-        }
-    }
-}// LineOrientedOutputStreamTest
+/*
+ *  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.IOException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+
+public class LineOrientedOutputStreamTest {
+
+    private static String LINE = "This is a line";
+    private DummyStream stream;
+
+
+    @Before
+    public void setUp() {
+        stream = new DummyStream();
+    }
+
+    @After
+    public void tearDown() throws IOException {
+        if (stream != null) {
+            stream.close();
+        }
+    }
+
+    @Test
+    public void testLineWithLinefeedArray() throws IOException {
+        writeByteArray();
+        writeAsArray('\n');
+        stream.assertInvoked();
+    }
+
+    @Test
+    public void testLineWithLinefeedSingleBytes() throws IOException {
+        writeSingleBytes();
+        stream.write('\n');
+        stream.assertInvoked();
+    }
+
+    @Test
+    public void testLineWithCariagereturnArray() throws IOException {
+        writeByteArray();
+        writeAsArray('\r');
+        stream.assertInvoked();
+    }
+
+    @Test
+    public void testLineWithCariagereturnSingleBytes() throws IOException {
+        writeSingleBytes();
+        stream.write('\r');
+        stream.assertInvoked();
+    }
+
+    @Test
+    public void testLineWithCariagereturnLinefeedArray() throws IOException {
+        writeByteArray();
+        writeAsArray('\r');
+        writeAsArray('\n');
+        stream.assertInvoked();
+    }
+
+    @Test
+    public void testLineWithCariagereturnLinefeedSingleBytes() throws IOException {
+        writeSingleBytes();
+        stream.write('\r');
+        stream.write('\n');
+        stream.assertInvoked();
+    }
+
+    @Test
+    public void testFlushArray() throws IOException {
+        writeByteArray();
+        stream.flush();
+        stream.assertNotInvoked();
+    }
+
+    @Test
+    public void testFlushSingleBytes() throws IOException {
+        writeSingleBytes();
+        stream.flush();
+        stream.assertNotInvoked();
+    }
+
+    @Test
+    public void testCloseArray() throws IOException {
+        writeByteArray();
+        stream.close();
+        stream.assertInvoked();
+        stream = null;
+    }
+
+    @Test
+    public void testCloseSingleBytes() throws IOException {
+        writeSingleBytes();
+        stream.close();
+        stream.assertInvoked();
+        stream = null;
+    }
+
+    private void writeByteArray() throws IOException {
+        stream.write(LINE.getBytes(), 0, LINE.length());
+    }
+
+    private void writeSingleBytes() throws IOException {
+        byte[] b = LINE.getBytes();
+        for (int i = 0; i < b.length; i++) {
+            stream.write(b[i]);
+        }
+    }
+
+    private void writeAsArray(char c) throws IOException {
+        stream.write(new byte[] {(byte) c}, 0, 1);
+    }
+
+    private class DummyStream extends LineOrientedOutputStream {
+        private boolean invoked;
+        protected void processLine(String line) {
+            assertFalse("Only one line", invoked);
+            assertEquals(LINE, line);
+            invoked = true;
+        }
+
+        private void assertInvoked() {
+            assertTrue("At least one line", invoked);
+        }
+        private void assertNotInvoked() {
+            assertTrue("No output", !invoked);
+        }
+    }
+}// LineOrientedOutputStreamTest

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/LinkedHashtableTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/LinkedHashtableTest.java b/src/tests/junit/org/apache/tools/ant/util/LinkedHashtableTest.java
index 4b88792..bfd2cda 100644
--- a/src/tests/junit/org/apache/tools/ant/util/LinkedHashtableTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/LinkedHashtableTest.java
@@ -1,165 +1,165 @@
-/*
- *  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.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertEquals;
-
-public class LinkedHashtableTest {
-
-    private static final Object K1 = new Object();
-    private static final Object K2 = new Object();
-    private static final Object V1 = new Object();
-    private static final Object V2 = new Object();
-    private Hashtable h = new LinkedHashtable();
-
-    public void testClear() {
-        h.put(K1, V1);
-        h.clear();
-        assertTrue(h.isEmpty());
-    }
-
-    public void testClone() {
-        h.put(K1, V1);
-        Hashtable h2 = (Hashtable) h.clone();
-        assertTrue(h2 instanceof LinkedHashtable);
-        assertTrue(h2.containsKey(K1));
-    }
-
-    @Test
-    public void testContainsAndPut() {
-        h.put(K1, V1);
-        assertTrue(h.contains(K1));
-        assertTrue(h.containsKey(K1));
-        assertTrue(h.containsValue(V1));
-        assertFalse(h.containsKey(K2));
-    }
-
-    @Test
-    public void testGet() {
-        assertNull(h.get(K1));
-        h.put(K1, V1);
-        assertSame(V1, h.get(K1));
-    }
-
-    @Test
-    public void testIsEmpty() {
-        assertTrue(h.isEmpty());
-        h.put(K1, V1);
-        assertFalse(h.isEmpty());
-    }
-
-    @Test
-    public void testPutReturnValue() {
-        assertNull(h.put(K1, V1));
-        assertSame(V1, h.put(K1, V2));
-    }
-
-    @Test
-    public void testPutAll() {
-        LinkedHashtable h2 = new LinkedHashtable();
-        h.put(K1, V1);
-        h2.putAll(h);
-        assertTrue(h2.containsKey(K1));
-    }
-
-    @Test
-    public void testRemove() {
-        h.put(K1, V1);
-        assertSame(V1, h.remove(K1));
-        assertTrue(h.isEmpty());
-        assertNull(h.remove(K1));
-    }
-
-    @Test
-    public void testSize() {
-        assertEquals(0, h.size());
-        h.put(K1, V1);
-        assertEquals(1, h.size());
-    }
-
-    @Test
-    public void testKeys() {
-        multiSetup();
-        assertKeys(CollectionUtils.asIterator(h.keys()));
-    }
-
-    @Test
-    public void testKeySet() {
-        multiSetup();
-        assertKeys(h.keySet().iterator());
-    }
-
-    @Test
-    public void testElements() {
-        multiSetup();
-        assertValues(CollectionUtils.asIterator(h.elements()));
-    }
-
-    @Test
-    public void testValues() {
-        multiSetup();
-        assertValues(h.values().iterator());
-    }
-
-    @Test
-    public void testEntrySet() {
-        multiSetup();
-        Iterator i = h.entrySet().iterator();
-        assertTrue(i.hasNext());
-        Map.Entry e = (Map.Entry) i.next();
-        assertSame(K1, e.getKey());
-        assertSame(V1, e.getValue());
-        assertTrue(i.hasNext());
-        e = (Map.Entry) i.next();
-        assertSame(K2, e.getKey());
-        assertSame(V2, e.getValue());
-        assertFalse(i.hasNext());
-    }
-
-    private void multiSetup() {
-        h.put(K1, V1);
-        h.put(K2, V2);
-    }
-
-    private static void assertKeys(Iterator i) {
-        assertTrue(i.hasNext());
-        assertSame(K1, i.next());
-        assertTrue(i.hasNext());
-        assertSame(K2, i.next());
-        assertFalse(i.hasNext());
-    }
-
-    private static void assertValues(Iterator i) {
-        assertTrue(i.hasNext());
-        assertSame(V1, i.next());
-        assertTrue(i.hasNext());
-        assertSame(V2, i.next());
-        assertFalse(i.hasNext());
-    }
-}
+/*
+ *  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.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertEquals;
+
+public class LinkedHashtableTest {
+
+    private static final Object K1 = new Object();
+    private static final Object K2 = new Object();
+    private static final Object V1 = new Object();
+    private static final Object V2 = new Object();
+    private Hashtable h = new LinkedHashtable();
+
+    public void testClear() {
+        h.put(K1, V1);
+        h.clear();
+        assertTrue(h.isEmpty());
+    }
+
+    public void testClone() {
+        h.put(K1, V1);
+        Hashtable h2 = (Hashtable) h.clone();
+        assertTrue(h2 instanceof LinkedHashtable);
+        assertTrue(h2.containsKey(K1));
+    }
+
+    @Test
+    public void testContainsAndPut() {
+        h.put(K1, V1);
+        assertTrue(h.contains(K1));
+        assertTrue(h.containsKey(K1));
+        assertTrue(h.containsValue(V1));
+        assertFalse(h.containsKey(K2));
+    }
+
+    @Test
+    public void testGet() {
+        assertNull(h.get(K1));
+        h.put(K1, V1);
+        assertSame(V1, h.get(K1));
+    }
+
+    @Test
+    public void testIsEmpty() {
+        assertTrue(h.isEmpty());
+        h.put(K1, V1);
+        assertFalse(h.isEmpty());
+    }
+
+    @Test
+    public void testPutReturnValue() {
+        assertNull(h.put(K1, V1));
+        assertSame(V1, h.put(K1, V2));
+    }
+
+    @Test
+    public void testPutAll() {
+        LinkedHashtable h2 = new LinkedHashtable();
+        h.put(K1, V1);
+        h2.putAll(h);
+        assertTrue(h2.containsKey(K1));
+    }
+
+    @Test
+    public void testRemove() {
+        h.put(K1, V1);
+        assertSame(V1, h.remove(K1));
+        assertTrue(h.isEmpty());
+        assertNull(h.remove(K1));
+    }
+
+    @Test
+    public void testSize() {
+        assertEquals(0, h.size());
+        h.put(K1, V1);
+        assertEquals(1, h.size());
+    }
+
+    @Test
+    public void testKeys() {
+        multiSetup();
+        assertKeys(CollectionUtils.asIterator(h.keys()));
+    }
+
+    @Test
+    public void testKeySet() {
+        multiSetup();
+        assertKeys(h.keySet().iterator());
+    }
+
+    @Test
+    public void testElements() {
+        multiSetup();
+        assertValues(CollectionUtils.asIterator(h.elements()));
+    }
+
+    @Test
+    public void testValues() {
+        multiSetup();
+        assertValues(h.values().iterator());
+    }
+
+    @Test
+    public void testEntrySet() {
+        multiSetup();
+        Iterator i = h.entrySet().iterator();
+        assertTrue(i.hasNext());
+        Map.Entry e = (Map.Entry) i.next();
+        assertSame(K1, e.getKey());
+        assertSame(V1, e.getValue());
+        assertTrue(i.hasNext());
+        e = (Map.Entry) i.next();
+        assertSame(K2, e.getKey());
+        assertSame(V2, e.getValue());
+        assertFalse(i.hasNext());
+    }
+
+    private void multiSetup() {
+        h.put(K1, V1);
+        h.put(K2, V2);
+    }
+
+    private static void assertKeys(Iterator i) {
+        assertTrue(i.hasNext());
+        assertSame(K1, i.next());
+        assertTrue(i.hasNext());
+        assertSame(K2, i.next());
+        assertFalse(i.hasNext());
+    }
+
+    private static void assertValues(Iterator i) {
+        assertTrue(i.hasNext());
+        assertSame(V1, i.next());
+        assertTrue(i.hasNext());
+        assertSame(V2, i.next());
+        assertFalse(i.hasNext());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/LoaderUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/LoaderUtilsTest.java b/src/tests/junit/org/apache/tools/ant/util/LoaderUtilsTest.java
index a4e4735..9935edd 100644
--- a/src/tests/junit/org/apache/tools/ant/util/LoaderUtilsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/LoaderUtilsTest.java
@@ -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.util;
-
-import java.io.File;
-import org.junit.Test;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertEquals;
-
-/**
- * @since Ant 1.6
- */
-public class LoaderUtilsTest {
-
-    @Test
-    public void testGetXyzSource() {
-        File f1 = LoaderUtils.getClassSource(LoaderUtils.class);
-        assertNotNull(f1);
-
-        File f2 = LoaderUtils.getResourceSource(null,
-                                                "org/apache/tools/ant/taskdefs/defaults.properties");
-        assertNotNull(f2);
-
-        assertEquals(f1.getAbsolutePath(), f2.getAbsolutePath());
-    }
-
-}
+/*
+ *  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.File;
+import org.junit.Test;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertEquals;
+
+/**
+ * @since Ant 1.6
+ */
+public class LoaderUtilsTest {
+
+    @Test
+    public void testGetXyzSource() {
+        File f1 = LoaderUtils.getClassSource(LoaderUtils.class);
+        assertNotNull(f1);
+
+        File f2 = LoaderUtils.getResourceSource(null,
+                                                "org/apache/tools/ant/taskdefs/defaults.properties");
+        assertNotNull(f2);
+
+        assertEquals(f1.getAbsolutePath(), f2.getAbsolutePath());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/PackageNameMapperTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/PackageNameMapperTest.java b/src/tests/junit/org/apache/tools/ant/util/PackageNameMapperTest.java
index d02d11e..fdf7393 100644
--- a/src/tests/junit/org/apache/tools/ant/util/PackageNameMapperTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/PackageNameMapperTest.java
@@ -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.util;
-
-import org.junit.Test;
-
-import java.io.File;
-
-import static org.junit.Assert.assertEquals;
-
-public class PackageNameMapperTest {
-
-    @Test
-    public void testMapping() {
-        PackageNameMapper mapper = new PackageNameMapper();
-        mapper.setFrom("*.java");
-        mapper.setTo("TEST-*.xml");
-        String file = fixupPath("org/apache/tools/ant/util/PackageNameMapperTest.java");
-        String result = mapper.mapFileName(file)[0];
-
-        assertEquals("TEST-org.apache.tools.ant.util.PackageNameMapperTest.xml",
-          result);
-    }
-
-    private String fixupPath(String file) {
-        return file.replace('/', File.separatorChar);
-    }
-}
+/*
+ *  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 org.junit.Test;
+
+import java.io.File;
+
+import static org.junit.Assert.assertEquals;
+
+public class PackageNameMapperTest {
+
+    @Test
+    public void testMapping() {
+        PackageNameMapper mapper = new PackageNameMapper();
+        mapper.setFrom("*.java");
+        mapper.setTo("TEST-*.xml");
+        String file = fixupPath("org/apache/tools/ant/util/PackageNameMapperTest.java");
+        String result = mapper.mapFileName(file)[0];
+
+        assertEquals("TEST-org.apache.tools.ant.util.PackageNameMapperTest.xml",
+          result);
+    }
+
+    private String fixupPath(String file) {
+        return file.replace('/', File.separatorChar);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java b/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java
index 3cfc93ffa..b31af33 100644
--- a/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java
@@ -1,142 +1,142 @@
-/*
- *  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 org.junit.Test;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
-import java.io.StringReader;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-/**
- * Test for ReaderInputStream
- */
-public class ReaderInputStreamTest {
-
-    @Test
-    public void testSimple() throws Exception {
-        compareBytes("abc", "utf-8");
-    }
-
-    @Test
-    public void testSimple16() throws Exception {
-        compareBytes("a", "utf-16");
-    }
-
-    @Test
-    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");
-        new String(bytes, 0, bytes.length, "utf-16");
-    }
-
-    @Test
-    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);
-    }
-
-    @Test
-    public void testPreample() throws Exception {
-        byte[] bytes = "".getBytes("utf-16");
-        System.out.println("Preample len is " + bytes.length);
-    }
-
-    @Test
-    public void testIso88591ToUtf8() throws Exception {
-        InputStreamReader fin = null;
-        ReaderInputStream r = null;
-        FileInputStream utf8 = null;
-        try {
-            fin = new InputStreamReader(new FileInputStream(new File(System.getProperty("root"), "src/tests/antunit/taskdefs/exec/input/iso8859-1")),
-                                        "ISO8859_1");
-            r = new ReaderInputStream(fin, "UTF8");
-
-            ByteArrayOutputStream actualOS = new ByteArrayOutputStream();
-            int b = r.read();
-            while (b > -1) {
-                actualOS.write((byte) b);
-                b = r.read();
-            }
-
-            utf8 = new FileInputStream(new File(System.getProperty("root"), "src/tests/antunit/taskdefs/exec/expected/utf-8"));
-            ByteArrayOutputStream expectedOS = new ByteArrayOutputStream();
-            b = utf8.read();
-            while (b > -1) {
-                expectedOS.write((byte) b);
-                b = utf8.read();
-            }
-
-            byte[] expected = expectedOS.toByteArray();
-            byte[] actual = actualOS.toByteArray();
-            assertEquals("length", expected.length, actual.length);
-            for (int i = 0; i < actual.length; i++) {
-                assertEquals("byte " + i, expected[i], actual[i]);
-            }
-        } finally {
-            FileUtils.close(fin);
-            FileUtils.close(r);
-            FileUtils.close(utf8);
-        }
-    }
-
-    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 org.junit.Test;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.io.StringReader;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Test for ReaderInputStream
+ */
+public class ReaderInputStreamTest {
+
+    @Test
+    public void testSimple() throws Exception {
+        compareBytes("abc", "utf-8");
+    }
+
+    @Test
+    public void testSimple16() throws Exception {
+        compareBytes("a", "utf-16");
+    }
+
+    @Test
+    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");
+        new String(bytes, 0, bytes.length, "utf-16");
+    }
+
+    @Test
+    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);
+    }
+
+    @Test
+    public void testPreample() throws Exception {
+        byte[] bytes = "".getBytes("utf-16");
+        System.out.println("Preample len is " + bytes.length);
+    }
+
+    @Test
+    public void testIso88591ToUtf8() throws Exception {
+        InputStreamReader fin = null;
+        ReaderInputStream r = null;
+        FileInputStream utf8 = null;
+        try {
+            fin = new InputStreamReader(new FileInputStream(new File(System.getProperty("root"), "src/tests/antunit/taskdefs/exec/input/iso8859-1")),
+                                        "ISO8859_1");
+            r = new ReaderInputStream(fin, "UTF8");
+
+            ByteArrayOutputStream actualOS = new ByteArrayOutputStream();
+            int b = r.read();
+            while (b > -1) {
+                actualOS.write((byte) b);
+                b = r.read();
+            }
+
+            utf8 = new FileInputStream(new File(System.getProperty("root"), "src/tests/antunit/taskdefs/exec/expected/utf-8"));
+            ByteArrayOutputStream expectedOS = new ByteArrayOutputStream();
+            b = utf8.read();
+            while (b > -1) {
+                expectedOS.write((byte) b);
+                b = utf8.read();
+            }
+
+            byte[] expected = expectedOS.toByteArray();
+            byte[] actual = actualOS.toByteArray();
+            assertEquals("length", expected.length, actual.length);
+            for (int i = 0; i < actual.length; i++) {
+                assertEquals("byte " + i, expected[i], actual[i]);
+            }
+        } finally {
+            FileUtils.close(fin);
+            FileUtils.close(r);
+            FileUtils.close(utf8);
+        }
+    }
+
+    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);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/ResourceUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/ResourceUtilsTest.java b/src/tests/junit/org/apache/tools/ant/util/ResourceUtilsTest.java
index b27ee34..96cc9cb 100644
--- a/src/tests/junit/org/apache/tools/ant/util/ResourceUtilsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/ResourceUtilsTest.java
@@ -1,63 +1,63 @@
-/*
- *  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 org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.Echo;
-import org.apache.tools.ant.types.Resource;
-import org.apache.tools.ant.types.ResourceFactory;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Tests for org.apache.tools.ant.util.ResourceUtils.
- */
-public class ResourceUtilsTest implements ResourceFactory, FileNameMapper {
-
-    private Echo taskINeedForLogging = new Echo();
-
-    @Before
-    public void setUp() {
-        taskINeedForLogging.setProject(new Project());
-    }
-
-    @Test
-    public void testNoDuplicates() {
-        Resource r = new Resource("samual vimes", true, 1, false);
-        Resource[] toNew =
-            ResourceUtils.selectOutOfDateSources(taskINeedForLogging,
-                                                 new Resource[] {r},
-                                                 this, this);
-        assertEquals(1, toNew.length);
-    }
-
-    /* ============ ResourceFactory interface ====================== */
-    public Resource getResource(String name) {
-        return new Resource(name); // implies lastModified == 0
-    }
-
-    /* ============ FileNameMapper interface ======================= */
-    public void setFrom(String s) {}
-    public void setTo(String s) {}
-    public String[] mapFileName(String s) {
-        return new String[] {"fred colon", "carrot ironfoundersson"};
-    }
-}
+/*
+ *  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 org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Echo;
+import org.apache.tools.ant.types.Resource;
+import org.apache.tools.ant.types.ResourceFactory;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests for org.apache.tools.ant.util.ResourceUtils.
+ */
+public class ResourceUtilsTest implements ResourceFactory, FileNameMapper {
+
+    private Echo taskINeedForLogging = new Echo();
+
+    @Before
+    public void setUp() {
+        taskINeedForLogging.setProject(new Project());
+    }
+
+    @Test
+    public void testNoDuplicates() {
+        Resource r = new Resource("samual vimes", true, 1, false);
+        Resource[] toNew =
+            ResourceUtils.selectOutOfDateSources(taskINeedForLogging,
+                                                 new Resource[] {r},
+                                                 this, this);
+        assertEquals(1, toNew.length);
+    }
+
+    /* ============ ResourceFactory interface ====================== */
+    public Resource getResource(String name) {
+        return new Resource(name); // implies lastModified == 0
+    }
+
+    /* ============ FileNameMapper interface ======================= */
+    public void setFrom(String s) {}
+    public void setTo(String s) {}
+    public String[] mapFileName(String s) {
+        return new String[] {"fred colon", "carrot ironfoundersson"};
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/SymlinkUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/SymlinkUtilsTest.java b/src/tests/junit/org/apache/tools/ant/util/SymlinkUtilsTest.java
index 6f4b037..d1de1b1 100644
--- a/src/tests/junit/org/apache/tools/ant/util/SymlinkUtilsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/SymlinkUtilsTest.java
@@ -1,40 +1,40 @@
-/*
- *  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 static org.junit.Assert.assertFalse;
-
-import java.io.IOException;
-
-import org.apache.tools.ant.taskdefs.condition.Os;
-import org.junit.Assume;
-import org.junit.Test;
-
-public class SymlinkUtilsTest {
-
-    private static final SymbolicLinkUtils SYMLINK_UTILS =
-        SymbolicLinkUtils.getSymbolicLinkUtils();
-
-    @Test
-    public void testRootIsNoSymlink() throws IOException {
-        Assume.assumeFalse("Symlink doesn't work on Windows", Os.isFamily("windows"));
-        assertFalse(SYMLINK_UTILS.isSymbolicLink("/"));
-    }
-
-}
+/*
+ *  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 static org.junit.Assert.assertFalse;
+
+import java.io.IOException;
+
+import org.apache.tools.ant.taskdefs.condition.Os;
+import org.junit.Assume;
+import org.junit.Test;
+
+public class SymlinkUtilsTest {
+
+    private static final SymbolicLinkUtils SYMLINK_UTILS =
+        SymbolicLinkUtils.getSymbolicLinkUtils();
+
+    @Test
+    public void testRootIsNoSymlink() throws IOException {
+        Assume.assumeFalse("Symlink doesn't work on Windows", Os.isFamily("windows"));
+        assertFalse(SYMLINK_UTILS.isSymbolicLink("/"));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/UnPackageNameMapperTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/UnPackageNameMapperTest.java b/src/tests/junit/org/apache/tools/ant/util/UnPackageNameMapperTest.java
index 18bf7ab..7586950 100644
--- a/src/tests/junit/org/apache/tools/ant/util/UnPackageNameMapperTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/UnPackageNameMapperTest.java
@@ -1,42 +1,42 @@
-/*
- *  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.File;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class UnPackageNameMapperTest {
-
-    @Test
-    public void testMapping() {
-        UnPackageNameMapper mapper = new UnPackageNameMapper();
-        mapper.setFrom("TEST-*.xml");
-        mapper.setTo("*.java");
-        String file ="TEST-org.apache.tools.ant.util.UnPackageNameMapperTest.xml";
-        String result = mapper.mapFileName(file)[0];
-        String expected = fixupPath("org/apache/tools/ant/util/UnPackageNameMapperTest.java");
-
-        assertEquals(expected, result);
-    }
-
-    private String fixupPath(String file) {
-        return file.replace('/', File.separatorChar);
-    }
-}
+/*
+ *  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.File;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class UnPackageNameMapperTest {
+
+    @Test
+    public void testMapping() {
+        UnPackageNameMapper mapper = new UnPackageNameMapper();
+        mapper.setFrom("TEST-*.xml");
+        mapper.setTo("*.java");
+        String file ="TEST-org.apache.tools.ant.util.UnPackageNameMapperTest.xml";
+        String result = mapper.mapFileName(file)[0];
+        String expected = fixupPath("org/apache/tools/ant/util/UnPackageNameMapperTest.java");
+
+        assertEquals(expected, result);
+    }
+
+    private String fixupPath(String file) {
+        return file.replace('/', File.separatorChar);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/util/UnicodeUtilTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/UnicodeUtilTest.java b/src/tests/junit/org/apache/tools/ant/util/UnicodeUtilTest.java
index cb526de..090da56 100644
--- a/src/tests/junit/org/apache/tools/ant/util/UnicodeUtilTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/UnicodeUtilTest.java
@@ -1,33 +1,33 @@
-/*
- *  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 org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class UnicodeUtilTest {
-
-    @Test
-    public void testChineseWord() {
-        String word = "\u81ea\u7531";
-        assertEquals("u81ea", UnicodeUtil.EscapeUnicode(word.charAt(0)).toString());
-        assertEquals("u7531", UnicodeUtil.EscapeUnicode(word.charAt(1)).toString());
-    }
-
-}
+/*
+ *  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 org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class UnicodeUtilTest {
+
+    @Test
+    public void testChineseWord() {
+        String word = "\u81ea\u7531";
+        assertEquals("u81ea", UnicodeUtil.EscapeUnicode(word.charAt(0)).toString());
+        assertEquals("u7531", UnicodeUtil.EscapeUnicode(word.charAt(1)).toString());
+    }
+
+}


[10/21] ant git commit: Normalise tabulation and line breaks

Posted by gi...@apache.org.
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/ZipFileSetTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/ZipFileSetTest.java b/src/tests/junit/org/apache/tools/ant/types/ZipFileSetTest.java
index 9b7f4b4..e7b14c1 100644
--- a/src/tests/junit/org/apache/tools/ant/types/ZipFileSetTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/ZipFileSetTest.java
@@ -1,118 +1,118 @@
-/*
- *  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.types;
-
-import java.io.File;
-
-import org.apache.tools.ant.BuildException;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-/**
- * JUnit 3 testcases for org.apache.tools.ant.types.ZipFileSet.
- *
- * <p>This doesn't actually test much, mainly reference handling.
- *
- */
-
-public class ZipFileSetTest extends AbstractFileSetTest {
-
-    protected AbstractFileSet getInstance() {
-        return new ZipFileSet();
-    }
-
-    @Test
-    public final void testAttributes() {
-        ZipFileSet f = (ZipFileSet)getInstance();
-        //check that dir and src are incompatible
-        f.setSrc(new File("example.zip"));
-        try {
-            f.setDir(new File("examples"));
-            fail("can add dir to "
-                    + f.getDataTypeName()
-                    + " when a src is already present");
-        } catch (BuildException be) {
-            assertEquals("Cannot set both dir and src attributes",be.getMessage());
-        }
-        f = (ZipFileSet)getInstance();
-        //check that dir and src are incompatible
-        f.setDir(new File("examples"));
-        try {
-            f.setSrc(new File("example.zip"));
-            fail("can add src to "
-                    + f.getDataTypeName()
-                    + " when a dir is already present");
-        } catch (BuildException be) {
-            assertEquals("Cannot set both dir and src attributes",be.getMessage());
-        }
-        //check that fullpath and prefix are incompatible
-        f = (ZipFileSet)getInstance();
-        f.setSrc(new File("example.zip"));
-        f.setPrefix("/examples");
-        try {
-            f.setFullpath("/doc/manual/index.html");
-            fail("Can add fullpath to "
-                    + f.getDataTypeName()
-                    + " when a prefix is already present");
-        } catch (BuildException be) {
-            assertEquals("Cannot set both fullpath and prefix attributes", be.getMessage());
-        }
-        f = (ZipFileSet)getInstance();
-        f.setSrc(new File("example.zip"));
-        f.setFullpath("/doc/manual/index.html");
-        try {
-            f.setPrefix("/examples");
-            fail("Can add prefix to "
-                    + f.getDataTypeName()
-                    + " when a fullpath is already present");
-        } catch (BuildException be) {
-            assertEquals("Cannot set both fullpath and prefix attributes", be.getMessage());
-        }
-        // check that reference zipfilesets cannot have specific attributes
-        f = (ZipFileSet)getInstance();
-        f.setRefid(new Reference(getProject(), "test"));
-        try {
-            f.setSrc(new File("example.zip"));
-            fail("Can add src to "
-                    + f.getDataTypeName()
-                    + " when a refid is already present");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one "
-            + "attribute when using refid", be.getMessage());
-        }
-        // check that a reference zipfileset gets the same attributes as the original
-        f = (ZipFileSet)getInstance();
-        f.setSrc(new File("example.zip"));
-        f.setPrefix("/examples");
-        f.setFileMode("600");
-        f.setDirMode("530");
-        getProject().addReference("test",f);
-        ZipFileSet zid=(ZipFileSet)getInstance();
-        zid.setRefid(new Reference(getProject(), "test"));
-        assertTrue("src attribute copied by copy constructor",zid.getSrc(getProject()).equals(f.getSrc(getProject())));
-        assertTrue("prefix attribute copied by copy constructor",f.getPrefix(getProject()).equals(zid.getPrefix(getProject())));
-        assertTrue("file mode attribute copied by copy constructor",f.getFileMode(getProject())==zid.getFileMode(getProject()));
-        assertTrue("dir mode attribute copied by copy constructor",f.getDirMode(getProject())==zid.getDirMode(getProject()));
-      }
-
-
-}
+/*
+ *  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.types;
+
+import java.io.File;
+
+import org.apache.tools.ant.BuildException;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * JUnit 3 testcases for org.apache.tools.ant.types.ZipFileSet.
+ *
+ * <p>This doesn't actually test much, mainly reference handling.
+ *
+ */
+
+public class ZipFileSetTest extends AbstractFileSetTest {
+
+    protected AbstractFileSet getInstance() {
+        return new ZipFileSet();
+    }
+
+    @Test
+    public final void testAttributes() {
+        ZipFileSet f = (ZipFileSet)getInstance();
+        //check that dir and src are incompatible
+        f.setSrc(new File("example.zip"));
+        try {
+            f.setDir(new File("examples"));
+            fail("can add dir to "
+                    + f.getDataTypeName()
+                    + " when a src is already present");
+        } catch (BuildException be) {
+            assertEquals("Cannot set both dir and src attributes",be.getMessage());
+        }
+        f = (ZipFileSet)getInstance();
+        //check that dir and src are incompatible
+        f.setDir(new File("examples"));
+        try {
+            f.setSrc(new File("example.zip"));
+            fail("can add src to "
+                    + f.getDataTypeName()
+                    + " when a dir is already present");
+        } catch (BuildException be) {
+            assertEquals("Cannot set both dir and src attributes",be.getMessage());
+        }
+        //check that fullpath and prefix are incompatible
+        f = (ZipFileSet)getInstance();
+        f.setSrc(new File("example.zip"));
+        f.setPrefix("/examples");
+        try {
+            f.setFullpath("/doc/manual/index.html");
+            fail("Can add fullpath to "
+                    + f.getDataTypeName()
+                    + " when a prefix is already present");
+        } catch (BuildException be) {
+            assertEquals("Cannot set both fullpath and prefix attributes", be.getMessage());
+        }
+        f = (ZipFileSet)getInstance();
+        f.setSrc(new File("example.zip"));
+        f.setFullpath("/doc/manual/index.html");
+        try {
+            f.setPrefix("/examples");
+            fail("Can add prefix to "
+                    + f.getDataTypeName()
+                    + " when a fullpath is already present");
+        } catch (BuildException be) {
+            assertEquals("Cannot set both fullpath and prefix attributes", be.getMessage());
+        }
+        // check that reference zipfilesets cannot have specific attributes
+        f = (ZipFileSet)getInstance();
+        f.setRefid(new Reference(getProject(), "test"));
+        try {
+            f.setSrc(new File("example.zip"));
+            fail("Can add src to "
+                    + f.getDataTypeName()
+                    + " when a refid is already present");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one "
+            + "attribute when using refid", be.getMessage());
+        }
+        // check that a reference zipfileset gets the same attributes as the original
+        f = (ZipFileSet)getInstance();
+        f.setSrc(new File("example.zip"));
+        f.setPrefix("/examples");
+        f.setFileMode("600");
+        f.setDirMode("530");
+        getProject().addReference("test",f);
+        ZipFileSet zid=(ZipFileSet)getInstance();
+        zid.setRefid(new Reference(getProject(), "test"));
+        assertTrue("src attribute copied by copy constructor",zid.getSrc(getProject()).equals(f.getSrc(getProject())));
+        assertTrue("prefix attribute copied by copy constructor",f.getPrefix(getProject()).equals(zid.getPrefix(getProject())));
+        assertTrue("file mode attribute copied by copy constructor",f.getFileMode(getProject())==zid.getFileMode(getProject()));
+        assertTrue("dir mode attribute copied by copy constructor",f.getDirMode(getProject())==zid.getDirMode(getProject()));
+      }
+
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/mappers/GlobMapperTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/mappers/GlobMapperTest.java b/src/tests/junit/org/apache/tools/ant/types/mappers/GlobMapperTest.java
index 479efb7..d48e529 100644
--- a/src/tests/junit/org/apache/tools/ant/types/mappers/GlobMapperTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/mappers/GlobMapperTest.java
@@ -1,49 +1,47 @@
-/*
- *  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.types.mappers;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-/**
- * Testcase for the &lt;globmapper&gt; mapper.
- *
- */
-public class GlobMapperTest {
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject("src/etc/testcases/types/mappers/globmapper.xml");
-    }
-
-    @Test
-    public void testIgnoreCase() {
-        buildRule.executeTarget("ignore.case");
-    }
-    public void testHandleDirSep() {
-        buildRule.executeTarget("handle.dirsep");
-    }
-}
-
-
+/*
+ *  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.types.mappers;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+/**
+ * Testcase for the &lt;globmapper&gt; mapper.
+ *
+ */
+public class GlobMapperTest {
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject("src/etc/testcases/types/mappers/globmapper.xml");
+    }
+
+    @Test
+    public void testIgnoreCase() {
+        buildRule.executeTarget("ignore.case");
+    }
+    public void testHandleDirSep() {
+        buildRule.executeTarget("handle.dirsep");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/mappers/MapperResult.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/mappers/MapperResult.java b/src/tests/junit/org/apache/tools/ant/types/mappers/MapperResult.java
index 207ed59..a982bcb 100644
--- a/src/tests/junit/org/apache/tools/ant/types/mappers/MapperResult.java
+++ b/src/tests/junit/org/apache/tools/ant/types/mappers/MapperResult.java
@@ -1,103 +1,103 @@
-/*
- *  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.types.mappers;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.types.Mapper;
-import org.apache.tools.ant.util.FileNameMapper;
-
-/**
- * This is a test task to show the result of a mapper
- * on a specific input.
- * (Test is not in the name of the class, to make sure that
- * it is not treated as a unit test.
- */
-
-public class MapperResult extends Task {
-
-    private String failMessage = "";
-    private String input;
-    private String output;
-    private FileNameMapper fileNameMapper;
-
-    /**
-     * The output on an empty string array
-     */
-    private static final String NULL_MAPPER_RESULT = "<NULL>";
-
-    public void setFailMessage(String failMessage) {
-        this.failMessage = failMessage;
-    }
-    
-    public void setInput(String input) {
-        this.input = input;
-    }
-
-    public void setOutput(String output) {
-        this.output = output;
-    }
-
-    public void addConfiguredMapper(Mapper mapper) {
-        add(mapper.getImplementation());
-    }
-
-    public void add(FileNameMapper fileNameMapper) {
-        if (this.fileNameMapper != null) {
-            throw new BuildException("Only one mapper type nested element allowed");
-        }
-        this.fileNameMapper = fileNameMapper;
-    }
-        
-    public void execute() {
-        if (input == null) {
-            throw new BuildException("Missing attribute 'input'");
-        }
-        if (output == null) {
-            throw new BuildException("Missing attribute 'output'");
-        }
-        if (fileNameMapper == null) {
-            throw new BuildException("Missing a nested file name mapper type element");
-        }
-        String[] result = fileNameMapper.mapFileName(input);
-        String flattened;
-        if (result == null) {
-            flattened = NULL_MAPPER_RESULT;
-        } else {
-            StringBuffer b = new StringBuffer();
-            for (int i = 0; i < result.length; ++i) {
-                if (i != 0) {
-                    b.append("|");
-                }
-                b.append(result[i]);
-            }
-            flattened = b.toString();
-        }
-        if (!flattened.equals(output)) {
-            throw new BuildException(
-                failMessage
-                + " "
-                + "got "
-                + flattened
-                + " "
-                + "expected "
-                + output);
-        }
-    }
-}
+/*
+ *  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.types.mappers;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.Mapper;
+import org.apache.tools.ant.util.FileNameMapper;
+
+/**
+ * This is a test task to show the result of a mapper
+ * on a specific input.
+ * (Test is not in the name of the class, to make sure that
+ * it is not treated as a unit test.
+ */
+
+public class MapperResult extends Task {
+
+    private String failMessage = "";
+    private String input;
+    private String output;
+    private FileNameMapper fileNameMapper;
+
+    /**
+     * The output on an empty string array
+     */
+    private static final String NULL_MAPPER_RESULT = "<NULL>";
+
+    public void setFailMessage(String failMessage) {
+        this.failMessage = failMessage;
+    }
+
+    public void setInput(String input) {
+        this.input = input;
+    }
+
+    public void setOutput(String output) {
+        this.output = output;
+    }
+
+    public void addConfiguredMapper(Mapper mapper) {
+        add(mapper.getImplementation());
+    }
+
+    public void add(FileNameMapper fileNameMapper) {
+        if (this.fileNameMapper != null) {
+            throw new BuildException("Only one mapper type nested element allowed");
+        }
+        this.fileNameMapper = fileNameMapper;
+    }
+
+    public void execute() {
+        if (input == null) {
+            throw new BuildException("Missing attribute 'input'");
+        }
+        if (output == null) {
+            throw new BuildException("Missing attribute 'output'");
+        }
+        if (fileNameMapper == null) {
+            throw new BuildException("Missing a nested file name mapper type element");
+        }
+        String[] result = fileNameMapper.mapFileName(input);
+        String flattened;
+        if (result == null) {
+            flattened = NULL_MAPPER_RESULT;
+        } else {
+            StringBuffer b = new StringBuffer();
+            for (int i = 0; i < result.length; ++i) {
+                if (i != 0) {
+                    b.append("|");
+                }
+                b.append(result[i]);
+            }
+            flattened = b.toString();
+        }
+        if (!flattened.equals(output)) {
+            throw new BuildException(
+                failMessage
+                + " "
+                + "got "
+                + flattened
+                + " "
+                + "expected "
+                + output);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/mappers/RegexpPatternMapperTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/mappers/RegexpPatternMapperTest.java b/src/tests/junit/org/apache/tools/ant/types/mappers/RegexpPatternMapperTest.java
index 5fa28e0..6d4d13a 100644
--- a/src/tests/junit/org/apache/tools/ant/types/mappers/RegexpPatternMapperTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/mappers/RegexpPatternMapperTest.java
@@ -1,51 +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.types.mappers;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-/**
- * Testcase for the &lt;regexpmapper&gt; mapper.
- *
- */
-public class RegexpPatternMapperTest {
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject("src/etc/testcases/types/mappers/regexpmapper.xml");
-    }
-
-    @Test
-    public void testIgnoreCase() {
-        buildRule.executeTarget("ignore.case");
-    }
-
-    @Test
-    public void testHandleDirSep() {
-        buildRule.executeTarget("handle.dirsep");
-    }
-}
-
-
+/*
+ *  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.types.mappers;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+/**
+ * Testcase for the &lt;regexpmapper&gt; mapper.
+ *
+ */
+public class RegexpPatternMapperTest {
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject("src/etc/testcases/types/mappers/regexpmapper.xml");
+    }
+
+    @Test
+    public void testIgnoreCase() {
+        buildRule.executeTarget("ignore.case");
+    }
+
+    @Test
+    public void testHandleDirSep() {
+        buildRule.executeTarget("handle.dirsep");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/optional/ScriptMapperTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/optional/ScriptMapperTest.java b/src/tests/junit/org/apache/tools/ant/types/optional/ScriptMapperTest.java
index 8bed46c..bf727db 100644
--- a/src/tests/junit/org/apache/tools/ant/types/optional/ScriptMapperTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/optional/ScriptMapperTest.java
@@ -1,53 +1,53 @@
-/*
- *  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.types.optional;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-/**
- * Test our script mapping
- */
-public class ScriptMapperTest {
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject("src/etc/testcases/types/mappers/scriptmapper.xml");
-    }
-
-    @Test
-    public void testClear() {
-        buildRule.executeTarget("testClear");
-    }
-
-    @Test
-    public void testSetMultiple() {
-        buildRule.executeTarget("testSetMultiple");
-    }
-
-    @Test
-    public void testPassthrough() {
-        buildRule.executeTarget("testPassthrough");
-    }
-}
+/*
+ *  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.types.optional;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+/**
+ * Test our script mapping
+ */
+public class ScriptMapperTest {
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject("src/etc/testcases/types/mappers/scriptmapper.xml");
+    }
+
+    @Test
+    public void testClear() {
+        buildRule.executeTarget("testClear");
+    }
+
+    @Test
+    public void testSetMultiple() {
+        buildRule.executeTarget("testSetMultiple");
+    }
+
+    @Test
+    public void testPassthrough() {
+        buildRule.executeTarget("testPassthrough");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/optional/ScriptSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/optional/ScriptSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/optional/ScriptSelectorTest.java
index c9cc655..304d6d0 100644
--- a/src/tests/junit/org/apache/tools/ant/types/optional/ScriptSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/optional/ScriptSelectorTest.java
@@ -1,83 +1,83 @@
-/*
- *  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.types.optional;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.apache.tools.ant.AntAssert.assertContains;
-import static org.junit.Assert.fail;
-
-/**
- * Test that scripting selection works. Needs scripting support to work
- */
-public class ScriptSelectorTest {
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject("src/etc/testcases/types/selectors/scriptselector.xml");
-    }
-
-    @Test
-    public void testNolanguage() {
-        try {
-            buildRule.executeTarget("testNolanguage");
-            fail("Absence of language attribute not detected");
-        } catch(BuildException ex) {
-            assertContains("script language must be specified", ex.getMessage());
-
-        }
-    }
-
-    @Test
-    public void testSelectionSetByDefault() {
-        buildRule.executeTarget("testSelectionSetByDefault");
-    }
-
-    @Test
-    public void testSelectionSetWorks() {
-        buildRule.executeTarget("testSelectionSetWorks");
-    }
-
-    @Test
-    public void testSelectionClearWorks() {
-        buildRule.executeTarget("testSelectionClearWorks");
-    }
-
-    @Test
-    public void testFilenameAttribute() {
-        buildRule.executeTarget("testFilenameAttribute");
-    }
-
-    @Test
-    public void testFileAttribute() {
-        buildRule.executeTarget("testFileAttribute");
-    }
-
-    @Test
-    public void testBasedirAttribute() {
-        buildRule.executeTarget("testBasedirAttribute");
-    }
-
-}
+/*
+ *  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.types.optional;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.apache.tools.ant.AntAssert.assertContains;
+import static org.junit.Assert.fail;
+
+/**
+ * Test that scripting selection works. Needs scripting support to work
+ */
+public class ScriptSelectorTest {
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject("src/etc/testcases/types/selectors/scriptselector.xml");
+    }
+
+    @Test
+    public void testNolanguage() {
+        try {
+            buildRule.executeTarget("testNolanguage");
+            fail("Absence of language attribute not detected");
+        } catch(BuildException ex) {
+            assertContains("script language must be specified", ex.getMessage());
+
+        }
+    }
+
+    @Test
+    public void testSelectionSetByDefault() {
+        buildRule.executeTarget("testSelectionSetByDefault");
+    }
+
+    @Test
+    public void testSelectionSetWorks() {
+        buildRule.executeTarget("testSelectionSetWorks");
+    }
+
+    @Test
+    public void testSelectionClearWorks() {
+        buildRule.executeTarget("testSelectionClearWorks");
+    }
+
+    @Test
+    public void testFilenameAttribute() {
+        buildRule.executeTarget("testFilenameAttribute");
+    }
+
+    @Test
+    public void testFileAttribute() {
+        buildRule.executeTarget("testFileAttribute");
+    }
+
+    @Test
+    public void testBasedirAttribute() {
+        buildRule.executeTarget("testBasedirAttribute");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/optional/depend/ClassFileSetTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/optional/depend/ClassFileSetTest.java b/src/tests/junit/org/apache/tools/ant/types/optional/depend/ClassFileSetTest.java
index 598d100..392667c 100644
--- a/src/tests/junit/org/apache/tools/ant/types/optional/depend/ClassFileSetTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/optional/depend/ClassFileSetTest.java
@@ -1,186 +1,186 @@
-/*
- *  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.types.optional.depend;
-
-import java.io.File;
-import java.util.Hashtable;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.apache.tools.ant.DirectoryScanner;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.types.FileSet;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Testcase for the Classfileset optional type.
- *
- */
-public class ClassFileSetTest {
-    public static final String RESULT_FILESET = "result";
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() {
-        // share the setup for testing the depend task
-        buildRule.configureProject("src/etc/testcases/taskdefs/optional/depend/depend.xml");
-    }
-
-    /**
-     * Test basic classfileset
-     */
-    @Test
-    public void testBasicSet() {
-        Project p = buildRule.getProject();
-        buildRule.executeTarget("testbasicset");
-        FileSet resultFileSet = (FileSet)p.getReference(RESULT_FILESET);
-        DirectoryScanner scanner = resultFileSet.getDirectoryScanner(p);
-        String[] scannedFiles = scanner.getIncludedFiles();
-        Hashtable files = new Hashtable();
-        for (int i = 0; i < scannedFiles.length; ++i) {
-            files.put(scannedFiles[i], scannedFiles[i]);
-        }
-        assertEquals("Classfileset did not pick up expected number of "
-            + "class files", 4, files.size());
-        assertTrue("Result did not contain A.class",
-            files.containsKey("A.class"));
-        assertTrue("Result did not contain B.class",
-            files.containsKey("B.class"));
-        assertTrue("Result did not contain C.class",
-            files.containsKey("C.class"));
-        assertTrue("Result did not contain D.class",
-            files.containsKey("D.class"));
-    }
-
-    /**
-     * Test small classfileset
-     */
-    @Test
-    public void testSmallSet() {
-        Project p = buildRule.getProject();
-        buildRule.executeTarget("testsmallset");
-        FileSet resultFileSet = (FileSet)p.getReference(RESULT_FILESET);
-        DirectoryScanner scanner = resultFileSet.getDirectoryScanner(p);
-        String[] scannedFiles = scanner.getIncludedFiles();
-        Hashtable files = new Hashtable();
-        for (int i = 0; i < scannedFiles.length; ++i) {
-            files.put(scannedFiles[i], scannedFiles[i]);
-        }
-        assertEquals("Classfileset did not pick up expected number of "
-            + "class files", 2, files.size());
-        assertTrue("Result did not contain B.class",
-            files.containsKey("B.class"));
-        assertTrue("Result did not contain C.class",
-            files.containsKey("C.class"));
-    }
-
-    /**
-     * Test combo classfileset
-     */
-    @Test
-    public void testComboSet() {
-        Project p = buildRule.getProject();
-        buildRule.executeTarget("testcomboset");
-        FileSet resultFileSet = (FileSet)p.getReference(RESULT_FILESET);
-        DirectoryScanner scanner = resultFileSet.getDirectoryScanner(p);
-        String[] scannedFiles = scanner.getIncludedFiles();
-        Hashtable files = new Hashtable();
-        for (int i = 0; i < scannedFiles.length; ++i) {
-            files.put(scannedFiles[i], scannedFiles[i]);
-        }
-        assertEquals("Classfileset did not pick up expected number of "
-            + "class files", 1, files.size());
-        assertTrue("Result did not contain C.class",
-            files.containsKey("C.class"));
-    }
-
-    /**
-     * Test that you can pass a classfileset by reference to a fileset.
-     */
-    @Test
-    public void testByReference() {
-        buildRule.executeTarget("testbyreference");
-    }
-
-    /**
-     * Test that classes included in a method "System.out.println(MyClass.class)" are included.
-     */
-    @Test
-    public void testMethodParam() {
-        Project p = buildRule.getProject();
-        buildRule.executeTarget("testmethodparam");
-        FileSet resultFileSet = (FileSet)p.getReference(RESULT_FILESET);
-        DirectoryScanner scanner = resultFileSet.getDirectoryScanner(p);
-        String[] scannedFiles = scanner.getIncludedFiles();
-        Hashtable files = new Hashtable();
-        for (int i = 0; i < scannedFiles.length; ++i) {
-            files.put(scannedFiles[i], scannedFiles[i]);
-        }
-        assertEquals("Classfileset did not pick up expected number of "
-            + "class files", 5, files.size());
-        assertTrue("Result did not contain A.class",
-            files.containsKey("A.class"));
-        assertTrue("Result did not contain B.class",
-            files.containsKey("B.class"));
-        assertTrue("Result did not contain C.class",
-            files.containsKey("C.class"));
-        assertTrue("Result did not contain D.class",
-            files.containsKey("D.class"));
-        assertTrue("Result did not contain E.class",
-            files.containsKey("E.class"));
-    }
-
-    /**
-     * Test that classes included in a method "System.out.println(Outer.Inner.class)" are included.
-     */
-    @Test
-    public void testMethodParamInner() {
-        Project p = buildRule.getProject();
-        buildRule.executeTarget("testmethodparaminner");
-        FileSet resultFileSet = (FileSet)p.getReference(RESULT_FILESET);
-        DirectoryScanner scanner = resultFileSet.getDirectoryScanner(p);
-        String[] scannedFiles = scanner.getIncludedFiles();
-        Hashtable files = new Hashtable();
-        for (int i = 0; i < scannedFiles.length; ++i) {
-            files.put(scannedFiles[i], scannedFiles[i]);
-        }
-        assertEquals("Classfileset did not pick up expected number of "
-            + "class files", 4, files.size());
-        assertTrue("Result did not contain test" + File.separator + "Outer$Inner.class",
-            files.containsKey("test" + File.separator + "Outer$Inner.class"));
-        assertTrue("Result did not contain test" + File.separator + "Outer.class",
-            files.containsKey("test" + File.separator + "Outer.class"));
-        assertTrue("Result did not contain test" + File.separator + "ContainsOnlyInner.class",
-            files.containsKey("test" + File.separator + "ContainsOnlyInner.class"));
-        assertTrue("Result did not contain test" + File.separator + "ContainsOnlyInner.class",
-            files.containsKey("test" + File.separator + "MethodParam.class"));
-    }
-
-    @Test
-    public void testResourceCollection() {
-        buildRule.executeTarget("testresourcecollection");
-    }
-
-}
+/*
+ *  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.types.optional.depend;
+
+import java.io.File;
+import java.util.Hashtable;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.FileSet;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Testcase for the Classfileset optional type.
+ *
+ */
+public class ClassFileSetTest {
+    public static final String RESULT_FILESET = "result";
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        // share the setup for testing the depend task
+        buildRule.configureProject("src/etc/testcases/taskdefs/optional/depend/depend.xml");
+    }
+
+    /**
+     * Test basic classfileset
+     */
+    @Test
+    public void testBasicSet() {
+        Project p = buildRule.getProject();
+        buildRule.executeTarget("testbasicset");
+        FileSet resultFileSet = (FileSet)p.getReference(RESULT_FILESET);
+        DirectoryScanner scanner = resultFileSet.getDirectoryScanner(p);
+        String[] scannedFiles = scanner.getIncludedFiles();
+        Hashtable files = new Hashtable();
+        for (int i = 0; i < scannedFiles.length; ++i) {
+            files.put(scannedFiles[i], scannedFiles[i]);
+        }
+        assertEquals("Classfileset did not pick up expected number of "
+            + "class files", 4, files.size());
+        assertTrue("Result did not contain A.class",
+            files.containsKey("A.class"));
+        assertTrue("Result did not contain B.class",
+            files.containsKey("B.class"));
+        assertTrue("Result did not contain C.class",
+            files.containsKey("C.class"));
+        assertTrue("Result did not contain D.class",
+            files.containsKey("D.class"));
+    }
+
+    /**
+     * Test small classfileset
+     */
+    @Test
+    public void testSmallSet() {
+        Project p = buildRule.getProject();
+        buildRule.executeTarget("testsmallset");
+        FileSet resultFileSet = (FileSet)p.getReference(RESULT_FILESET);
+        DirectoryScanner scanner = resultFileSet.getDirectoryScanner(p);
+        String[] scannedFiles = scanner.getIncludedFiles();
+        Hashtable files = new Hashtable();
+        for (int i = 0; i < scannedFiles.length; ++i) {
+            files.put(scannedFiles[i], scannedFiles[i]);
+        }
+        assertEquals("Classfileset did not pick up expected number of "
+            + "class files", 2, files.size());
+        assertTrue("Result did not contain B.class",
+            files.containsKey("B.class"));
+        assertTrue("Result did not contain C.class",
+            files.containsKey("C.class"));
+    }
+
+    /**
+     * Test combo classfileset
+     */
+    @Test
+    public void testComboSet() {
+        Project p = buildRule.getProject();
+        buildRule.executeTarget("testcomboset");
+        FileSet resultFileSet = (FileSet)p.getReference(RESULT_FILESET);
+        DirectoryScanner scanner = resultFileSet.getDirectoryScanner(p);
+        String[] scannedFiles = scanner.getIncludedFiles();
+        Hashtable files = new Hashtable();
+        for (int i = 0; i < scannedFiles.length; ++i) {
+            files.put(scannedFiles[i], scannedFiles[i]);
+        }
+        assertEquals("Classfileset did not pick up expected number of "
+            + "class files", 1, files.size());
+        assertTrue("Result did not contain C.class",
+            files.containsKey("C.class"));
+    }
+
+    /**
+     * Test that you can pass a classfileset by reference to a fileset.
+     */
+    @Test
+    public void testByReference() {
+        buildRule.executeTarget("testbyreference");
+    }
+
+    /**
+     * Test that classes included in a method "System.out.println(MyClass.class)" are included.
+     */
+    @Test
+    public void testMethodParam() {
+        Project p = buildRule.getProject();
+        buildRule.executeTarget("testmethodparam");
+        FileSet resultFileSet = (FileSet)p.getReference(RESULT_FILESET);
+        DirectoryScanner scanner = resultFileSet.getDirectoryScanner(p);
+        String[] scannedFiles = scanner.getIncludedFiles();
+        Hashtable files = new Hashtable();
+        for (int i = 0; i < scannedFiles.length; ++i) {
+            files.put(scannedFiles[i], scannedFiles[i]);
+        }
+        assertEquals("Classfileset did not pick up expected number of "
+            + "class files", 5, files.size());
+        assertTrue("Result did not contain A.class",
+            files.containsKey("A.class"));
+        assertTrue("Result did not contain B.class",
+            files.containsKey("B.class"));
+        assertTrue("Result did not contain C.class",
+            files.containsKey("C.class"));
+        assertTrue("Result did not contain D.class",
+            files.containsKey("D.class"));
+        assertTrue("Result did not contain E.class",
+            files.containsKey("E.class"));
+    }
+
+    /**
+     * Test that classes included in a method "System.out.println(Outer.Inner.class)" are included.
+     */
+    @Test
+    public void testMethodParamInner() {
+        Project p = buildRule.getProject();
+        buildRule.executeTarget("testmethodparaminner");
+        FileSet resultFileSet = (FileSet)p.getReference(RESULT_FILESET);
+        DirectoryScanner scanner = resultFileSet.getDirectoryScanner(p);
+        String[] scannedFiles = scanner.getIncludedFiles();
+        Hashtable files = new Hashtable();
+        for (int i = 0; i < scannedFiles.length; ++i) {
+            files.put(scannedFiles[i], scannedFiles[i]);
+        }
+        assertEquals("Classfileset did not pick up expected number of "
+            + "class files", 4, files.size());
+        assertTrue("Result did not contain test" + File.separator + "Outer$Inner.class",
+            files.containsKey("test" + File.separator + "Outer$Inner.class"));
+        assertTrue("Result did not contain test" + File.separator + "Outer.class",
+            files.containsKey("test" + File.separator + "Outer.class"));
+        assertTrue("Result did not contain test" + File.separator + "ContainsOnlyInner.class",
+            files.containsKey("test" + File.separator + "ContainsOnlyInner.class"));
+        assertTrue("Result did not contain test" + File.separator + "ContainsOnlyInner.class",
+            files.containsKey("test" + File.separator + "MethodParam.class"));
+    }
+
+    @Test
+    public void testResourceCollection() {
+        buildRule.executeTarget("testresourcecollection");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/resources/FileResourceTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/resources/FileResourceTest.java b/src/tests/junit/org/apache/tools/ant/types/resources/FileResourceTest.java
index c6413ea..10fa131 100644
--- a/src/tests/junit/org/apache/tools/ant/types/resources/FileResourceTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/resources/FileResourceTest.java
@@ -1,137 +1,137 @@
-/*
- *  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.types.resources;
-
-import java.io.File;
-
-import org.apache.tools.ant.Project;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-
-/**
- * Test Java API of {@link FileResource}.
- */
-public class FileResourceTest {
-
-    private File root;
-
-    @Before
-    public void setUp() {
-        root = new File(System.getProperty("root"));
-    }
-
-    @Test
-    public void testAttributes() {
-        FileResource f = new FileResource();
-        f.setBaseDir(root);
-        f.setName("foo");
-        assertEquals(new File(root, "foo"), f.getFile());
-        assertEquals(root, f.getBaseDir());
-        assertEquals("foo", f.getName());
-    }
-
-    @Test
-    public void testNonImmediateBasedir() {
-        FileResource f = new FileResource();
-        f.setBaseDir(root);
-        f.setName("foo/bar");
-        assertEquals(new File(root, "foo/bar"), f.getFile());
-        assertEquals(root, f.getBaseDir());
-        assertEquals("foo/bar", f.getName().replace(File.separatorChar, '/'));
-    }
-
-    @Test
-    public void testFile() {
-        FileResource f = new FileResource(new File(root, "foo"));
-        assertEquals(new File(root, "foo"), f.getFile());
-        assertEquals(root, f.getBaseDir());
-        assertEquals("foo", f.getName());
-    }
-
-    @Test
-    public void testBasedirAndName() {
-        FileResource f = new FileResource(root, "foo");
-        assertEquals(new File(root, "foo"), f.getFile());
-        assertEquals(root, f.getBaseDir());
-        assertEquals("foo", f.getName());
-    }
-
-    @Test
-    public void testNonImmediateBasedirAndName() {
-        FileResource f = new FileResource(root, "foo/bar");
-        assertEquals(new File(root, "foo/bar"), f.getFile());
-        assertEquals(root, f.getBaseDir());
-        assertEquals("foo/bar", f.getName().replace(File.separatorChar, '/'));
-    }
-
-    @Test
-    public void testProjectAndFilename() {
-        Project p = new Project();
-        p.setBaseDir(root);
-        FileResource f = new FileResource(p, "foo");
-        assertEquals(new File(root, "foo"), f.getFile());
-        assertEquals(root, f.getBaseDir());
-        assertEquals("foo", f.getName());
-    }
-
-    @Test
-    public void testRelativeFactoryResource() {
-        FileResource f = new FileResource(root, "foo");
-        FileResource relative = f.getResource("bar").as(FileResource.class);
-        assertEquals(new File(root, "foo/bar"), relative.getFile());
-        assertEquals("foo/bar", relative.getName().replace(File.separatorChar, '/'));
-        assertEquals(root, relative.getBaseDir());
-    }
-
-    @Test
-    public void testAbsoluteFactoryResource() {
-        FileResource f = new FileResource(new File(root, "foo/a"));
-        assertEquals(new File(root, "foo"), f.getBaseDir());
-        File bar = new File(root, "bar");
-        FileResource fromFactory = f.getResource(bar.getAbsolutePath()).as(FileResource.class);
-        assertEquals(bar, fromFactory.getFile());
-        assertEquals(root, fromFactory.getBaseDir());
-    }
-
-    @Test
-    public void testParentSiblingFactoryResource() {
-        FileResource f = new FileResource(new File(root, "foo/a"));
-        assertEquals(new File(root, "foo"), f.getBaseDir());
-        FileResource parentSibling = f.getResource("../../bar").as(FileResource.class);
-        assertEquals(root, parentSibling.getBaseDir());
-        assertEquals("bar", parentSibling.getName());
-    }
-
-    @Test
-    public void testEqualsUsesFiles() {
-        FileResource f1 = new FileResource(new File(root, "foo/a"));
-        FileResource f2 = new FileResource(new File(root + "/foo"), "a");
-        assertEquals(f1, f2);
-    }
-
-    @Test
-    public void testEqualsUsesRelativeNames() {
-        FileResource f1 = new FileResource(root, "foo/a");
-        FileResource f2 = new FileResource(new File(root + "/foo"), "a");
-        assertNotEquals(f1, f2);
-    }
-}
+/*
+ *  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.types.resources;
+
+import java.io.File;
+
+import org.apache.tools.ant.Project;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
+/**
+ * Test Java API of {@link FileResource}.
+ */
+public class FileResourceTest {
+
+    private File root;
+
+    @Before
+    public void setUp() {
+        root = new File(System.getProperty("root"));
+    }
+
+    @Test
+    public void testAttributes() {
+        FileResource f = new FileResource();
+        f.setBaseDir(root);
+        f.setName("foo");
+        assertEquals(new File(root, "foo"), f.getFile());
+        assertEquals(root, f.getBaseDir());
+        assertEquals("foo", f.getName());
+    }
+
+    @Test
+    public void testNonImmediateBasedir() {
+        FileResource f = new FileResource();
+        f.setBaseDir(root);
+        f.setName("foo/bar");
+        assertEquals(new File(root, "foo/bar"), f.getFile());
+        assertEquals(root, f.getBaseDir());
+        assertEquals("foo/bar", f.getName().replace(File.separatorChar, '/'));
+    }
+
+    @Test
+    public void testFile() {
+        FileResource f = new FileResource(new File(root, "foo"));
+        assertEquals(new File(root, "foo"), f.getFile());
+        assertEquals(root, f.getBaseDir());
+        assertEquals("foo", f.getName());
+    }
+
+    @Test
+    public void testBasedirAndName() {
+        FileResource f = new FileResource(root, "foo");
+        assertEquals(new File(root, "foo"), f.getFile());
+        assertEquals(root, f.getBaseDir());
+        assertEquals("foo", f.getName());
+    }
+
+    @Test
+    public void testNonImmediateBasedirAndName() {
+        FileResource f = new FileResource(root, "foo/bar");
+        assertEquals(new File(root, "foo/bar"), f.getFile());
+        assertEquals(root, f.getBaseDir());
+        assertEquals("foo/bar", f.getName().replace(File.separatorChar, '/'));
+    }
+
+    @Test
+    public void testProjectAndFilename() {
+        Project p = new Project();
+        p.setBaseDir(root);
+        FileResource f = new FileResource(p, "foo");
+        assertEquals(new File(root, "foo"), f.getFile());
+        assertEquals(root, f.getBaseDir());
+        assertEquals("foo", f.getName());
+    }
+
+    @Test
+    public void testRelativeFactoryResource() {
+        FileResource f = new FileResource(root, "foo");
+        FileResource relative = f.getResource("bar").as(FileResource.class);
+        assertEquals(new File(root, "foo/bar"), relative.getFile());
+        assertEquals("foo/bar", relative.getName().replace(File.separatorChar, '/'));
+        assertEquals(root, relative.getBaseDir());
+    }
+
+    @Test
+    public void testAbsoluteFactoryResource() {
+        FileResource f = new FileResource(new File(root, "foo/a"));
+        assertEquals(new File(root, "foo"), f.getBaseDir());
+        File bar = new File(root, "bar");
+        FileResource fromFactory = f.getResource(bar.getAbsolutePath()).as(FileResource.class);
+        assertEquals(bar, fromFactory.getFile());
+        assertEquals(root, fromFactory.getBaseDir());
+    }
+
+    @Test
+    public void testParentSiblingFactoryResource() {
+        FileResource f = new FileResource(new File(root, "foo/a"));
+        assertEquals(new File(root, "foo"), f.getBaseDir());
+        FileResource parentSibling = f.getResource("../../bar").as(FileResource.class);
+        assertEquals(root, parentSibling.getBaseDir());
+        assertEquals("bar", parentSibling.getName());
+    }
+
+    @Test
+    public void testEqualsUsesFiles() {
+        FileResource f1 = new FileResource(new File(root, "foo/a"));
+        FileResource f2 = new FileResource(new File(root + "/foo"), "a");
+        assertEquals(f1, f2);
+    }
+
+    @Test
+    public void testEqualsUsesRelativeNames() {
+        FileResource f1 = new FileResource(root, "foo/a");
+        FileResource f2 = new FileResource(new File(root + "/foo"), "a");
+        assertNotEquals(f1, f2);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/resources/JavaResourceTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/resources/JavaResourceTest.java b/src/tests/junit/org/apache/tools/ant/types/resources/JavaResourceTest.java
index f68e9e6..a67db39 100644
--- a/src/tests/junit/org/apache/tools/ant/types/resources/JavaResourceTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/resources/JavaResourceTest.java
@@ -1,62 +1,62 @@
-/*
- *  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.types.resources;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
-public class JavaResourceTest {
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject("src/etc/testcases/types/resources/javaresource.xml");
-    }
-
-    @Test
-    public void testLoadManifest() {
-        buildRule.executeTarget("loadManifest");
-        assertNotNull(buildRule.getProject().getProperty("manifest"));
-
-        // this actually relies on the first manifest being found on
-        // the classpath (probably rt.jar's) being valid
-        assertTrue(buildRule.getProject().getProperty("manifest")
-                   .startsWith("Manifest-Version:"));
-    }
-
-    @Test
-    public void testIsURLProvider() {
-        JavaResource r = new JavaResource();
-        assertSame(r, r.as(URLProvider.class));
-    }
-
-    @Test
-    public void testGetURLOfManifest() {
-        JavaResource r = new JavaResource();
-        r.setName("META-INF/MANIFEST.MF");
-        assertNotNull(r.getURL());
-    }
-}
+/*
+ *  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.types.resources;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+public class JavaResourceTest {
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject("src/etc/testcases/types/resources/javaresource.xml");
+    }
+
+    @Test
+    public void testLoadManifest() {
+        buildRule.executeTarget("loadManifest");
+        assertNotNull(buildRule.getProject().getProperty("manifest"));
+
+        // this actually relies on the first manifest being found on
+        // the classpath (probably rt.jar's) being valid
+        assertTrue(buildRule.getProject().getProperty("manifest")
+                   .startsWith("Manifest-Version:"));
+    }
+
+    @Test
+    public void testIsURLProvider() {
+        JavaResource r = new JavaResource();
+        assertSame(r, r.as(URLProvider.class));
+    }
+
+    @Test
+    public void testGetURLOfManifest() {
+        JavaResource r = new JavaResource();
+        r.setName("META-INF/MANIFEST.MF");
+        assertNotNull(r.getURL());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/resources/MultiRootFileSetTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/resources/MultiRootFileSetTest.java b/src/tests/junit/org/apache/tools/ant/types/resources/MultiRootFileSetTest.java
index c11ba73..6c05963 100644
--- a/src/tests/junit/org/apache/tools/ant/types/resources/MultiRootFileSetTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/resources/MultiRootFileSetTest.java
@@ -1,131 +1,131 @@
-/*
- *  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.types.resources;
-
-import java.io.File;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.types.AbstractFileSet;
-import org.apache.tools.ant.types.AbstractFileSetTest;
-import org.apache.tools.ant.types.Reference;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-/**
- * This doesn't actually test much, mainly reference handling.
- */
-public class MultiRootFileSetTest extends AbstractFileSetTest {
-
-
-    protected AbstractFileSet getInstance() {
-        return new MultiRootFileSet() {
-            // overriding so set/getDir works as expected by the base test class
-            private File dir;
-            public void setDir(File dir) {
-                if (isReference()) {
-                    throw tooManyAttributes();
-                }
-                this.dir = dir;
-            }
-
-            public synchronized File getDir(Project p) {
-                if (isReference()) {
-                    return getRef(p).getDir(p);
-                }
-                dieOnCircularReference();
-                return dir;
-            }
-        };
-    }
-
-    @Test
-    public void testEmptyElementIfIsReferenceAdditionalAttributes() {
-        MultiRootFileSet f = new MultiRootFileSet();
-        f.setProject(getProject());
-        f.setBaseDirs("a");
-        try {
-            f.setRefid(new Reference(getProject(), "dummyref"));
-            fail("Can add reference to multirootfileset "
-                 + " with elements from setBasedirs");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute "
-                         + "when using refid", be.getMessage());
-        }
-        f = new MultiRootFileSet();
-        f.addConfiguredBaseDir(new FileResource(new File(".")));
-        try {
-            f.setRefid(new Reference(getProject(), "dummyref"));
-            fail("Can add reference to multirootfileset"
-                 + " with elements from addConfiguredBaseDir");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute "
-                         + "when using refid", be.getMessage());
-        }
-
-        f = new MultiRootFileSet();
-        f.setRefid(new Reference(getProject(), "dummyref"));
-        try {
-            f.setBaseDirs("a");
-            fail("Can set basedirs in multirootfileset"
-                 + " that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute "
-                         + "when using refid", be.getMessage());
-        }
-        try {
-            f.setCache(true);
-            fail("Can set cache in multirootfileset"
-                 + " that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute "
-                         + "when using refid", be.getMessage());
-        }
-        try {
-            f.setType(MultiRootFileSet.SetType.file);
-            fail("Can set type in multirootfileset"
-                 + " that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute "
-                         + "when using refid", be.getMessage());
-        }
-        try {
-            f.addConfiguredBaseDir(new FileResource(new File(".")));
-            fail("Can add nested basedir in multirootfileset "
-                 + " that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify nested elements when using "
-                         + "refid", be.getMessage());
-        }
-    }
-
-    @Test
-    public void testDirCannotBeSet() {
-        try {
-            new MultiRootFileSet().setDir(new File("."));
-            fail("Can set dir in a multirootfileset");
-        } catch (BuildException e) {
-            assertTrue(e.getMessage()
-                       .endsWith(" doesn't support the dir attribute"));
-        }
-    }
-}
+/*
+ *  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.types.resources;
+
+import java.io.File;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.AbstractFileSet;
+import org.apache.tools.ant.types.AbstractFileSetTest;
+import org.apache.tools.ant.types.Reference;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * This doesn't actually test much, mainly reference handling.
+ */
+public class MultiRootFileSetTest extends AbstractFileSetTest {
+
+
+    protected AbstractFileSet getInstance() {
+        return new MultiRootFileSet() {
+            // overriding so set/getDir works as expected by the base test class
+            private File dir;
+            public void setDir(File dir) {
+                if (isReference()) {
+                    throw tooManyAttributes();
+                }
+                this.dir = dir;
+            }
+
+            public synchronized File getDir(Project p) {
+                if (isReference()) {
+                    return getRef(p).getDir(p);
+                }
+                dieOnCircularReference();
+                return dir;
+            }
+        };
+    }
+
+    @Test
+    public void testEmptyElementIfIsReferenceAdditionalAttributes() {
+        MultiRootFileSet f = new MultiRootFileSet();
+        f.setProject(getProject());
+        f.setBaseDirs("a");
+        try {
+            f.setRefid(new Reference(getProject(), "dummyref"));
+            fail("Can add reference to multirootfileset "
+                 + " with elements from setBasedirs");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute "
+                         + "when using refid", be.getMessage());
+        }
+        f = new MultiRootFileSet();
+        f.addConfiguredBaseDir(new FileResource(new File(".")));
+        try {
+            f.setRefid(new Reference(getProject(), "dummyref"));
+            fail("Can add reference to multirootfileset"
+                 + " with elements from addConfiguredBaseDir");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute "
+                         + "when using refid", be.getMessage());
+        }
+
+        f = new MultiRootFileSet();
+        f.setRefid(new Reference(getProject(), "dummyref"));
+        try {
+            f.setBaseDirs("a");
+            fail("Can set basedirs in multirootfileset"
+                 + " that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute "
+                         + "when using refid", be.getMessage());
+        }
+        try {
+            f.setCache(true);
+            fail("Can set cache in multirootfileset"
+                 + " that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute "
+                         + "when using refid", be.getMessage());
+        }
+        try {
+            f.setType(MultiRootFileSet.SetType.file);
+            fail("Can set type in multirootfileset"
+                 + " that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute "
+                         + "when using refid", be.getMessage());
+        }
+        try {
+            f.addConfiguredBaseDir(new FileResource(new File(".")));
+            fail("Can add nested basedir in multirootfileset "
+                 + " that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify nested elements when using "
+                         + "refid", be.getMessage());
+        }
+    }
+
+    @Test
+    public void testDirCannotBeSet() {
+        try {
+            new MultiRootFileSet().setDir(new File("."));
+            fail("Can set dir in a multirootfileset");
+        } catch (BuildException e) {
+            assertTrue(e.getMessage()
+                       .endsWith(" doesn't support the dir attribute"));
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/resources/ResourceListTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/resources/ResourceListTest.java b/src/tests/junit/org/apache/tools/ant/types/resources/ResourceListTest.java
index a45e184..f020178 100644
--- a/src/tests/junit/org/apache/tools/ant/types/resources/ResourceListTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/resources/ResourceListTest.java
@@ -1,134 +1,134 @@
-/*
- *  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.types.resources;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.BuildFileRule;
-import org.apache.tools.ant.types.FilterChain;
-import org.apache.tools.ant.types.Reference;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-public class ResourceListTest {
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() throws Exception {
-        buildRule.configureProject("src/etc/testcases/types/resources/resourcelist.xml");
-    }
-
-    @After
-    public void tearDown() throws Exception {
-        buildRule.executeTarget("tearDown");
-    }
-
-    @Test
-    public void testEmptyElementWithReference() {
-        ResourceList rl = new ResourceList();
-        rl.setEncoding("foo");
-        try {
-            rl.setRefid(new Reference(buildRule.getProject(), "dummyref"));
-            fail("Can add reference to ResourceList with encoding attribute set.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute when using refid",
-                         be.getMessage());
-        }
-
-        rl = new ResourceList();
-        rl.setRefid(new Reference(buildRule.getProject(), "dummyref"));
-        try {
-            rl.setEncoding("foo");
-            fail("Can set encoding in ResourceList that is a reference");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute when using refid",
-                         be.getMessage());
-        }
-
-        rl = new ResourceList();
-        rl.add(new FileResource(buildRule.getProject(), "."));
-        try {
-            rl.setRefid(new Reference(buildRule.getProject(), "dummyref"));
-            fail("Can add reference to ResourceList with nested resource collection.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify nested elements when using refid",
-                         be.getMessage());
-        }
-
-        rl = new ResourceList();
-        rl.setRefid(new Reference(buildRule.getProject(), "dummyref"));
-        try {
-            rl.add(new FileResource(buildRule.getProject(), "."));
-            fail("Can add reference to ResourceList with nested resource collection.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify nested elements when using refid",
-                         be.getMessage());
-        }
-
-        rl = new ResourceList();
-        rl.addFilterChain(new FilterChain());
-        try {
-            rl.setRefid(new Reference(buildRule.getProject(), "dummyref"));
-            fail("Can add reference to ResourceList with nested filter chain.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify nested elements when using refid",
-                         be.getMessage());
-        }
-
-        rl = new ResourceList();
-        rl.setRefid(new Reference(buildRule.getProject(), "dummyref"));
-        try {
-            rl.addFilterChain(new FilterChain());
-            fail("Can add reference to ResourceList with nested filter chain.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify nested elements when using refid",
-                         be.getMessage());
-        }
-    }
-
-    @Test
-    public void testCircularReference() throws Exception {
-        ResourceList rl1 = new ResourceList();
-        rl1.setProject(buildRule.getProject());
-        rl1.setRefid(new Reference(buildRule.getProject(), "foo"));
-
-        ResourceList rl2 = new ResourceList();
-        rl2.setProject(buildRule.getProject());
-        buildRule.getProject().addReference("foo", rl2);
-
-        Union u = new Union();
-        u.add(rl1);
-        u.setProject(buildRule.getProject());
-
-        rl2.add(u);
-
-        try {
-            rl2.size();
-            fail("Can make ResourceList a Reference to itself.");
-        } catch (BuildException be) {
-            assertEquals("This data type contains a circular reference.",
-                         be.getMessage());
-        }
-    }
-}
+/*
+ *  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.types.resources;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileRule;
+import org.apache.tools.ant.types.FilterChain;
+import org.apache.tools.ant.types.Reference;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+public class ResourceListTest {
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() throws Exception {
+        buildRule.configureProject("src/etc/testcases/types/resources/resourcelist.xml");
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        buildRule.executeTarget("tearDown");
+    }
+
+    @Test
+    public void testEmptyElementWithReference() {
+        ResourceList rl = new ResourceList();
+        rl.setEncoding("foo");
+        try {
+            rl.setRefid(new Reference(buildRule.getProject(), "dummyref"));
+            fail("Can add reference to ResourceList with encoding attribute set.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute when using refid",
+                         be.getMessage());
+        }
+
+        rl = new ResourceList();
+        rl.setRefid(new Reference(buildRule.getProject(), "dummyref"));
+        try {
+            rl.setEncoding("foo");
+            fail("Can set encoding in ResourceList that is a reference");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute when using refid",
+                         be.getMessage());
+        }
+
+        rl = new ResourceList();
+        rl.add(new FileResource(buildRule.getProject(), "."));
+        try {
+            rl.setRefid(new Reference(buildRule.getProject(), "dummyref"));
+            fail("Can add reference to ResourceList with nested resource collection.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify nested elements when using refid",
+                         be.getMessage());
+        }
+
+        rl = new ResourceList();
+        rl.setRefid(new Reference(buildRule.getProject(), "dummyref"));
+        try {
+            rl.add(new FileResource(buildRule.getProject(), "."));
+            fail("Can add reference to ResourceList with nested resource collection.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify nested elements when using refid",
+                         be.getMessage());
+        }
+
+        rl = new ResourceList();
+        rl.addFilterChain(new FilterChain());
+        try {
+            rl.setRefid(new Reference(buildRule.getProject(), "dummyref"));
+            fail("Can add reference to ResourceList with nested filter chain.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify nested elements when using refid",
+                         be.getMessage());
+        }
+
+        rl = new ResourceList();
+        rl.setRefid(new Reference(buildRule.getProject(), "dummyref"));
+        try {
+            rl.addFilterChain(new FilterChain());
+            fail("Can add reference to ResourceList with nested filter chain.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify nested elements when using refid",
+                         be.getMessage());
+        }
+    }
+
+    @Test
+    public void testCircularReference() throws Exception {
+        ResourceList rl1 = new ResourceList();
+        rl1.setProject(buildRule.getProject());
+        rl1.setRefid(new Reference(buildRule.getProject(), "foo"));
+
+        ResourceList rl2 = new ResourceList();
+        rl2.setProject(buildRule.getProject());
+        buildRule.getProject().addReference("foo", rl2);
+
+        Union u = new Union();
+        u.add(rl1);
+        u.setProject(buildRule.getProject());
+
+        rl2.add(u);
+
+        try {
+            rl2.size();
+            fail("Can make ResourceList a Reference to itself.");
+        } catch (BuildException be) {
+            assertEquals("This data type contains a circular reference.",
+                         be.getMessage());
+        }
+    }
+}


[19/21] ant git commit: Normalise tabulation and line breaks

Posted by gi...@apache.org.
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java
index 2f351d4..0b301f9 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java
@@ -1,266 +1,265 @@
-/*
- *  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;
-
-import static org.apache.tools.ant.AntAssert.assertContains;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.BuildFileRule;
-import org.apache.tools.ant.util.regexp.RegexpMatcherFactory;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-/**
- * Tests the EchoProperties task.
- *
- * @created   17-Jan-2002
- * @since     Ant 1.5
- */
-public class EchoPropertiesTest {
-
-    private final static String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/";
-    private static final String GOOD_OUTFILE = "test.properties";
-    private static final String GOOD_OUTFILE_XML = "test.xml";
-    private static final String PREFIX_OUTFILE = "test-prefix.properties";
-    private static final String TEST_VALUE = "isSet";
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject(TASKDEFS_DIR + "echoproperties.xml");
-        buildRule.getProject().setProperty("test.property", TEST_VALUE);
-    }
-
-
-    @After
-    public void tearDown() {
-        buildRule.executeTarget("cleanup");
-    }
-
-
-    @Test
-    public void testEchoToLog() {
-    	buildRule.executeTarget("testEchoToLog");
-    	assertContains("test.property=" + TEST_VALUE, buildRule.getLog());
-    }
-
-    @Test
-    public void testEchoWithEmptyPrefixToLog() {
-    	buildRule.executeTarget("testEchoWithEmptyPrefixToLog");
-    	assertContains("test.property="+TEST_VALUE, buildRule.getLog());
-    }
-
-
-    @Test
-    public void testReadBadFile() {
-    	try {
-    		buildRule.executeTarget("testReadBadFile");
-    		fail("BuildException should have been thrown on bad file");
-    	}
-    	catch(BuildException ex) {
-    		assertContains("srcfile is a directory","srcfile is a directory!", ex.getMessage());
-    	}
-    }
-
-    @Test
-    public void testReadBadFileNoFail() {
-        buildRule.executeTarget("testReadBadFileNoFail");
-        assertContains("srcfile is a directory!", buildRule.getLog());
-    }
-
-
-    @Test
-    public void testEchoToBadFile() {
-    	try {
-    		buildRule.executeTarget("testEchoToBadFile");
-            fail("BuildException should have been thrown on destination file being a directory");
-    	} catch(BuildException ex) {
-    		assertContains("destfile is a directory", "destfile is a directory!", ex.getMessage());
-    	}
-    }
-
-
-    @Test
-    public void testEchoToBadFileNoFail() {
-    	buildRule.executeTarget("testEchoToBadFileNoFail");
-    	assertContains("destfile is a directory!", buildRule.getLog());
-    }
-
-
-    @Test
-    public void testEchoToGoodFile() throws Exception {
-        buildRule.executeTarget("testEchoToGoodFile");
-        assertGoodFile();
-    }
-
-
-    @Test
-    public void testEchoToGoodFileXml() throws Exception {
-        buildRule.executeTarget("testEchoToGoodFileXml");
-
-        // read in the file
-        File f = createRelativeFile(GOOD_OUTFILE_XML);
-        FileReader fr = new FileReader(f);
-        BufferedReader br = new BufferedReader(fr);
-        try {
-            String read = null;
-            while ((read = br.readLine()) != null) {
-                if (read.indexOf("<property name=\"test.property\" value=\""+TEST_VALUE+"\" />") >= 0) {
-                    // found the property we set - it's good.
-                    return;
-                }
-            }
-            fail("did not encounter set property in generated file.");
-        } finally {
-            try {
-                fr.close();
-            } catch(IOException e) {}
-            try {
-                br.close();
-            } catch(IOException e) {}
-        }
-    }
-
-
-    @Test
-    public void testEchoToGoodFileFail() throws Exception {
-        buildRule.executeTarget("testEchoToGoodFileFail");
-        assertGoodFile();
-    }
-
-
-    @Test
-    public void testEchoToGoodFileNoFail() throws Exception {
-        buildRule.executeTarget("testEchoToGoodFileNoFail");
-        assertGoodFile();
-    }
-
-    @Test
-    public void testEchoPrefix() throws Exception {
-        testEchoPrefixVarious("testEchoPrefix");
-    }
-
-    @Test
-    public void testEchoPrefixAsPropertyset() throws Exception {
-        testEchoPrefixVarious("testEchoPrefixAsPropertyset");
-    }
-
-    @Test
-    public void testEchoPrefixAsNegatedPropertyset() throws Exception {
-        testEchoPrefixVarious("testEchoPrefixAsNegatedPropertyset");
-    }
-
-    @Test
-    public void testEchoPrefixAsDoublyNegatedPropertyset() throws Exception {
-        testEchoPrefixVarious("testEchoPrefixAsDoublyNegatedPropertyset");
-    }
-
-    @Test
-    public void testWithPrefixAndRegex() throws Exception {
-    	try {
-    		buildRule.executeTarget("testWithPrefixAndRegex");
-    		fail("BuildException should have been thrown on Prefix and RegEx beng set");
-    	} catch (BuildException ex) {
-    		assertEquals("The target must fail with prefix and regex attributes set", "Please specify either prefix or regex, but not both", ex.getMessage());
-    	}
-    }
-
-    @Test
-    public void testWithEmptyPrefixAndRegex() throws Exception {
-    	buildRule.executeTarget("testEchoWithEmptyPrefixToLog");
-    	assertContains("test.property="+TEST_VALUE, buildRule.getLog());
-    }
-
-    @Test
-    public void testWithRegex() throws Exception {
-        assumeTrue("Test skipped because no regexp matcher is present.", RegexpMatcherFactory.regexpMatcherPresent(buildRule.getProject()));
-        buildRule.executeTarget("testWithRegex");
-        // the following line has been changed from checking ant.home to ant.version so the test will still work when run outside of an ant script
-        assertContains("ant.version=", buildRule.getFullLog());
-    }
-
-    private void testEchoPrefixVarious(String target) throws Exception {
-        buildRule.executeTarget(target);
-        Properties props = loadPropFile(PREFIX_OUTFILE);
-        assertEquals("prefix didn't include 'a.set' property",
-            "true", props.getProperty("a.set"));
-        assertNull("prefix failed to filter out property 'b.set'",
-            props.getProperty("b.set"));
-    }
-
-    protected Properties loadPropFile(String relativeFilename)
-            throws IOException {
-        File f = createRelativeFile(relativeFilename);
-        Properties props=new Properties();
-        InputStream in=null;
-        try  {
-            in=new BufferedInputStream(new FileInputStream(f));
-            props.load(in);
-        } finally {
-            if(in!=null) {
-                try { in.close(); } catch(IOException e) {}
-            }
-        }
-        return props;
-    }
-
-    protected void assertGoodFile() throws Exception {
-        File f = createRelativeFile(GOOD_OUTFILE);
-        assertTrue("Did not create "+f.getAbsolutePath(),
-            f.exists());
-        Properties props=loadPropFile(GOOD_OUTFILE);
-        props.list(System.out);
-        assertEquals("test property not found ",
-                     TEST_VALUE, props.getProperty("test.property"));
-    }
-
-
-    protected String toAbsolute(String filename) {
-        return createRelativeFile(filename).getAbsolutePath();
-    }
-
-
-    protected File createRelativeFile(String filename) {
-        if (filename.equals(".")) {
-            return buildRule.getProject().getBaseDir();
-        }
-        // else
-        return new File(buildRule.getProject().getBaseDir(), filename);
-    }
-}
-
+/*
+ *  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;
+
+import static org.apache.tools.ant.AntAssert.assertContains;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileRule;
+import org.apache.tools.ant.util.regexp.RegexpMatcherFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+/**
+ * Tests the EchoProperties task.
+ *
+ * @created   17-Jan-2002
+ * @since     Ant 1.5
+ */
+public class EchoPropertiesTest {
+
+    private final static String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/";
+    private static final String GOOD_OUTFILE = "test.properties";
+    private static final String GOOD_OUTFILE_XML = "test.xml";
+    private static final String PREFIX_OUTFILE = "test-prefix.properties";
+    private static final String TEST_VALUE = "isSet";
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject(TASKDEFS_DIR + "echoproperties.xml");
+        buildRule.getProject().setProperty("test.property", TEST_VALUE);
+    }
+
+
+    @After
+    public void tearDown() {
+        buildRule.executeTarget("cleanup");
+    }
+
+
+    @Test
+    public void testEchoToLog() {
+        buildRule.executeTarget("testEchoToLog");
+        assertContains("test.property=" + TEST_VALUE, buildRule.getLog());
+    }
+
+    @Test
+    public void testEchoWithEmptyPrefixToLog() {
+        buildRule.executeTarget("testEchoWithEmptyPrefixToLog");
+        assertContains("test.property="+TEST_VALUE, buildRule.getLog());
+    }
+
+
+    @Test
+    public void testReadBadFile() {
+        try {
+            buildRule.executeTarget("testReadBadFile");
+            fail("BuildException should have been thrown on bad file");
+        }
+        catch(BuildException ex) {
+            assertContains("srcfile is a directory","srcfile is a directory!", ex.getMessage());
+        }
+    }
+
+    @Test
+    public void testReadBadFileNoFail() {
+        buildRule.executeTarget("testReadBadFileNoFail");
+        assertContains("srcfile is a directory!", buildRule.getLog());
+    }
+
+
+    @Test
+    public void testEchoToBadFile() {
+        try {
+            buildRule.executeTarget("testEchoToBadFile");
+            fail("BuildException should have been thrown on destination file being a directory");
+        } catch(BuildException ex) {
+            assertContains("destfile is a directory", "destfile is a directory!", ex.getMessage());
+        }
+    }
+
+
+    @Test
+    public void testEchoToBadFileNoFail() {
+        buildRule.executeTarget("testEchoToBadFileNoFail");
+        assertContains("destfile is a directory!", buildRule.getLog());
+    }
+
+
+    @Test
+    public void testEchoToGoodFile() throws Exception {
+        buildRule.executeTarget("testEchoToGoodFile");
+        assertGoodFile();
+    }
+
+
+    @Test
+    public void testEchoToGoodFileXml() throws Exception {
+        buildRule.executeTarget("testEchoToGoodFileXml");
+
+        // read in the file
+        File f = createRelativeFile(GOOD_OUTFILE_XML);
+        FileReader fr = new FileReader(f);
+        BufferedReader br = new BufferedReader(fr);
+        try {
+            String read = null;
+            while ((read = br.readLine()) != null) {
+                if (read.indexOf("<property name=\"test.property\" value=\""+TEST_VALUE+"\" />") >= 0) {
+                    // found the property we set - it's good.
+                    return;
+                }
+            }
+            fail("did not encounter set property in generated file.");
+        } finally {
+            try {
+                fr.close();
+            } catch(IOException e) {}
+            try {
+                br.close();
+            } catch(IOException e) {}
+        }
+    }
+
+
+    @Test
+    public void testEchoToGoodFileFail() throws Exception {
+        buildRule.executeTarget("testEchoToGoodFileFail");
+        assertGoodFile();
+    }
+
+
+    @Test
+    public void testEchoToGoodFileNoFail() throws Exception {
+        buildRule.executeTarget("testEchoToGoodFileNoFail");
+        assertGoodFile();
+    }
+
+    @Test
+    public void testEchoPrefix() throws Exception {
+        testEchoPrefixVarious("testEchoPrefix");
+    }
+
+    @Test
+    public void testEchoPrefixAsPropertyset() throws Exception {
+        testEchoPrefixVarious("testEchoPrefixAsPropertyset");
+    }
+
+    @Test
+    public void testEchoPrefixAsNegatedPropertyset() throws Exception {
+        testEchoPrefixVarious("testEchoPrefixAsNegatedPropertyset");
+    }
+
+    @Test
+    public void testEchoPrefixAsDoublyNegatedPropertyset() throws Exception {
+        testEchoPrefixVarious("testEchoPrefixAsDoublyNegatedPropertyset");
+    }
+
+    @Test
+    public void testWithPrefixAndRegex() throws Exception {
+        try {
+            buildRule.executeTarget("testWithPrefixAndRegex");
+            fail("BuildException should have been thrown on Prefix and RegEx beng set");
+        } catch (BuildException ex) {
+            assertEquals("The target must fail with prefix and regex attributes set", "Please specify either prefix or regex, but not both", ex.getMessage());
+        }
+    }
+
+    @Test
+    public void testWithEmptyPrefixAndRegex() throws Exception {
+        buildRule.executeTarget("testEchoWithEmptyPrefixToLog");
+        assertContains("test.property="+TEST_VALUE, buildRule.getLog());
+    }
+
+    @Test
+    public void testWithRegex() throws Exception {
+        assumeTrue("Test skipped because no regexp matcher is present.", RegexpMatcherFactory.regexpMatcherPresent(buildRule.getProject()));
+        buildRule.executeTarget("testWithRegex");
+        // the following line has been changed from checking ant.home to ant.version so the test will still work when run outside of an ant script
+        assertContains("ant.version=", buildRule.getFullLog());
+    }
+
+    private void testEchoPrefixVarious(String target) throws Exception {
+        buildRule.executeTarget(target);
+        Properties props = loadPropFile(PREFIX_OUTFILE);
+        assertEquals("prefix didn't include 'a.set' property",
+            "true", props.getProperty("a.set"));
+        assertNull("prefix failed to filter out property 'b.set'",
+            props.getProperty("b.set"));
+    }
+
+    protected Properties loadPropFile(String relativeFilename)
+            throws IOException {
+        File f = createRelativeFile(relativeFilename);
+        Properties props=new Properties();
+        InputStream in=null;
+        try  {
+            in=new BufferedInputStream(new FileInputStream(f));
+            props.load(in);
+        } finally {
+            if(in!=null) {
+                try { in.close(); } catch(IOException e) {}
+            }
+        }
+        return props;
+    }
+
+    protected void assertGoodFile() throws Exception {
+        File f = createRelativeFile(GOOD_OUTFILE);
+        assertTrue("Did not create "+f.getAbsolutePath(),
+            f.exists());
+        Properties props=loadPropFile(GOOD_OUTFILE);
+        props.list(System.out);
+        assertEquals("test property not found ",
+                     TEST_VALUE, props.getProperty("test.property"));
+    }
+
+
+    protected String toAbsolute(String filename) {
+        return createRelativeFile(filename).getAbsolutePath();
+    }
+
+
+    protected File createRelativeFile(String filename) {
+        if (filename.equals(".")) {
+            return buildRule.getProject().getBaseDir();
+        }
+        // else
+        return new File(buildRule.getProject().getBaseDir(), filename);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/JavahTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/JavahTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/JavahTest.java
index 6e318ad..40472de 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/JavahTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/JavahTest.java
@@ -1,60 +1,60 @@
-/*
- *  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;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import java.io.File;
-
-import static org.junit.Assert.assertTrue;
-
-public class JavahTest {
-
-    private final static String BUILD_XML = 
-        "src/etc/testcases/taskdefs/optional/javah/build.xml";
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject(BUILD_XML);
-    }
-
-    @After
-    public void tearDown() {
-        buildRule.executeTarget("tearDown");
-    }
-
-    @Test
-    public void testSimpleCompile() {
-        buildRule.executeTarget("simple-compile");
-        assertTrue(new File(buildRule.getProject().getProperty("output"), "org_example_Foo.h")
-                .exists());
-    }
-
-    @Test
-    public void testCompileFileset() {
-        buildRule.executeTarget("test-fileset");
-        assertTrue(new File(buildRule.getProject().getProperty("output"), "org_example_Foo.h").exists());
-    }
-}
+/*
+ *  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;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import java.io.File;
+
+import static org.junit.Assert.assertTrue;
+
+public class JavahTest {
+
+    private final static String BUILD_XML =
+        "src/etc/testcases/taskdefs/optional/javah/build.xml";
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject(BUILD_XML);
+    }
+
+    @After
+    public void tearDown() {
+        buildRule.executeTarget("tearDown");
+    }
+
+    @Test
+    public void testSimpleCompile() {
+        buildRule.executeTarget("simple-compile");
+        assertTrue(new File(buildRule.getProject().getProperty("output"), "org_example_Foo.h")
+                .exists());
+    }
+
+    @Test
+    public void testCompileFileset() {
+        buildRule.executeTarget("test-fileset");
+        assertTrue(new File(buildRule.getProject().getProperty("output"), "org_example_Foo.h").exists());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/JspcTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/JspcTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/JspcTest.java
index 62ba085..cde44d0 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/JspcTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/JspcTest.java
@@ -1,200 +1,199 @@
-/*
- *  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;
-
-import java.io.File;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.BuildFileRule;
-import org.apache.tools.ant.taskdefs.optional.jsp.Jasper41Mangler;
-import org.apache.tools.ant.taskdefs.optional.jsp.JspMangler;
-import org.apache.tools.ant.taskdefs.optional.jsp.JspNameMangler;
-import org.apache.tools.ant.taskdefs.optional.jsp.compilers.JspCompilerAdapter;
-import org.apache.tools.ant.taskdefs.optional.jsp.compilers.JspCompilerAdapterFactory;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-/**
- * Tests the Jspc task.
- *
- * created 07 March 2002
- * @since Ant 1.5
- */
-public class JspcTest {
-
-    private final static String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/";
-
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-    
-    @Before
-    public void setUp() {
-        buildRule.configureProject(TASKDEFS_DIR + "jspc.xml");
-     }
-
-
-
-    @Test
-    public void testSimple() {
-        executeJspCompile("testSimple", "simple_jsp.java");
-    }
-
-
-    @Test
-    public void testUriroot() throws Exception {
-        executeJspCompile("testUriroot", "uriroot_jsp.java");
-    }
-
-
-    @Test
-    public void testXml() throws Exception {
-        executeJspCompile("testXml", "xml_jsp.java");
-    }
-
-
-    /**
-     * try a keyword in a file
-     */
-    @Test
-    public void testKeyword() throws Exception {
-        executeJspCompile("testKeyword", "default_jsp.java");
-    }
-
-
-    /**
-     * what happens to 1nvalid-classname
-     */
-    @Test
-    public void testInvalidClassname() throws Exception {
-        executeJspCompile("testInvalidClassname",
-                "_1nvalid_0002dclassname_jsp.java");
-    }
-
-
-    @Test
-    public void testNoTld() throws Exception {
-        try {
-            buildRule.executeTarget("testNoTld");
-            fail("Not found");
-        } catch (BuildException ex) {
-            assertEquals("Java returned: 9", ex.getMessage());
-        }
-    }
-
-
-    @Test
-    public void testNotAJspFile()  throws Exception {
-        buildRule.executeTarget("testNotAJspFile");
-    }
-
-    /**
-     * webapp test is currently broken, because it picks up
-     * on the missing_tld file, and bails.
-     */
-    @Ignore("picks up on the missing_tld file, and incorrectly bails")
-    @Test
-    public void testWebapp()  throws Exception {
-        buildRule.executeTarget("testWebapp");
-    }
-
-    /**
-     * run a target then verify the named file gets created
-     *
-     * @param target Description of Parameter
-     * @param javafile Description of Parameter
-     */
-    protected void executeJspCompile(String target, String javafile) {
-        buildRule.executeTarget(target);
-        assertJavaFileCreated(javafile);
-    }
-
-
-    /**
-     * verify that a named file was created
-     *
-     * @param filename Description of Parameter
-     */
-    protected void assertJavaFileCreated(String filename) {
-        File file = getOutputFile(filename);
-        assertTrue("file " + filename + " not found", file.exists());
-        assertTrue("file " + filename + " is empty", file.length() > 0);
-    }
-
-    /**
-     * Gets the OutputFile attribute of the JspcTest object
-     *
-     * @param subpath Description of Parameter
-     * @return The OutputFile value
-     */
-    protected File getOutputFile(String subpath) {
-        return new File(buildRule.getProject().getProperty("output"), subpath);
-    }
-
-    /**
-     * verify that we select the appropriate mangler
-     */
-    @Test
-    public void testJasperNameManglerSelection() {
-        JspCompilerAdapter adapter=
-                JspCompilerAdapterFactory.getCompiler("jasper", null,null);
-        JspMangler mangler=adapter.createMangler();
-        assertTrue(mangler instanceof JspNameMangler);
-        adapter= JspCompilerAdapterFactory.getCompiler("jasper41", null, null);
-        mangler = adapter.createMangler();
-        assertTrue(mangler instanceof Jasper41Mangler);
-    }
-
-    @Test
-    public void testJasper41() {
-        JspMangler mangler = new Jasper41Mangler();
-        //java keywords are not special
-        assertMapped(mangler, "for.jsp", "for_jsp");
-        //underscores go in front of invalid start chars
-        assertMapped(mangler, "0.jsp", "_0_jsp");
-        //underscores at the front get an underscore too
-        assertMapped(mangler, "_.jsp", "___jsp");
-        //non java char at start => underscore then the the _hex value
-        assertMapped(mangler, "-.jsp", "__0002d_jsp");
-        //and paths are stripped
-        char s = File.separatorChar;
-        assertMapped(mangler, "" + s + s + "somewhere" + s + "file" + s + "index.jsp", "index_jsp");
-    }
-
-    /**
-     * assert our mapping rules
-     * @param mangler
-     * @param filename
-     * @param classname
-     */
-    protected void assertMapped(JspMangler mangler, String filename, String classname) {
-        String mappedname = mangler.mapJspToJavaName(new File(filename));
-        assertTrue(filename+" should have mapped to "+classname
-                    +" but instead mapped to "+mappedname,
-                    classname.equals(mappedname));
-    }
-
-
-}
-
+/*
+ *  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;
+
+import java.io.File;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileRule;
+import org.apache.tools.ant.taskdefs.optional.jsp.Jasper41Mangler;
+import org.apache.tools.ant.taskdefs.optional.jsp.JspMangler;
+import org.apache.tools.ant.taskdefs.optional.jsp.JspNameMangler;
+import org.apache.tools.ant.taskdefs.optional.jsp.compilers.JspCompilerAdapter;
+import org.apache.tools.ant.taskdefs.optional.jsp.compilers.JspCompilerAdapterFactory;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * Tests the Jspc task.
+ *
+ * created 07 March 2002
+ * @since Ant 1.5
+ */
+public class JspcTest {
+
+    private final static String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/";
+
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject(TASKDEFS_DIR + "jspc.xml");
+     }
+
+
+
+    @Test
+    public void testSimple() {
+        executeJspCompile("testSimple", "simple_jsp.java");
+    }
+
+
+    @Test
+    public void testUriroot() throws Exception {
+        executeJspCompile("testUriroot", "uriroot_jsp.java");
+    }
+
+
+    @Test
+    public void testXml() throws Exception {
+        executeJspCompile("testXml", "xml_jsp.java");
+    }
+
+
+    /**
+     * try a keyword in a file
+     */
+    @Test
+    public void testKeyword() throws Exception {
+        executeJspCompile("testKeyword", "default_jsp.java");
+    }
+
+
+    /**
+     * what happens to 1nvalid-classname
+     */
+    @Test
+    public void testInvalidClassname() throws Exception {
+        executeJspCompile("testInvalidClassname",
+                "_1nvalid_0002dclassname_jsp.java");
+    }
+
+
+    @Test
+    public void testNoTld() throws Exception {
+        try {
+            buildRule.executeTarget("testNoTld");
+            fail("Not found");
+        } catch (BuildException ex) {
+            assertEquals("Java returned: 9", ex.getMessage());
+        }
+    }
+
+
+    @Test
+    public void testNotAJspFile()  throws Exception {
+        buildRule.executeTarget("testNotAJspFile");
+    }
+
+    /**
+     * webapp test is currently broken, because it picks up
+     * on the missing_tld file, and bails.
+     */
+    @Ignore("picks up on the missing_tld file, and incorrectly bails")
+    @Test
+    public void testWebapp()  throws Exception {
+        buildRule.executeTarget("testWebapp");
+    }
+
+    /**
+     * run a target then verify the named file gets created
+     *
+     * @param target Description of Parameter
+     * @param javafile Description of Parameter
+     */
+    protected void executeJspCompile(String target, String javafile) {
+        buildRule.executeTarget(target);
+        assertJavaFileCreated(javafile);
+    }
+
+
+    /**
+     * verify that a named file was created
+     *
+     * @param filename Description of Parameter
+     */
+    protected void assertJavaFileCreated(String filename) {
+        File file = getOutputFile(filename);
+        assertTrue("file " + filename + " not found", file.exists());
+        assertTrue("file " + filename + " is empty", file.length() > 0);
+    }
+
+    /**
+     * Gets the OutputFile attribute of the JspcTest object
+     *
+     * @param subpath Description of Parameter
+     * @return The OutputFile value
+     */
+    protected File getOutputFile(String subpath) {
+        return new File(buildRule.getProject().getProperty("output"), subpath);
+    }
+
+    /**
+     * verify that we select the appropriate mangler
+     */
+    @Test
+    public void testJasperNameManglerSelection() {
+        JspCompilerAdapter adapter=
+                JspCompilerAdapterFactory.getCompiler("jasper", null,null);
+        JspMangler mangler=adapter.createMangler();
+        assertTrue(mangler instanceof JspNameMangler);
+        adapter= JspCompilerAdapterFactory.getCompiler("jasper41", null, null);
+        mangler = adapter.createMangler();
+        assertTrue(mangler instanceof Jasper41Mangler);
+    }
+
+    @Test
+    public void testJasper41() {
+        JspMangler mangler = new Jasper41Mangler();
+        //java keywords are not special
+        assertMapped(mangler, "for.jsp", "for_jsp");
+        //underscores go in front of invalid start chars
+        assertMapped(mangler, "0.jsp", "_0_jsp");
+        //underscores at the front get an underscore too
+        assertMapped(mangler, "_.jsp", "___jsp");
+        //non java char at start => underscore then the the _hex value
+        assertMapped(mangler, "-.jsp", "__0002d_jsp");
+        //and paths are stripped
+        char s = File.separatorChar;
+        assertMapped(mangler, "" + s + s + "somewhere" + s + "file" + s + "index.jsp", "index_jsp");
+    }
+
+    /**
+     * assert our mapping rules
+     * @param mangler
+     * @param filename
+     * @param classname
+     */
+    protected void assertMapped(JspMangler mangler, String filename, String classname) {
+        String mappedname = mangler.mapJspToJavaName(new File(filename));
+        assertTrue(filename+" should have mapped to "+classname
+                    +" but instead mapped to "+mappedname,
+                    classname.equals(mappedname));
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/Native2AsciiTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/Native2AsciiTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/Native2AsciiTest.java
index 3138e3a..1e8acc9 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/Native2AsciiTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/Native2AsciiTest.java
@@ -1,57 +1,57 @@
-/*
- *  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;
-
-import java.io.File;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.apache.tools.ant.util.FileUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertTrue;
-
-public class Native2AsciiTest {
-
-    private final static String BUILD_XML = 
-        "src/etc/testcases/taskdefs/optional/native2ascii/build.xml";
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject(BUILD_XML);
-    }
-
-    @After
-    public void tearDown() {
-        buildRule.executeTarget("tearDown");
-    }
-
-    @Test
-    public void testIso8859_1() throws java.io.IOException {
-        buildRule.executeTarget("testIso8859-1");
-        File in = buildRule.getProject().resolveFile("expected/iso8859-1.test");
-        File out = new File(buildRule.getProject().getProperty("output"), "iso8859-1.test");
-        assertTrue(FileUtils.getFileUtils().contentEquals(in, out, true));
-    }
-}
+/*
+ *  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;
+
+import java.io.File;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.apache.tools.ant.util.FileUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+
+public class Native2AsciiTest {
+
+    private final static String BUILD_XML =
+        "src/etc/testcases/taskdefs/optional/native2ascii/build.xml";
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject(BUILD_XML);
+    }
+
+    @After
+    public void tearDown() {
+        buildRule.executeTarget("tearDown");
+    }
+
+    @Test
+    public void testIso8859_1() throws java.io.IOException {
+        buildRule.executeTarget("testIso8859-1");
+        File in = buildRule.getProject().resolveFile("expected/iso8859-1.test");
+        File out = new File(buildRule.getProject().getProperty("output"), "iso8859-1.test");
+        assertTrue(FileUtils.getFileUtils().contentEquals(in, out, true));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/PropertyFileTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/PropertyFileTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/PropertyFileTest.java
index a403673..d74c798 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/PropertyFileTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/PropertyFileTest.java
@@ -1,235 +1,235 @@
-/*
- *  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;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.Properties;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-/**
- *  JUnit testcase that exercises the optional PropertyFile task in ant.
- *  (this is really more of a functional test so far.., but it's enough to let
- *   me start refactoring...)
- *
- *created    October 2, 2001
- */
-
-public class PropertyFileTest {
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() throws Exception {
-        buildRule.configureProject(projectFilePath);
-        buildRule.executeTarget("setUp");
-        initTestPropFile();
-        initBuildPropFile();
-        buildRule.configureProject(projectFilePath);
-        buildRule.getProject().setProperty(valueDoesNotGetOverwrittenPropertyFileKey,
-                valueDoesNotGetOverwrittenPropertyFile);
-    }
-
-
-    @Test
-    public void testNonExistingFile() {
-        PropertyFile props = new PropertyFile();
-        props.setProject( buildRule.getProject() );
-        File file = new File("this-file-does-not-exist.properties");
-        props.setFile(file);
-        assertFalse("Properties file exists before test.", file.exists());
-        props.execute();
-        assertTrue("Properties file does not exist after test.", file.exists());
-        file.delete();
-    }
-
-    /**
-     *  A unit test for JUnit- Exercises the propertyfile tasks ability to
-     *  update properties that are already defined-
-     */
-    @Test
-    public void testUpdatesExistingProperties() throws Exception {
-        Properties beforeUpdate = getTestProperties();
-        assertEquals(FNAME, beforeUpdate.getProperty(FNAME_KEY));
-        assertEquals(LNAME, beforeUpdate.getProperty(LNAME_KEY));
-        assertEquals(EMAIL, beforeUpdate.getProperty(EMAIL_KEY));
-        assertEquals(null, beforeUpdate.getProperty(PHONE_KEY));
-        assertEquals(null, beforeUpdate.getProperty(AGE_KEY));
-        assertEquals(null, beforeUpdate.getProperty(DATE_KEY));
-
-        // ask ant to update the properties...
-        buildRule.executeTarget("update-existing-properties");
-
-        Properties afterUpdate = getTestProperties();
-        assertEquals(NEW_FNAME, afterUpdate.getProperty(FNAME_KEY));
-        assertEquals(NEW_LNAME, afterUpdate.getProperty(LNAME_KEY));
-        assertEquals(NEW_EMAIL, afterUpdate.getProperty(EMAIL_KEY));
-        assertEquals(NEW_PHONE, afterUpdate.getProperty(PHONE_KEY));
-        assertEquals(NEW_AGE, afterUpdate.getProperty(AGE_KEY));
-        assertEquals(NEW_DATE, afterUpdate.getProperty(DATE_KEY));
-    }
-
-    @Test
-    public void testDeleteProperties() throws Exception {
-        Properties beforeUpdate = getTestProperties();
-        assertEquals("Property '" + FNAME_KEY + "' should exist before deleting",
-            FNAME, beforeUpdate.getProperty(FNAME_KEY));
-        assertEquals("Property '" + LNAME_KEY + "' should exist before deleting",
-            LNAME, beforeUpdate.getProperty(LNAME_KEY));
-        
-        buildRule.executeTarget("delete-properties");
-        Properties afterUpdate = getTestProperties();
-
-        assertEquals("Property '" + LNAME_KEY + "' should exist after deleting",
-            LNAME, afterUpdate.getProperty(LNAME_KEY));
-        assertNull("Property '" + FNAME_KEY + "' should be deleted",
-            afterUpdate.getProperty(FNAME_KEY));
-    }
-
-    @Test
-    public void testExerciseDefaultAndIncrement() throws Exception {
-        buildRule.executeTarget("exercise");
-        assertEquals("3",buildRule.getProject().getProperty("int.with.default"));
-        assertEquals("1",buildRule.getProject().getProperty("int.without.default"));
-        assertEquals("-->",buildRule.getProject().getProperty("string.with.default"));
-        assertEquals(".",buildRule.getProject().getProperty("string.without.default"));
-        assertEquals("2002/01/21 12:18", buildRule.getProject().getProperty("ethans.birth"));
-        assertEquals("2003/01/21", buildRule.getProject().getProperty("first.birthday"));
-        assertEquals("0124", buildRule.getProject().getProperty("olderThanAWeek"));
-        assertEquals("37", buildRule.getProject().getProperty("existing.prop"));
-        assertEquals("6",buildRule.getProject().getProperty("int.without.value"));
-    }
-
-    @Test
-    public void testValueDoesNotGetOverwritten() {
-        // this test shows that the bug report 21505 is fixed
-        buildRule.executeTarget("bugDemo1");
-        buildRule.executeTarget("bugDemo2");
-        assertEquals("5", buildRule.getProject().getProperty("foo"));
-    }
-
-
-    @Test
-    @Ignore("Previously commented out")
-    public void testDirect() throws Exception {
-        PropertyFile pf = new PropertyFile();
-        pf.setProject(buildRule.getProject());
-        pf.setFile(new File(System.getProperty("root"), testPropsFilePath));
-        PropertyFile.Entry entry = pf.createEntry();
-
-        entry.setKey("date");
-        entry.setValue("123");
-        PropertyFile.Entry.Type type = new PropertyFile.Entry.Type();
-        type.setValue("date");
-        entry.setType(type);
-
-        entry.setPattern("yyyy/MM/dd");
-
-        PropertyFile.Entry.Operation operation = new PropertyFile.Entry.Operation();
-        operation.setValue("+");
-        pf.execute();
-
-        Properties props = getTestProperties();
-        assertEquals("yeehaw", props.getProperty("date"));
-    }
-
-
-    private Properties getTestProperties() throws Exception {
-        Properties testProps = new Properties();
-        FileInputStream propsFile = new FileInputStream(new File(buildRule.getOutputDir(), testPropsFilePath));
-        testProps.load(propsFile);
-        propsFile.close();
-        return testProps;
-    }
-
-
-    private void initTestPropFile() throws IOException {
-        Properties testProps = new Properties();
-        testProps.put(FNAME_KEY, FNAME);
-        testProps.put(LNAME_KEY, LNAME);
-        testProps.put(EMAIL_KEY, EMAIL);
-        testProps.put("existing.prop", "37");
-
-        FileOutputStream fos = new FileOutputStream(new File(buildRule.getOutputDir(), testPropsFilePath));
-        testProps.store(fos, "defaults");
-        fos.close();
-    }
-
-
-    private void initBuildPropFile() throws IOException {
-        Properties buildProps = new Properties();
-        buildProps.put(testPropertyFileKey, testPropertyFile);
-        buildProps.put(FNAME_KEY, NEW_FNAME);
-        buildProps.put(LNAME_KEY, NEW_LNAME);
-        buildProps.put(EMAIL_KEY, NEW_EMAIL);
-        buildProps.put(PHONE_KEY, NEW_PHONE);
-        buildProps.put(AGE_KEY, NEW_AGE);
-        buildProps.put(DATE_KEY, NEW_DATE);
-
-        FileOutputStream fos = new FileOutputStream(new File(buildRule.getOutputDir(), buildPropsFilePath));
-        buildProps.store(fos, null);
-        fos.close();
-    }
-
-    private static final String
-        projectFilePath     = "src/etc/testcases/taskdefs/optional/propertyfile.xml",
-
-        testPropertyFile    = "propertyfile.test.properties",
-        testPropertyFileKey = "test.propertyfile",
-        testPropsFilePath   = testPropertyFile,
-
-        valueDoesNotGetOverwrittenPropertyFile    = "overwrite.test.properties",
-        valueDoesNotGetOverwrittenPropertyFileKey = "overwrite.test.propertyfile",
-        valueDoesNotGetOverwrittenPropsFilePath   = valueDoesNotGetOverwrittenPropertyFile,
-
-        buildPropsFilePath  = "propertyfile.build.properties",
-
-        FNAME     = "Bruce",
-        NEW_FNAME = "Clark",
-        FNAME_KEY = "firstname",
-
-        LNAME     = "Banner",
-        NEW_LNAME = "Kent",
-        LNAME_KEY = "lastname",
-
-        EMAIL     = "incredible@hulk.com",
-        NEW_EMAIL = "kc@superman.com",
-        EMAIL_KEY = "email",
-
-        NEW_PHONE = "(520) 555-1212",
-        PHONE_KEY = "phone",
-
-        NEW_AGE = "30",
-        AGE_KEY = "age",
-
-        NEW_DATE = "2001/01/01 12:45",
-        DATE_KEY = "date";
-}
+/*
+ *  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;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Properties;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+/**
+ *  JUnit testcase that exercises the optional PropertyFile task in ant.
+ *  (this is really more of a functional test so far.., but it's enough to let
+ *   me start refactoring...)
+ *
+ *created    October 2, 2001
+ */
+
+public class PropertyFileTest {
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() throws Exception {
+        buildRule.configureProject(projectFilePath);
+        buildRule.executeTarget("setUp");
+        initTestPropFile();
+        initBuildPropFile();
+        buildRule.configureProject(projectFilePath);
+        buildRule.getProject().setProperty(valueDoesNotGetOverwrittenPropertyFileKey,
+                valueDoesNotGetOverwrittenPropertyFile);
+    }
+
+
+    @Test
+    public void testNonExistingFile() {
+        PropertyFile props = new PropertyFile();
+        props.setProject( buildRule.getProject() );
+        File file = new File("this-file-does-not-exist.properties");
+        props.setFile(file);
+        assertFalse("Properties file exists before test.", file.exists());
+        props.execute();
+        assertTrue("Properties file does not exist after test.", file.exists());
+        file.delete();
+    }
+
+    /**
+     *  A unit test for JUnit- Exercises the propertyfile tasks ability to
+     *  update properties that are already defined-
+     */
+    @Test
+    public void testUpdatesExistingProperties() throws Exception {
+        Properties beforeUpdate = getTestProperties();
+        assertEquals(FNAME, beforeUpdate.getProperty(FNAME_KEY));
+        assertEquals(LNAME, beforeUpdate.getProperty(LNAME_KEY));
+        assertEquals(EMAIL, beforeUpdate.getProperty(EMAIL_KEY));
+        assertEquals(null, beforeUpdate.getProperty(PHONE_KEY));
+        assertEquals(null, beforeUpdate.getProperty(AGE_KEY));
+        assertEquals(null, beforeUpdate.getProperty(DATE_KEY));
+
+        // ask ant to update the properties...
+        buildRule.executeTarget("update-existing-properties");
+
+        Properties afterUpdate = getTestProperties();
+        assertEquals(NEW_FNAME, afterUpdate.getProperty(FNAME_KEY));
+        assertEquals(NEW_LNAME, afterUpdate.getProperty(LNAME_KEY));
+        assertEquals(NEW_EMAIL, afterUpdate.getProperty(EMAIL_KEY));
+        assertEquals(NEW_PHONE, afterUpdate.getProperty(PHONE_KEY));
+        assertEquals(NEW_AGE, afterUpdate.getProperty(AGE_KEY));
+        assertEquals(NEW_DATE, afterUpdate.getProperty(DATE_KEY));
+    }
+
+    @Test
+    public void testDeleteProperties() throws Exception {
+        Properties beforeUpdate = getTestProperties();
+        assertEquals("Property '" + FNAME_KEY + "' should exist before deleting",
+            FNAME, beforeUpdate.getProperty(FNAME_KEY));
+        assertEquals("Property '" + LNAME_KEY + "' should exist before deleting",
+            LNAME, beforeUpdate.getProperty(LNAME_KEY));
+
+        buildRule.executeTarget("delete-properties");
+        Properties afterUpdate = getTestProperties();
+
+        assertEquals("Property '" + LNAME_KEY + "' should exist after deleting",
+            LNAME, afterUpdate.getProperty(LNAME_KEY));
+        assertNull("Property '" + FNAME_KEY + "' should be deleted",
+            afterUpdate.getProperty(FNAME_KEY));
+    }
+
+    @Test
+    public void testExerciseDefaultAndIncrement() throws Exception {
+        buildRule.executeTarget("exercise");
+        assertEquals("3",buildRule.getProject().getProperty("int.with.default"));
+        assertEquals("1",buildRule.getProject().getProperty("int.without.default"));
+        assertEquals("-->",buildRule.getProject().getProperty("string.with.default"));
+        assertEquals(".",buildRule.getProject().getProperty("string.without.default"));
+        assertEquals("2002/01/21 12:18", buildRule.getProject().getProperty("ethans.birth"));
+        assertEquals("2003/01/21", buildRule.getProject().getProperty("first.birthday"));
+        assertEquals("0124", buildRule.getProject().getProperty("olderThanAWeek"));
+        assertEquals("37", buildRule.getProject().getProperty("existing.prop"));
+        assertEquals("6",buildRule.getProject().getProperty("int.without.value"));
+    }
+
+    @Test
+    public void testValueDoesNotGetOverwritten() {
+        // this test shows that the bug report 21505 is fixed
+        buildRule.executeTarget("bugDemo1");
+        buildRule.executeTarget("bugDemo2");
+        assertEquals("5", buildRule.getProject().getProperty("foo"));
+    }
+
+
+    @Test
+    @Ignore("Previously commented out")
+    public void testDirect() throws Exception {
+        PropertyFile pf = new PropertyFile();
+        pf.setProject(buildRule.getProject());
+        pf.setFile(new File(System.getProperty("root"), testPropsFilePath));
+        PropertyFile.Entry entry = pf.createEntry();
+
+        entry.setKey("date");
+        entry.setValue("123");
+        PropertyFile.Entry.Type type = new PropertyFile.Entry.Type();
+        type.setValue("date");
+        entry.setType(type);
+
+        entry.setPattern("yyyy/MM/dd");
+
+        PropertyFile.Entry.Operation operation = new PropertyFile.Entry.Operation();
+        operation.setValue("+");
+        pf.execute();
+
+        Properties props = getTestProperties();
+        assertEquals("yeehaw", props.getProperty("date"));
+    }
+
+
+    private Properties getTestProperties() throws Exception {
+        Properties testProps = new Properties();
+        FileInputStream propsFile = new FileInputStream(new File(buildRule.getOutputDir(), testPropsFilePath));
+        testProps.load(propsFile);
+        propsFile.close();
+        return testProps;
+    }
+
+
+    private void initTestPropFile() throws IOException {
+        Properties testProps = new Properties();
+        testProps.put(FNAME_KEY, FNAME);
+        testProps.put(LNAME_KEY, LNAME);
+        testProps.put(EMAIL_KEY, EMAIL);
+        testProps.put("existing.prop", "37");
+
+        FileOutputStream fos = new FileOutputStream(new File(buildRule.getOutputDir(), testPropsFilePath));
+        testProps.store(fos, "defaults");
+        fos.close();
+    }
+
+
+    private void initBuildPropFile() throws IOException {
+        Properties buildProps = new Properties();
+        buildProps.put(testPropertyFileKey, testPropertyFile);
+        buildProps.put(FNAME_KEY, NEW_FNAME);
+        buildProps.put(LNAME_KEY, NEW_LNAME);
+        buildProps.put(EMAIL_KEY, NEW_EMAIL);
+        buildProps.put(PHONE_KEY, NEW_PHONE);
+        buildProps.put(AGE_KEY, NEW_AGE);
+        buildProps.put(DATE_KEY, NEW_DATE);
+
+        FileOutputStream fos = new FileOutputStream(new File(buildRule.getOutputDir(), buildPropsFilePath));
+        buildProps.store(fos, null);
+        fos.close();
+    }
+
+    private static final String
+        projectFilePath     = "src/etc/testcases/taskdefs/optional/propertyfile.xml",
+
+        testPropertyFile    = "propertyfile.test.properties",
+        testPropertyFileKey = "test.propertyfile",
+        testPropsFilePath   = testPropertyFile,
+
+        valueDoesNotGetOverwrittenPropertyFile    = "overwrite.test.properties",
+        valueDoesNotGetOverwrittenPropertyFileKey = "overwrite.test.propertyfile",
+        valueDoesNotGetOverwrittenPropsFilePath   = valueDoesNotGetOverwrittenPropertyFile,
+
+        buildPropsFilePath  = "propertyfile.build.properties",
+
+        FNAME     = "Bruce",
+        NEW_FNAME = "Clark",
+        FNAME_KEY = "firstname",
+
+        LNAME     = "Banner",
+        NEW_LNAME = "Kent",
+        LNAME_KEY = "lastname",
+
+        EMAIL     = "incredible@hulk.com",
+        NEW_EMAIL = "kc@superman.com",
+        EMAIL_KEY = "email",
+
+        NEW_PHONE = "(520) 555-1212",
+        PHONE_KEY = "phone",
+
+        NEW_AGE = "30",
+        AGE_KEY = "age",
+
+        NEW_DATE = "2001/01/01 12:45",
+        DATE_KEY = "date";
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/PvcsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/PvcsTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/PvcsTest.java
index 0f7aff7..cd7a431 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/PvcsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/PvcsTest.java
@@ -1,79 +1,79 @@
-/*
- *  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;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.fail;
-
-public class PvcsTest {
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject("src/etc/testcases/taskdefs/optional/pvcs.xml");
-    }
-
-    @Test
-    public void test1() {
-        try {
-            buildRule.executeTarget("test1");
-            fail("Required argument repository not specified");
-        }  catch (BuildException ex) {
-            //TODO check exception message
-        }
-    }
-
-    @Test
-    public void test2() {
-        buildRule.executeTarget("test2");
-    }
-
-    @Test
-    public void test3() {
-        buildRule.executeTarget("test3");
-    }
-
-    @Test
-    public void test4() {
-        buildRule.executeTarget("test4");
-    }
-
-    @Test
-    public void test5() {
-        buildRule.executeTarget("test5");
-    }
-
-    @Test
-    public void test6() {
-        try {
-            buildRule.executeTarget("test6");
-            fail("Failed executing: /never/heard/of/a/directory/structure/like/this/pcli lvf -z " +
-                    "-aw -pr//ct4serv2/pvcs/monitor /. Exception: /never/heard/of/a/directory/structure/like/this/pcli: not found");
-        } catch(BuildException ex) {
-            //TODO assert exception message
-        }
-    }
-}
+/*
+ *  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;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.fail;
+
+public class PvcsTest {
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject("src/etc/testcases/taskdefs/optional/pvcs.xml");
+    }
+
+    @Test
+    public void test1() {
+        try {
+            buildRule.executeTarget("test1");
+            fail("Required argument repository not specified");
+        }  catch (BuildException ex) {
+            //TODO check exception message
+        }
+    }
+
+    @Test
+    public void test2() {
+        buildRule.executeTarget("test2");
+    }
+
+    @Test
+    public void test3() {
+        buildRule.executeTarget("test3");
+    }
+
+    @Test
+    public void test4() {
+        buildRule.executeTarget("test4");
+    }
+
+    @Test
+    public void test5() {
+        buildRule.executeTarget("test5");
+    }
+
+    @Test
+    public void test6() {
+        try {
+            buildRule.executeTarget("test6");
+            fail("Failed executing: /never/heard/of/a/directory/structure/like/this/pcli lvf -z " +
+                    "-aw -pr//ct4serv2/pvcs/monitor /. Exception: /never/heard/of/a/directory/structure/like/this/pcli: not found");
+        } catch(BuildException ex) {
+            //TODO assert exception message
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ReplaceRegExpTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ReplaceRegExpTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ReplaceRegExpTest.java
index ad5973c..2c71115 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ReplaceRegExpTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ReplaceRegExpTest.java
@@ -1,132 +1,132 @@
-/*
- *  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;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.apache.tools.ant.FileUtilities;
-import org.apache.tools.ant.util.FileUtils;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import java.util.Properties;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assume.assumeTrue;
-
-/**
- * JUnit Testcase for the optional replaceregexp task.
- *
- */
-public class ReplaceRegExpTest {
-    private static final String PROJECT_PATH = "src/etc/testcases/taskdefs/optional";
-    
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject(PROJECT_PATH + "/replaceregexp.xml");
-    }
-
-    @Test
-    public void testReplace() throws IOException {
-        Properties original = new Properties();
-        FileInputStream propsFile = null;
-        try {
-            propsFile = new FileInputStream(new File(buildRule.getProject().getBaseDir() + "/replaceregexp.properties"));
-            original.load(propsFile);
-        } finally {
-            if (propsFile != null) {
-                propsFile.close();
-                propsFile = null;
-            }
-        }
-
-        assertEquals("Def", original.get("OldAbc"));
-
-        buildRule.executeTarget("testReplace");
-
-        Properties after = new Properties();
-        try {
-            propsFile = new FileInputStream(new File(buildRule.getOutputDir(), "test.properties"));
-            after.load(propsFile);
-        } finally {
-            if (propsFile != null) {
-                propsFile.close();
-            }
-        }
-
-        assertNull(after.get("OldAbc"));
-        assertEquals("AbcDef", after.get("NewProp"));
-    }
-
-    // inspired by bug 22541
-    @Test
-    public void testDirectoryDateDoesNotChange() {
-        buildRule.executeTarget("touchDirectory");
-        File myFile = buildRule.getOutputDir();
-        long timeStampBefore = myFile.lastModified();
-        buildRule.executeTarget("testDirectoryDateDoesNotChange");
-        long timeStampAfter = myFile.lastModified();
-        assertEquals("directory date should not change",
-            timeStampBefore, timeStampAfter);
-    }
-
-    @Test
-    public void testDontAddNewline1() throws IOException {
-        buildRule.executeTarget("testDontAddNewline1");
-        assertEquals(FileUtilities.getFileContents(new File(buildRule.getOutputDir(), "test.properties")),
-                FileUtilities.getFileContents(new File(buildRule.getProject().getBaseDir(), "replaceregexp2.result.properties")));
-    }
-
-    @Test
-    public void testDontAddNewline2() throws IOException {
-        buildRule.executeTarget("testDontAddNewline2");
-        assertEquals(FileUtilities.getFileContents(new File(buildRule.getOutputDir(), "test.properties")),
-                FileUtilities.getFileContents(new File(buildRule.getProject().getBaseDir(), "replaceregexp2.result.properties")));
-    }
-
-    @Test
-    public void testNoPreserveLastModified() throws Exception {
-        buildRule.executeTarget("lastModifiedSetup");
-        File testFile = new File(buildRule.getOutputDir(), "test.txt");
-        assumeTrue(testFile.setLastModified(testFile.lastModified()
-                - (FileUtils.getFileUtils().getFileTimestampGranularity() * 3)));
-        long ts1 = testFile.lastModified();
-        buildRule.executeTarget("testNoPreserve");
-        assertTrue(ts1 < testFile.lastModified());
-    }
-
-    @Test
-    public void testPreserveLastModified() throws Exception {
-        buildRule.executeTarget("lastModifiedSetup");
-        File testFile = new File(buildRule.getOutputDir(), "test.txt");
-        assumeTrue(testFile.setLastModified(testFile.lastModified()
-                - (FileUtils.getFileUtils().getFileTimestampGranularity() * 3)));
-        long ts1 = testFile.lastModified();
-        buildRule.executeTarget("testPreserve");
-        assertEquals(ts1 , testFile.lastModified());
-    }
-
-}// ReplaceRegExpTest
+/*
+ *  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;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.apache.tools.ant.FileUtilities;
+import org.apache.tools.ant.util.FileUtils;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import java.util.Properties;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assume.assumeTrue;
+
+/**
+ * JUnit Testcase for the optional replaceregexp task.
+ *
+ */
+public class ReplaceRegExpTest {
+    private static final String PROJECT_PATH = "src/etc/testcases/taskdefs/optional";
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject(PROJECT_PATH + "/replaceregexp.xml");
+    }
+
+    @Test
+    public void testReplace() throws IOException {
+        Properties original = new Properties();
+        FileInputStream propsFile = null;
+        try {
+            propsFile = new FileInputStream(new File(buildRule.getProject().getBaseDir() + "/replaceregexp.properties"));
+            original.load(propsFile);
+        } finally {
+            if (propsFile != null) {
+                propsFile.close();
+                propsFile = null;
+            }
+        }
+
+        assertEquals("Def", original.get("OldAbc"));
+
+        buildRule.executeTarget("testReplace");
+
+        Properties after = new Properties();
+        try {
+            propsFile = new FileInputStream(new File(buildRule.getOutputDir(), "test.properties"));
+            after.load(propsFile);
+        } finally {
+            if (propsFile != null) {
+                propsFile.close();
+            }
+        }
+
+        assertNull(after.get("OldAbc"));
+        assertEquals("AbcDef", after.get("NewProp"));
+    }
+
+    // inspired by bug 22541
+    @Test
+    public void testDirectoryDateDoesNotChange() {
+        buildRule.executeTarget("touchDirectory");
+        File myFile = buildRule.getOutputDir();
+        long timeStampBefore = myFile.lastModified();
+        buildRule.executeTarget("testDirectoryDateDoesNotChange");
+        long timeStampAfter = myFile.lastModified();
+        assertEquals("directory date should not change",
+            timeStampBefore, timeStampAfter);
+    }
+
+    @Test
+    public void testDontAddNewline1() throws IOException {
+        buildRule.executeTarget("testDontAddNewline1");
+        assertEquals(FileUtilities.getFileContents(new File(buildRule.getOutputDir(), "test.properties")),
+                FileUtilities.getFileContents(new File(buildRule.getProject().getBaseDir(), "replaceregexp2.result.properties")));
+    }
+
+    @Test
+    public void testDontAddNewline2() throws IOException {
+        buildRule.executeTarget("testDontAddNewline2");
+        assertEquals(FileUtilities.getFileContents(new File(buildRule.getOutputDir(), "test.properties")),
+                FileUtilities.getFileContents(new File(buildRule.getProject().getBaseDir(), "replaceregexp2.result.properties")));
+    }
+
+    @Test
+    public void testNoPreserveLastModified() throws Exception {
+        buildRule.executeTarget("lastModifiedSetup");
+        File testFile = new File(buildRule.getOutputDir(), "test.txt");
+        assumeTrue(testFile.setLastModified(testFile.lastModified()
+                - (FileUtils.getFileUtils().getFileTimestampGranularity() * 3)));
+        long ts1 = testFile.lastModified();
+        buildRule.executeTarget("testNoPreserve");
+        assertTrue(ts1 < testFile.lastModified());
+    }
+
+    @Test
+    public void testPreserveLastModified() throws Exception {
+        buildRule.executeTarget("lastModifiedSetup");
+        File testFile = new File(buildRule.getOutputDir(), "test.txt");
+        assumeTrue(testFile.setLastModified(testFile.lastModified()
+                - (FileUtils.getFileUtils().getFileTimestampGranularity() * 3)));
+        long ts1 = testFile.lastModified();
+        buildRule.executeTarget("testPreserve");
+        assertEquals(ts1 , testFile.lastModified());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/RhinoReferenceTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/RhinoReferenceTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/RhinoReferenceTest.java
index d3ec1a3..41803de 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/RhinoReferenceTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/RhinoReferenceTest.java
@@ -1,45 +1,45 @@
-/*
- *  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;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-/**
- * Tests using an undefined reference.
- *
- * @since Ant 1.6
- */
-public class RhinoReferenceTest {
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject(
-                "src/etc/testcases/taskdefs/optional/script_reference.xml");
-    }
-
-    @Test
-    public void testScript() {
-        buildRule.executeTarget("script");
-    }
-}
+/*
+ *  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;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+/**
+ * Tests using an undefined reference.
+ *
+ * @since Ant 1.6
+ */
+public class RhinoReferenceTest {
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject(
+                "src/etc/testcases/taskdefs/optional/script_reference.xml");
+    }
+
+    @Test
+    public void testScript() {
+        buildRule.executeTarget("script");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/RpmTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/RpmTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/RpmTest.java
index e69ffb4..ac4462d 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/RpmTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/RpmTest.java
@@ -1,71 +1,71 @@
-/*
- *  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;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.ExecuteStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-
-import org.junit.Test;
-
-import static org.junit.Assert.fail;
-import static org.apache.tools.ant.AntAssert.assertContains;
-
-public class RpmTest {
-
-    @Test
-    public void testShouldThrowExceptionWhenRpmFails() throws Exception {
-        Rpm rpm = new MyRpm();
-        rpm.setProject(new org.apache.tools.ant.Project());
-        rpm.setFailOnError(true);
-        // execute
-        try {
-            rpm.execute();
-            fail("should have thrown a build exception");
-        } catch (BuildException ex) {
-            assertContains("' failed with exit code 2", ex.getMessage());
-        }
-    }
-
-    @Test
-    public void testShouldNotThrowExceptionWhenRpmFails() throws Exception {
-        Rpm rpm = new MyRpm();
-        rpm.execute();
-    }
-
-    // override some of the code so we can test the handling of the
-    // return code only.
-    public static class MyRpm extends Rpm {
-        protected Execute getExecute(Commandline toExecute,
-                                     ExecuteStreamHandler streamhandler) {
-            return new Execute() {
-                    public int execute() {
-                        // 2 is != 0 and even, so it is considered
-                        // failure on any platform currently supported
-                        // by Execute#isFailure.
-                        return 2;
-                    }
-                };
-        }
-
-        public void log(String msg, int msgLevel) {
-        }
-    }
-
-}
+/*
+ *  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;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.Execute;
+import org.apache.tools.ant.taskdefs.ExecuteStreamHandler;
+import org.apache.tools.ant.types.Commandline;
+
+import org.junit.Test;
+
+import static org.junit.Assert.fail;
+import static org.apache.tools.ant.AntAssert.assertContains;
+
+public class RpmTest {
+
+    @Test
+    public void testShouldThrowExceptionWhenRpmFails() throws Exception {
+        Rpm rpm = new MyRpm();
+        rpm.setProject(new org.apache.tools.ant.Project());
+        rpm.setFailOnError(true);
+        // execute
+        try {
+            rpm.execute();
+            fail("should have thrown a build exception");
+        } catch (BuildException ex) {
+            assertContains("' failed with exit code 2", ex.getMessage());
+        }
+    }
+
+    @Test
+    public void testShouldNotThrowExceptionWhenRpmFails() throws Exception {
+        Rpm rpm = new MyRpm();
+        rpm.execute();
+    }
+
+    // override some of the code so we can test the handling of the
+    // return code only.
+    public static class MyRpm extends Rpm {
+        protected Execute getExecute(Commandline toExecute,
+                                     ExecuteStreamHandler streamhandler) {
+            return new Execute() {
+                    public int execute() {
+                        // 2 is != 0 and even, so it is considered
+                        // failure on any platform currently supported
+                        // by Execute#isFailure.
+                        return 2;
+                    }
+                };
+        }
+
+        public void log(String msg, int msgLevel) {
+        }
+    }
+
+}


[16/21] ant git commit: Normalise tabulation and line breaks

Posted by gi...@apache.org.
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java
index 954a75b..c7fab26 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java
@@ -1,879 +1,879 @@
-/*
- *  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.net;
-
-import static org.apache.tools.ant.AntAssert.assertContains;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Random;
-import java.util.Vector;
-
-import org.apache.commons.net.ftp.FTPClient;
-import org.apache.tools.ant.BuildEvent;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.BuildFileRule;
-import org.apache.tools.ant.DefaultLogger;
-import org.apache.tools.ant.DirectoryScanner;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.condition.Os;
-import org.apache.tools.ant.types.FileSet;
-import org.apache.tools.ant.util.RetryHandler;
-import org.apache.tools.ant.util.Retryable;
-import org.apache.tools.ant.util.regexp.RegexpMatcher;
-import org.apache.tools.ant.util.regexp.RegexpMatcherFactory;
-import org.junit.After;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-//FIXME these tests are more integration than unit tests and report errors badly
-public class FTPTest {
-	
-	@Rule
-	public BuildFileRule buildRule = new BuildFileRule();
-	
-    // keep track of what operating systems are supported here.
-    private boolean supportsSymlinks = Os.isFamily("unix");
-
-    private FTPClient ftp;
-    
-    private boolean loginSuceeded = false;
-    
-    private String loginFailureMessage;
-    
-    private String tmpDir = null;
-    private String remoteTmpDir = null;
-    private String ftpFileSep = null;
-    private myFTP myFTPTask = new myFTP();
-
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject("src/etc/testcases/taskdefs/optional/net/ftp.xml");
-        Project project = buildRule.getProject();
-        project.executeTarget("setup");
-        tmpDir = project.getProperty("tmp.dir");
-        ftp = new FTPClient();
-        ftpFileSep = project.getProperty("ftp.filesep");
-        myFTPTask.setSeparator(ftpFileSep);
-        myFTPTask.setProject(project);
-        remoteTmpDir = myFTPTask.resolveFile(tmpDir);
-        String remoteHost = project.getProperty("ftp.host");
-        int port = Integer.parseInt(project.getProperty("ftp.port"));
-        String remoteUser = project.getProperty("ftp.user");
-        String password = project.getProperty("ftp.password");
-        boolean connectionSucceeded = false;
-        try {
-            ftp.connect(remoteHost, port);
-            connectionSucceeded = true;
-        } catch (Exception ex) {
-            loginFailureMessage = "could not connect to host " + remoteHost + " on port " + port;
-        }
-        if (connectionSucceeded) {
-            try {
-                ftp.login(remoteUser, password);
-                loginSuceeded = true;
-            } catch (IOException ioe) {
-                loginFailureMessage = "could not log on to " + remoteHost + " as user " + remoteUser;
-            }
-        }
-    }
-
-    @After
-    public void tearDown() {
-        try {
-            if (ftp!= null) {
-            	ftp.disconnect();
-            }
-        } catch (IOException ioe) {
-            // do nothing
-        }
-        buildRule.getProject().executeTarget("cleanup");
-    }
-    
-    private boolean changeRemoteDir(String remoteDir) {
-        boolean result = true;
-        try {
-            ftp.cwd(remoteDir);
-        }
-        catch (Exception ex) {
-            System.out.println("could not change directory to " + remoteTmpDir);
-            result = false;
-        }
-        return result;
-    }
-    
-    @Test
-    public void test1() {
-    	Assume.assumeTrue(loginFailureMessage, loginSuceeded);
-    	Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
-        
-    	FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
-        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
-        ds.setIncludes(new String[] {"alpha"});
-        ds.scan();
-        compareFiles(ds, new String[] {} ,new String[] {"alpha"});
-    }
-
-    @Test
-    public void test2() {
-        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
-        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
-        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
-        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
-        ds.setIncludes(new String[] {"alpha/"});
-        ds.scan();
-        compareFiles(ds, new String[] {"alpha/beta/beta.xml",
-                                       "alpha/beta/gamma/gamma.xml"},
-            new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
-    }
-
-    @Test
-    public void test3() {
-        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
-        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
-        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
-        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
-        ds.scan();
-        compareFiles(ds, new String[] {"alpha/beta/beta.xml",
-                                       "alpha/beta/gamma/gamma.xml"},
-            new String[] {"alpha", "alpha/beta",
-                          "alpha/beta/gamma"});
-    }
-
-    @Test
-    public void testFullPathMatchesCaseSensitive() {
-        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
-        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
-        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
-        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
-        ds.setIncludes(new String[] {"alpha/beta/gamma/GAMMA.XML"});
-        ds.scan();
-        compareFiles(ds, new String[] {}, new String[] {});
-    }
-
-    @Test
-    public void testFullPathMatchesCaseInsensitive() {
-        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
-        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
-        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
-        ds.setCaseSensitive(false);
-        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
-        ds.setIncludes(new String[] {"alpha/beta/gamma/GAMMA.XML"});
-        ds.scan();
-        compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
-            new String[] {});
-    }
-
-    @Test
-    public void test2ButCaseInsensitive() {
-        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
-        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
-        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
-        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
-        ds.setIncludes(new String[] {"ALPHA/"});
-        ds.setCaseSensitive(false);
-        ds.scan();
-        compareFiles(ds, new String[] {"alpha/beta/beta.xml",
-                                       "alpha/beta/gamma/gamma.xml"},
-            new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
-    }
-    
-    @Test
-    public void test2bisButCaseInsensitive() {
-        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
-        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
-	    FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
-	    ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
-	    ds.setIncludes(new String[] {"alpha/BETA/gamma/"});
-	    ds.setCaseSensitive(false);
-	    ds.scan();
-	    compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
-	        new String[] {"alpha/beta/gamma"});
-    }
-    
-    @Test
-    public void testGetWithSelector() {
-    	buildRule.executeTarget("ftp-get-with-selector");
-    	assertContains("selectors are not supported in remote filesets", buildRule.getLog());
-        FileSet fsDestination = (FileSet) buildRule.getProject().getReference("fileset-destination-without-selector");
-        DirectoryScanner dsDestination = fsDestination.getDirectoryScanner(buildRule.getProject());
-        dsDestination.scan();
-        String [] sortedDestinationDirectories = dsDestination.getIncludedDirectories();
-        String [] sortedDestinationFiles = dsDestination.getIncludedFiles();
-        for (int counter = 0; counter < sortedDestinationDirectories.length; counter++) {
-            sortedDestinationDirectories[counter] =
-                sortedDestinationDirectories[counter].replace(File.separatorChar, '/');
-        }
-        for (int counter = 0; counter < sortedDestinationFiles.length; counter++) {
-            sortedDestinationFiles[counter] =
-                sortedDestinationFiles[counter].replace(File.separatorChar, '/');
-        }
-        FileSet fsSource =  (FileSet) buildRule.getProject().getReference("fileset-source-without-selector");
-        DirectoryScanner dsSource = fsSource.getDirectoryScanner(buildRule.getProject());
-        dsSource.scan();
-        compareFiles(dsSource, sortedDestinationFiles, sortedDestinationDirectories);
-    }
-    
-    @Test
-    public void testGetFollowSymlinksTrue() {
-        Assume.assumeTrue("System does not support Symlinks", supportsSymlinks);
-        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
-        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
-        buildRule.getProject().executeTarget("ftp-get-directory-symbolic-link");
-        FileSet fsDestination = (FileSet) buildRule.getProject().getReference("fileset-destination-without-selector");
-        DirectoryScanner dsDestination = fsDestination.getDirectoryScanner(buildRule.getProject());
-        dsDestination.scan();
-        compareFiles(dsDestination, new String[] {"alpha/beta/gamma/gamma.xml"},
-            new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
-    }
-    
-    @Test
-    public void testGetFollowSymlinksFalse() {
-        Assume.assumeTrue("System does not support Symlinks", supportsSymlinks);
-        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
-        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
-        buildRule.getProject().executeTarget("ftp-get-directory-no-symbolic-link");
-        FileSet fsDestination = (FileSet) buildRule.getProject().getReference("fileset-destination-without-selector");
-        DirectoryScanner dsDestination = fsDestination.getDirectoryScanner(buildRule.getProject());
-        dsDestination.scan();
-        compareFiles(dsDestination, new String[] {},
-            new String[] {});
-    }
-    
-    @Test
-    public void testAllowSymlinks() {
-        Assume.assumeTrue("System does not support Symlinks", supportsSymlinks);
-        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
-        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
-        buildRule.getProject().executeTarget("symlink-setup");
-        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
-        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
-        ds.setIncludes(new String[] {"alpha/beta/gamma/"});
-        ds.setFollowSymlinks(true);
-        ds.scan();
-        compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
-                     new String[] {"alpha/beta/gamma"});
-    }
-
-    @Test
-    public void testProhibitSymlinks() {
-        Assume.assumeTrue("System does not support Symlinks", supportsSymlinks);
-        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
-        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
-        buildRule.getProject().executeTarget("symlink-setup");
-        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
-        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
-        ds.setIncludes(new String[] {"alpha/beta/gamma/"});
-        ds.setFollowSymlinks(false);
-        ds.scan();
-        compareFiles(ds, new String[] {}, new String[] {});
-    }
-    
-    @Test
-    public void testFileSymlink() {
-        Assume.assumeTrue("System does not support Symlinks", supportsSymlinks);
-        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
-        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
-        buildRule.getProject().executeTarget("symlink-file-setup");
-        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
-        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
-        ds.setIncludes(new String[] {"alpha/beta/gamma/"});
-        ds.setFollowSymlinks(true);
-        ds.scan();
-        compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
-                     new String[] {"alpha/beta/gamma"});
-    }
-    
-    // father and child pattern test
-    @Test
-    public void testOrderOfIncludePatternsIrrelevant() {
-        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
-        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
-        String [] expectedFiles = {"alpha/beta/beta.xml",
-                                   "alpha/beta/gamma/gamma.xml"};
-        String [] expectedDirectories = {"alpha/beta", "alpha/beta/gamma" };
-        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
-        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
-        ds.setIncludes(new String[] {"alpha/be?a/**", "alpha/beta/gamma/"});
-        ds.scan();
-        compareFiles(ds, expectedFiles, expectedDirectories);
-        // redo the test, but the 2 include patterns are inverted
-        ds = myFTPTask.newScanner(ftp);
-        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
-        ds.setIncludes(new String[] {"alpha/beta/gamma/", "alpha/be?a/**"});
-        ds.scan();
-        compareFiles(ds, expectedFiles, expectedDirectories);
-    }
-
-    @Test
-    public void testPatternsDifferInCaseScanningSensitive() {
-        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
-        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
-        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
-        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
-        ds.setIncludes(new String[] {"alpha/", "ALPHA/"});
-        ds.scan();
-        compareFiles(ds, new String[] {"alpha/beta/beta.xml",
-                                       "alpha/beta/gamma/gamma.xml"},
-                     new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
-    }
-
-    @Test
-    public void testPatternsDifferInCaseScanningInsensitive() {
-        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
-        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
-        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
-        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
-        ds.setIncludes(new String[] {"alpha/", "ALPHA/"});
-        ds.setCaseSensitive(false);
-        ds.scan();
-        compareFiles(ds, new String[] {"alpha/beta/beta.xml",
-                                       "alpha/beta/gamma/gamma.xml"},
-                     new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
-    }
-
-    @Test
-    public void testFullpathDiffersInCaseScanningSensitive() {
-        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
-        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
-        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
-        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
-        ds.setIncludes(new String[] {
-            "alpha/beta/gamma/gamma.xml",
-            "alpha/beta/gamma/GAMMA.XML"
-        });
-        ds.scan();
-        compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
-                     new String[] {});
-    }
-
-    @Test
-    public void testFullpathDiffersInCaseScanningInsensitive() {
-        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
-        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
-        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
-        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
-        ds.setIncludes(new String[] {
-            "alpha/beta/gamma/gamma.xml",
-            "alpha/beta/gamma/GAMMA.XML"
-        });
-        ds.setCaseSensitive(false);
-        ds.scan();
-        compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
-                     new String[] {});
-    }
-
-    @Test
-    public void testParentDiffersInCaseScanningSensitive() {
-        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
-        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
-        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
-        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
-        ds.setIncludes(new String[] {"alpha/", "ALPHA/beta/"});
-        ds.scan();
-        compareFiles(ds, new String[] {"alpha/beta/beta.xml",
-                                       "alpha/beta/gamma/gamma.xml"},
-                     new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
-    }
-
-    @Test
-    public void testParentDiffersInCaseScanningInsensitive() {
-        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
-        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
-        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
-        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
-        ds.setIncludes(new String[] {"alpha/", "ALPHA/beta/"});
-        ds.setCaseSensitive(false);
-        ds.scan();
-        compareFiles(ds, new String[] {"alpha/beta/beta.xml",
-                                       "alpha/beta/gamma/gamma.xml"},
-                     new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
-    }
-
-    @Test
-    public void testExcludeOneFile() {
-        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
-        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
-        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
-        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
-        ds.setIncludes(new String[] {
-            "**/*.xml"
-        });
-        ds.setExcludes(new String[] {
-            "alpha/beta/b*xml"
-        });
-        ds.scan();
-        compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
-                     new String[] {});
-    }
-    
-    @Test
-    public void testExcludeHasPrecedence() {
-        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
-        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
-        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
-        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
-        ds.setIncludes(new String[] {
-            "alpha/**"
-        });
-        ds.setExcludes(new String[] {
-            "alpha/**"
-        });
-        ds.scan();
-        compareFiles(ds, new String[] {},
-                     new String[] {});
-
-    }
-    
-    @Test
-    public void testAlternateIncludeExclude() {
-        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
-        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
-        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
-        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
-        ds.setIncludes(new String[] {
-            "alpha/**",
-            "alpha/beta/gamma/**"
-        });
-        ds.setExcludes(new String[] {
-            "alpha/beta/**"
-        });
-        ds.scan();
-        compareFiles(ds, new String[] {},
-                     new String[] {"alpha"});
-
-    }
-    
-    @Test
-    public void testAlternateExcludeInclude() {
-        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
-        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
-        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
-        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
-        ds.setExcludes(new String[] {
-            "alpha/**",
-            "alpha/beta/gamma/**"
-        });
-        ds.setIncludes(new String[] {
-            "alpha/beta/**"
-        });
-        ds.scan();
-        compareFiles(ds, new String[] {},
-                     new String[] {});
-
-    }
-    
-    /**
-     * Test inspired by Bug#1415.
-     */
-    @Test
-    public void testChildrenOfExcludedDirectory() {
-        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
-        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
-        buildRule.getProject().executeTarget("children-of-excluded-dir-setup");
-        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
-        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
-        ds.setExcludes(new String[] {"alpha/**"});
-        ds.scan();
-        compareFiles(ds, new String[] {"delta/delta.xml"},
-                    new String[] {"delta"});
-
-        ds = myFTPTask.newScanner(ftp);
-        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
-        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
-        ds.setExcludes(new String[] {"alpha"});
-        ds.scan();
-        compareFiles(ds, new String[] {"alpha/beta/beta.xml",
-                                       "alpha/beta/gamma/gamma.xml",
-                                        "delta/delta.xml"},
-                     new String[] {"alpha/beta", "alpha/beta/gamma", "delta"});
-
-    }
-    
-    /**
-     * This class enables the use of the log messages as a way of testing 
-     * the number of files actually transferred.
-     * It uses the ant regular expression mechanism to get a regex parser
-     * to parse the log output.
-     */
-    private class CountLogListener extends DefaultLogger {
-        private Vector lastMatchGroups = null;
-        private RegexpMatcher matcher = new RegexpMatcherFactory().newRegexpMatcher();
-
-        /**
-         * The only constructor for a CountLogListener
-         * @param pattern a regular expression pattern.  It should have 
-         * one parenthesized group and that group should contain the
-         * number desired.
-         */
-        public CountLogListener(String pattern) {
-            super();
-            this.matcher.setPattern(pattern);
-        }
-        
-        
-        /* 
-         * @param event the build event that is being logged.
-         */
-        public void messageLogged(BuildEvent event) {
-            String message = event.getMessage();
-            if (this.matcher.matches(message)) {
-                lastMatchGroups = this.matcher.getGroups(message);
-            }
-            super.messageLogged(event);
-        }
-        
-        /**
-         * returns the desired number that results from parsing the log
-         * message
-         * @return the number of files indicated in the desired message or -1
-         * if a matching log message was never found.
-         */
-        public int getCount() {
-            if (this.lastMatchGroups == null) {
-                return -1;
-            }
-            return Integer.parseInt((String) this.lastMatchGroups.get(1));
-        }
-    }
-    
-    /**
-     * This class enables the use of the log to count the number
-     * of times a message has been emitted.
-     */
-    private class LogCounter extends DefaultLogger {
-        private Map searchMap = new HashMap();
-        private int matchCount;
-
-        public void addLogMessageToSearch(String message) {
-            searchMap.put(message, new Integer(0));
-        }
-        
-        /* 
-         * @param event the build event that is being logged.
-         */
-        public void messageLogged(BuildEvent event) {
-            String message = event.getMessage();
-            Integer mcnt = (Integer) searchMap.get(message);
-            if (null != mcnt) {
-                searchMap.put(message, new Integer(mcnt.intValue() + 1));
-            }
-            super.messageLogged(event);
-        }
-        
-        /**
-         * @return the number of times that the looked for message was sent 
-         * to the log
-         */
-        public int getMatchCount(String message) {
-            Integer mcnt = (Integer) searchMap.get(message);
-            if (null != mcnt) {
-                return mcnt.intValue();
-            }
-            return 0;
-        }
-    }
-    /**
-     * Tests the combination of the newer parameter and the 
-     * serverTimezoneConfig  parameter in the PUT action.  The default 
-     * configuration is an ftp server on localhost which formats 
-     * timestamps as GMT.
-     */
-    @Test
-    public void testTimezonePut() {
-        CountLogListener log = new CountLogListener("(\\d+) files? sent");
-        buildRule.getProject().executeTarget("timed.test.setup");
-        buildRule.getProject().addBuildListener(log);
-        buildRule.getProject().executeTarget("timed.test.put.older");
-        assertEquals(1, log.getCount());
-    }
-
-    /**
-     * Tests the combination of the newer parameter and the 
-     * serverTimezoneConfig  parameter in the GET action.  The default 
-     * configuration is an ftp server on localhost which formats 
-     * timestamps as GMT.
-     */
-    @Test
-    public void testTimezoneGet() {
-        CountLogListener log = new CountLogListener("(\\d+) files? retrieved");
-        buildRule.getProject().executeTarget("timed.test.setup");
-        buildRule.getProject().addBuildListener(log);
-        buildRule.getProject().executeTarget("timed.test.get.older");
-        assertEquals(3, log.getCount());
-    }
-   
-    
-    /**
-     * Tests that the presence of one of the server config params forces
-     * the system type to Unix if not specified.
-     */
-    @Test
-    public void testConfiguration1() {
-        int[] expectedCounts = {
-                1,1,0,1,0,0,0
-        };
-        performConfigTest("configuration.1", expectedCounts);
-        
-    }
-
-    /**
-     * Tests the systemTypeKey attribute.
-     */
-    @Test
-    public void testConfiguration2() {
-        int[] expectedCounts = {
-                1,0,0,1,1,0,0
-        };
-        performConfigTest("configuration.2", expectedCounts);
-        
-    }
-
-    /**
-     * Tests the systemTypeKey attribute with UNIX specified.
-     */
-    @Test
-    public void testConfiguration3() {
-        int[] expectedCounts = {
-                1,0,1,0,0,1,0
-        };
-        performConfigTest("configuration.3", expectedCounts);
-        
-    }
-    
-    @Test
-    public void testConfigurationLang() {
-        int[] expectedCounts = {
-                1,1,0,0,0,0,1
-        };
-        performConfigTest("configuration.lang.good", expectedCounts);
-        
-        try {
-            performConfigTest("configuration.lang.bad", expectedCounts);
-            fail("BuildException Expected");
-        } catch (Exception bx) {
-            assertTrue(bx instanceof BuildException); 
-        }
-    }
-    /**
-     * Tests the systemTypeKey attribute.
-     */
-    @Test
-    public void testConfigurationNone() {
-        int[] expectedCounts = {
-                0,0,0,0,0,0,0
-        };
-        performConfigTest("configuration.none", expectedCounts);
- 
-    }
-    
-    private void performConfigTest(String target, int[] expectedCounts) {
-        String[] messages = new String[]{
-                "custom configuration",
-                "custom config: system key = default (UNIX)",
-                "custom config: system key = UNIX",
-                "custom config: server time zone ID = " + buildRule.getProject().getProperty("ftp.server.timezone"),
-                "custom config: system key = WINDOWS",
-                "custom config: default date format = yyyy/MM/dd HH:mm",
-                "custom config: server language code = de" 
-
-        };
-        LogCounter counter = new LogCounter();
-        for (int i=0; i < messages.length; i++) {
-            counter.addLogMessageToSearch(messages[i]);
-        }
-            
-        buildRule.getProject().addBuildListener(counter);
-        buildRule.getProject().executeTarget(target);
-        for (int i=0; i < messages.length; i++) {
-            assertEquals("target "+target+":message "+ i, expectedCounts[i], counter.getMatchCount(messages[i]));
-        }
-        
-    }
-
-    
-    /**
-     *  this test is inspired by a user reporting that deletions of directories with the ftp task do not work
-     */
-    @Test
-    public void testFTPDelete() {
-        buildRule.getProject().executeTarget("ftp-delete");
-    }
-    
-    private void compareFiles(DirectoryScanner ds, String[] expectedFiles,
-                              String[] expectedDirectories) {
-        String includedFiles[] = ds.getIncludedFiles();
-        String includedDirectories[] = ds.getIncludedDirectories();
-        assertEquals("file present: ", expectedFiles.length,
-                     includedFiles.length);
-        assertEquals("directories present: ", expectedDirectories.length,
-                     includedDirectories.length);
-
-        for (int counter=0; counter < includedFiles.length; counter++) {
-            includedFiles[counter] = includedFiles[counter].replace(File.separatorChar, '/');
-        }
-        Arrays.sort(includedFiles);
-        for (int counter=0; counter < includedDirectories.length; counter++) {
-            includedDirectories[counter] = includedDirectories[counter]
-                            .replace(File.separatorChar, '/');
-        }
-        Arrays.sort(includedDirectories);
-        for (int counter=0; counter < includedFiles.length; counter++) {
-            assertEquals(expectedFiles[counter], includedFiles[counter]);
-        }
-        for (int counter=0; counter < includedDirectories.length; counter++) {
-            assertEquals(expectedDirectories[counter], includedDirectories[counter]);
-            counter++;
-        }
-    }
-    private static class myFTP extends FTP {
-        public FTP.FTPDirectoryScanner newScanner(FTPClient client) {
-            return new FTP.FTPDirectoryScanner(client);
-        }
-        // provide public visibility
-        public String resolveFile(String file) {
-            return super.resolveFile(file);
-        }
-    }
-
-
-    public abstract static class myRetryableFTP extends FTP {
-        private final int numberOfFailuresToSimulate;
-        private int simulatedFailuresLeft;
-        
-        protected myRetryableFTP(int numberOfFailuresToSimulate) {
-            this.numberOfFailuresToSimulate = numberOfFailuresToSimulate;
-            this.simulatedFailuresLeft = numberOfFailuresToSimulate;
-        }
-
-        protected void getFile(FTPClient ftp, String dir, String filename)
-                throws IOException, BuildException 
-        {
-            if (this.simulatedFailuresLeft > 0) {
-                this.simulatedFailuresLeft--;
-                throw new IOException("Simulated failure for testing");
-            }
-           super.getFile(ftp, dir, filename);
-        }
-        protected void executeRetryable(RetryHandler h, Retryable r,
-                String filename) throws IOException 
-        {
-            this.simulatedFailuresLeft = this.numberOfFailuresToSimulate;    
-            super.executeRetryable(h, r, filename);
-        }
-    }
-    public static class oneFailureFTP extends myRetryableFTP {
-        public oneFailureFTP() {
-            super(1);
-        }
-    }
-    public static class twoFailureFTP extends myRetryableFTP {
-        public twoFailureFTP() {
-            super(2);
-        }
-    }
-    public static class threeFailureFTP extends myRetryableFTP {
-        public threeFailureFTP() {
-            super(3);
-        }
-    }
-    
-    public static class randomFailureFTP extends myRetryableFTP {
-        public randomFailureFTP() {
-            super(new Random().nextInt(Short.MAX_VALUE));
-        }
-    }
-    public void testGetWithSelectorRetryable1() {
-        buildRule.getProject().addTaskDefinition("ftp", oneFailureFTP.class);
-        try {
-            buildRule.getProject().executeTarget("ftp-get-with-selector-retryable");
-        } catch (BuildException bx) {
-            fail("Two retries expected, failed after one.");
-        }
-    }
-    
-    @Test
-    public void testGetWithSelectorRetryable2() {
-        buildRule.getProject().addTaskDefinition("ftp", twoFailureFTP.class);
-        try {
-            buildRule.getProject().executeTarget("ftp-get-with-selector-retryable");
-        } catch (BuildException bx) {
-            fail("Two retries expected, failed after two.");
-        }
-    }
-    
-    @Test
-    public void testGetWithSelectorRetryable3() {
-        buildRule.getProject().addTaskDefinition("ftp", threeFailureFTP.class);
-        try {
-            buildRule.getProject().executeTarget("ftp-get-with-selector-retryable");
-            fail("Two retries expected, continued after two.");
-        } catch (BuildException bx) {
-        }
-    }
-    
-    @Test
-    public void testGetWithSelectorRetryableRandom() {
-        buildRule.getProject().addTaskDefinition("ftp", randomFailureFTP.class);
-        try {
-            buildRule.getProject().setProperty("ftp.retries", "forever");
-            buildRule.getProject().executeTarget("ftp-get-with-selector-retryable");
-        } catch (BuildException bx) {
-            fail("Retry forever specified, but failed.");
-        }
-    }
-    
-    @Test
-    public void testInitialCommand() {
-        performCommandTest("test-initial-command", new int[] { 1,0 });
-    }
-    
-    @Test
-    public void testSiteAction() {
-        performCommandTest("test-site-action", new int[] { 1,0 });
-    }
-    
-    private void performCommandTest(String target, int[] expectedCounts) {
-        String[] messages = new String[]{
-                "Doing Site Command: umask 222",
-                "Failed to issue Site Command: umask 222",
-
-        };
-        LogCounter counter = new LogCounter();
-        for (int i=0; i < messages.length; i++) {
-            counter.addLogMessageToSearch(messages[i]);
-        }
-            
-        buildRule.getProject().addBuildListener(counter);
-        buildRule.getProject().executeTarget(target);
-        for (int i=0; i < messages.length; i++) {
-            assertEquals("target "+target+":message "+ i, expectedCounts[i], counter.getMatchCount(messages[i]));
-        }
-
-    }
-    
-}
+/*
+ *  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.net;
+
+import static org.apache.tools.ant.AntAssert.assertContains;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+import java.util.Vector;
+
+import org.apache.commons.net.ftp.FTPClient;
+import org.apache.tools.ant.BuildEvent;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileRule;
+import org.apache.tools.ant.DefaultLogger;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.condition.Os;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.util.RetryHandler;
+import org.apache.tools.ant.util.Retryable;
+import org.apache.tools.ant.util.regexp.RegexpMatcher;
+import org.apache.tools.ant.util.regexp.RegexpMatcherFactory;
+import org.junit.After;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+//FIXME these tests are more integration than unit tests and report errors badly
+public class FTPTest {
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    // keep track of what operating systems are supported here.
+    private boolean supportsSymlinks = Os.isFamily("unix");
+
+    private FTPClient ftp;
+
+    private boolean loginSuceeded = false;
+
+    private String loginFailureMessage;
+
+    private String tmpDir = null;
+    private String remoteTmpDir = null;
+    private String ftpFileSep = null;
+    private myFTP myFTPTask = new myFTP();
+
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject("src/etc/testcases/taskdefs/optional/net/ftp.xml");
+        Project project = buildRule.getProject();
+        project.executeTarget("setup");
+        tmpDir = project.getProperty("tmp.dir");
+        ftp = new FTPClient();
+        ftpFileSep = project.getProperty("ftp.filesep");
+        myFTPTask.setSeparator(ftpFileSep);
+        myFTPTask.setProject(project);
+        remoteTmpDir = myFTPTask.resolveFile(tmpDir);
+        String remoteHost = project.getProperty("ftp.host");
+        int port = Integer.parseInt(project.getProperty("ftp.port"));
+        String remoteUser = project.getProperty("ftp.user");
+        String password = project.getProperty("ftp.password");
+        boolean connectionSucceeded = false;
+        try {
+            ftp.connect(remoteHost, port);
+            connectionSucceeded = true;
+        } catch (Exception ex) {
+            loginFailureMessage = "could not connect to host " + remoteHost + " on port " + port;
+        }
+        if (connectionSucceeded) {
+            try {
+                ftp.login(remoteUser, password);
+                loginSuceeded = true;
+            } catch (IOException ioe) {
+                loginFailureMessage = "could not log on to " + remoteHost + " as user " + remoteUser;
+            }
+        }
+    }
+
+    @After
+    public void tearDown() {
+        try {
+            if (ftp!= null) {
+                ftp.disconnect();
+            }
+        } catch (IOException ioe) {
+            // do nothing
+        }
+        buildRule.getProject().executeTarget("cleanup");
+    }
+
+    private boolean changeRemoteDir(String remoteDir) {
+        boolean result = true;
+        try {
+            ftp.cwd(remoteDir);
+        }
+        catch (Exception ex) {
+            System.out.println("could not change directory to " + remoteTmpDir);
+            result = false;
+        }
+        return result;
+    }
+
+    @Test
+    public void test1() {
+        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
+
+        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
+        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
+        ds.setIncludes(new String[] {"alpha"});
+        ds.scan();
+        compareFiles(ds, new String[] {} ,new String[] {"alpha"});
+    }
+
+    @Test
+    public void test2() {
+        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
+        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
+        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
+        ds.setIncludes(new String[] {"alpha/"});
+        ds.scan();
+        compareFiles(ds, new String[] {"alpha/beta/beta.xml",
+                                       "alpha/beta/gamma/gamma.xml"},
+            new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
+    }
+
+    @Test
+    public void test3() {
+        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
+        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
+        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
+        ds.scan();
+        compareFiles(ds, new String[] {"alpha/beta/beta.xml",
+                                       "alpha/beta/gamma/gamma.xml"},
+            new String[] {"alpha", "alpha/beta",
+                          "alpha/beta/gamma"});
+    }
+
+    @Test
+    public void testFullPathMatchesCaseSensitive() {
+        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
+        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
+        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
+        ds.setIncludes(new String[] {"alpha/beta/gamma/GAMMA.XML"});
+        ds.scan();
+        compareFiles(ds, new String[] {}, new String[] {});
+    }
+
+    @Test
+    public void testFullPathMatchesCaseInsensitive() {
+        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
+        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
+        ds.setCaseSensitive(false);
+        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
+        ds.setIncludes(new String[] {"alpha/beta/gamma/GAMMA.XML"});
+        ds.scan();
+        compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
+            new String[] {});
+    }
+
+    @Test
+    public void test2ButCaseInsensitive() {
+        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
+        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
+        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
+        ds.setIncludes(new String[] {"ALPHA/"});
+        ds.setCaseSensitive(false);
+        ds.scan();
+        compareFiles(ds, new String[] {"alpha/beta/beta.xml",
+                                       "alpha/beta/gamma/gamma.xml"},
+            new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
+    }
+
+    @Test
+    public void test2bisButCaseInsensitive() {
+        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
+        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
+        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
+        ds.setIncludes(new String[] {"alpha/BETA/gamma/"});
+        ds.setCaseSensitive(false);
+        ds.scan();
+        compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
+            new String[] {"alpha/beta/gamma"});
+    }
+
+    @Test
+    public void testGetWithSelector() {
+        buildRule.executeTarget("ftp-get-with-selector");
+        assertContains("selectors are not supported in remote filesets", buildRule.getLog());
+        FileSet fsDestination = (FileSet) buildRule.getProject().getReference("fileset-destination-without-selector");
+        DirectoryScanner dsDestination = fsDestination.getDirectoryScanner(buildRule.getProject());
+        dsDestination.scan();
+        String [] sortedDestinationDirectories = dsDestination.getIncludedDirectories();
+        String [] sortedDestinationFiles = dsDestination.getIncludedFiles();
+        for (int counter = 0; counter < sortedDestinationDirectories.length; counter++) {
+            sortedDestinationDirectories[counter] =
+                sortedDestinationDirectories[counter].replace(File.separatorChar, '/');
+        }
+        for (int counter = 0; counter < sortedDestinationFiles.length; counter++) {
+            sortedDestinationFiles[counter] =
+                sortedDestinationFiles[counter].replace(File.separatorChar, '/');
+        }
+        FileSet fsSource =  (FileSet) buildRule.getProject().getReference("fileset-source-without-selector");
+        DirectoryScanner dsSource = fsSource.getDirectoryScanner(buildRule.getProject());
+        dsSource.scan();
+        compareFiles(dsSource, sortedDestinationFiles, sortedDestinationDirectories);
+    }
+
+    @Test
+    public void testGetFollowSymlinksTrue() {
+        Assume.assumeTrue("System does not support Symlinks", supportsSymlinks);
+        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
+        buildRule.getProject().executeTarget("ftp-get-directory-symbolic-link");
+        FileSet fsDestination = (FileSet) buildRule.getProject().getReference("fileset-destination-without-selector");
+        DirectoryScanner dsDestination = fsDestination.getDirectoryScanner(buildRule.getProject());
+        dsDestination.scan();
+        compareFiles(dsDestination, new String[] {"alpha/beta/gamma/gamma.xml"},
+            new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
+    }
+
+    @Test
+    public void testGetFollowSymlinksFalse() {
+        Assume.assumeTrue("System does not support Symlinks", supportsSymlinks);
+        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
+        buildRule.getProject().executeTarget("ftp-get-directory-no-symbolic-link");
+        FileSet fsDestination = (FileSet) buildRule.getProject().getReference("fileset-destination-without-selector");
+        DirectoryScanner dsDestination = fsDestination.getDirectoryScanner(buildRule.getProject());
+        dsDestination.scan();
+        compareFiles(dsDestination, new String[] {},
+            new String[] {});
+    }
+
+    @Test
+    public void testAllowSymlinks() {
+        Assume.assumeTrue("System does not support Symlinks", supportsSymlinks);
+        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
+        buildRule.getProject().executeTarget("symlink-setup");
+        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
+        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
+        ds.setIncludes(new String[] {"alpha/beta/gamma/"});
+        ds.setFollowSymlinks(true);
+        ds.scan();
+        compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
+                     new String[] {"alpha/beta/gamma"});
+    }
+
+    @Test
+    public void testProhibitSymlinks() {
+        Assume.assumeTrue("System does not support Symlinks", supportsSymlinks);
+        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
+        buildRule.getProject().executeTarget("symlink-setup");
+        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
+        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
+        ds.setIncludes(new String[] {"alpha/beta/gamma/"});
+        ds.setFollowSymlinks(false);
+        ds.scan();
+        compareFiles(ds, new String[] {}, new String[] {});
+    }
+
+    @Test
+    public void testFileSymlink() {
+        Assume.assumeTrue("System does not support Symlinks", supportsSymlinks);
+        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
+        buildRule.getProject().executeTarget("symlink-file-setup");
+        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
+        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
+        ds.setIncludes(new String[] {"alpha/beta/gamma/"});
+        ds.setFollowSymlinks(true);
+        ds.scan();
+        compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
+                     new String[] {"alpha/beta/gamma"});
+    }
+
+    // father and child pattern test
+    @Test
+    public void testOrderOfIncludePatternsIrrelevant() {
+        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
+        String [] expectedFiles = {"alpha/beta/beta.xml",
+                                   "alpha/beta/gamma/gamma.xml"};
+        String [] expectedDirectories = {"alpha/beta", "alpha/beta/gamma" };
+        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
+        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
+        ds.setIncludes(new String[] {"alpha/be?a/**", "alpha/beta/gamma/"});
+        ds.scan();
+        compareFiles(ds, expectedFiles, expectedDirectories);
+        // redo the test, but the 2 include patterns are inverted
+        ds = myFTPTask.newScanner(ftp);
+        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
+        ds.setIncludes(new String[] {"alpha/beta/gamma/", "alpha/be?a/**"});
+        ds.scan();
+        compareFiles(ds, expectedFiles, expectedDirectories);
+    }
+
+    @Test
+    public void testPatternsDifferInCaseScanningSensitive() {
+        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
+        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
+        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
+        ds.setIncludes(new String[] {"alpha/", "ALPHA/"});
+        ds.scan();
+        compareFiles(ds, new String[] {"alpha/beta/beta.xml",
+                                       "alpha/beta/gamma/gamma.xml"},
+                     new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
+    }
+
+    @Test
+    public void testPatternsDifferInCaseScanningInsensitive() {
+        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
+        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
+        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
+        ds.setIncludes(new String[] {"alpha/", "ALPHA/"});
+        ds.setCaseSensitive(false);
+        ds.scan();
+        compareFiles(ds, new String[] {"alpha/beta/beta.xml",
+                                       "alpha/beta/gamma/gamma.xml"},
+                     new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
+    }
+
+    @Test
+    public void testFullpathDiffersInCaseScanningSensitive() {
+        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
+        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
+        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
+        ds.setIncludes(new String[] {
+            "alpha/beta/gamma/gamma.xml",
+            "alpha/beta/gamma/GAMMA.XML"
+        });
+        ds.scan();
+        compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
+                     new String[] {});
+    }
+
+    @Test
+    public void testFullpathDiffersInCaseScanningInsensitive() {
+        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
+        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
+        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
+        ds.setIncludes(new String[] {
+            "alpha/beta/gamma/gamma.xml",
+            "alpha/beta/gamma/GAMMA.XML"
+        });
+        ds.setCaseSensitive(false);
+        ds.scan();
+        compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
+                     new String[] {});
+    }
+
+    @Test
+    public void testParentDiffersInCaseScanningSensitive() {
+        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
+        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
+        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
+        ds.setIncludes(new String[] {"alpha/", "ALPHA/beta/"});
+        ds.scan();
+        compareFiles(ds, new String[] {"alpha/beta/beta.xml",
+                                       "alpha/beta/gamma/gamma.xml"},
+                     new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
+    }
+
+    @Test
+    public void testParentDiffersInCaseScanningInsensitive() {
+        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
+        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
+        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
+        ds.setIncludes(new String[] {"alpha/", "ALPHA/beta/"});
+        ds.setCaseSensitive(false);
+        ds.scan();
+        compareFiles(ds, new String[] {"alpha/beta/beta.xml",
+                                       "alpha/beta/gamma/gamma.xml"},
+                     new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
+    }
+
+    @Test
+    public void testExcludeOneFile() {
+        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
+        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
+        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
+        ds.setIncludes(new String[] {
+            "**/*.xml"
+        });
+        ds.setExcludes(new String[] {
+            "alpha/beta/b*xml"
+        });
+        ds.scan();
+        compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
+                     new String[] {});
+    }
+
+    @Test
+    public void testExcludeHasPrecedence() {
+        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
+        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
+        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
+        ds.setIncludes(new String[] {
+            "alpha/**"
+        });
+        ds.setExcludes(new String[] {
+            "alpha/**"
+        });
+        ds.scan();
+        compareFiles(ds, new String[] {},
+                     new String[] {});
+
+    }
+
+    @Test
+    public void testAlternateIncludeExclude() {
+        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
+        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
+        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
+        ds.setIncludes(new String[] {
+            "alpha/**",
+            "alpha/beta/gamma/**"
+        });
+        ds.setExcludes(new String[] {
+            "alpha/beta/**"
+        });
+        ds.scan();
+        compareFiles(ds, new String[] {},
+                     new String[] {"alpha"});
+
+    }
+
+    @Test
+    public void testAlternateExcludeInclude() {
+        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
+        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
+        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
+        ds.setExcludes(new String[] {
+            "alpha/**",
+            "alpha/beta/gamma/**"
+        });
+        ds.setIncludes(new String[] {
+            "alpha/beta/**"
+        });
+        ds.scan();
+        compareFiles(ds, new String[] {},
+                     new String[] {});
+
+    }
+
+    /**
+     * Test inspired by Bug#1415.
+     */
+    @Test
+    public void testChildrenOfExcludedDirectory() {
+        Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
+        buildRule.getProject().executeTarget("children-of-excluded-dir-setup");
+        FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
+        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
+        ds.setExcludes(new String[] {"alpha/**"});
+        ds.scan();
+        compareFiles(ds, new String[] {"delta/delta.xml"},
+                    new String[] {"delta"});
+
+        ds = myFTPTask.newScanner(ftp);
+        Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
+        ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
+        ds.setExcludes(new String[] {"alpha"});
+        ds.scan();
+        compareFiles(ds, new String[] {"alpha/beta/beta.xml",
+                                       "alpha/beta/gamma/gamma.xml",
+                                        "delta/delta.xml"},
+                     new String[] {"alpha/beta", "alpha/beta/gamma", "delta"});
+
+    }
+
+    /**
+     * This class enables the use of the log messages as a way of testing
+     * the number of files actually transferred.
+     * It uses the ant regular expression mechanism to get a regex parser
+     * to parse the log output.
+     */
+    private class CountLogListener extends DefaultLogger {
+        private Vector lastMatchGroups = null;
+        private RegexpMatcher matcher = new RegexpMatcherFactory().newRegexpMatcher();
+
+        /**
+         * The only constructor for a CountLogListener
+         * @param pattern a regular expression pattern.  It should have
+         * one parenthesized group and that group should contain the
+         * number desired.
+         */
+        public CountLogListener(String pattern) {
+            super();
+            this.matcher.setPattern(pattern);
+        }
+
+
+        /*
+         * @param event the build event that is being logged.
+         */
+        public void messageLogged(BuildEvent event) {
+            String message = event.getMessage();
+            if (this.matcher.matches(message)) {
+                lastMatchGroups = this.matcher.getGroups(message);
+            }
+            super.messageLogged(event);
+        }
+
+        /**
+         * returns the desired number that results from parsing the log
+         * message
+         * @return the number of files indicated in the desired message or -1
+         * if a matching log message was never found.
+         */
+        public int getCount() {
+            if (this.lastMatchGroups == null) {
+                return -1;
+            }
+            return Integer.parseInt((String) this.lastMatchGroups.get(1));
+        }
+    }
+
+    /**
+     * This class enables the use of the log to count the number
+     * of times a message has been emitted.
+     */
+    private class LogCounter extends DefaultLogger {
+        private Map searchMap = new HashMap();
+        private int matchCount;
+
+        public void addLogMessageToSearch(String message) {
+            searchMap.put(message, new Integer(0));
+        }
+
+        /*
+         * @param event the build event that is being logged.
+         */
+        public void messageLogged(BuildEvent event) {
+            String message = event.getMessage();
+            Integer mcnt = (Integer) searchMap.get(message);
+            if (null != mcnt) {
+                searchMap.put(message, new Integer(mcnt.intValue() + 1));
+            }
+            super.messageLogged(event);
+        }
+
+        /**
+         * @return the number of times that the looked for message was sent
+         * to the log
+         */
+        public int getMatchCount(String message) {
+            Integer mcnt = (Integer) searchMap.get(message);
+            if (null != mcnt) {
+                return mcnt.intValue();
+            }
+            return 0;
+        }
+    }
+    /**
+     * Tests the combination of the newer parameter and the
+     * serverTimezoneConfig  parameter in the PUT action.  The default
+     * configuration is an ftp server on localhost which formats
+     * timestamps as GMT.
+     */
+    @Test
+    public void testTimezonePut() {
+        CountLogListener log = new CountLogListener("(\\d+) files? sent");
+        buildRule.getProject().executeTarget("timed.test.setup");
+        buildRule.getProject().addBuildListener(log);
+        buildRule.getProject().executeTarget("timed.test.put.older");
+        assertEquals(1, log.getCount());
+    }
+
+    /**
+     * Tests the combination of the newer parameter and the
+     * serverTimezoneConfig  parameter in the GET action.  The default
+     * configuration is an ftp server on localhost which formats
+     * timestamps as GMT.
+     */
+    @Test
+    public void testTimezoneGet() {
+        CountLogListener log = new CountLogListener("(\\d+) files? retrieved");
+        buildRule.getProject().executeTarget("timed.test.setup");
+        buildRule.getProject().addBuildListener(log);
+        buildRule.getProject().executeTarget("timed.test.get.older");
+        assertEquals(3, log.getCount());
+    }
+
+
+    /**
+     * Tests that the presence of one of the server config params forces
+     * the system type to Unix if not specified.
+     */
+    @Test
+    public void testConfiguration1() {
+        int[] expectedCounts = {
+                1,1,0,1,0,0,0
+        };
+        performConfigTest("configuration.1", expectedCounts);
+
+    }
+
+    /**
+     * Tests the systemTypeKey attribute.
+     */
+    @Test
+    public void testConfiguration2() {
+        int[] expectedCounts = {
+                1,0,0,1,1,0,0
+        };
+        performConfigTest("configuration.2", expectedCounts);
+
+    }
+
+    /**
+     * Tests the systemTypeKey attribute with UNIX specified.
+     */
+    @Test
+    public void testConfiguration3() {
+        int[] expectedCounts = {
+                1,0,1,0,0,1,0
+        };
+        performConfigTest("configuration.3", expectedCounts);
+
+    }
+
+    @Test
+    public void testConfigurationLang() {
+        int[] expectedCounts = {
+                1,1,0,0,0,0,1
+        };
+        performConfigTest("configuration.lang.good", expectedCounts);
+
+        try {
+            performConfigTest("configuration.lang.bad", expectedCounts);
+            fail("BuildException Expected");
+        } catch (Exception bx) {
+            assertTrue(bx instanceof BuildException);
+        }
+    }
+    /**
+     * Tests the systemTypeKey attribute.
+     */
+    @Test
+    public void testConfigurationNone() {
+        int[] expectedCounts = {
+                0,0,0,0,0,0,0
+        };
+        performConfigTest("configuration.none", expectedCounts);
+
+    }
+
+    private void performConfigTest(String target, int[] expectedCounts) {
+        String[] messages = new String[]{
+                "custom configuration",
+                "custom config: system key = default (UNIX)",
+                "custom config: system key = UNIX",
+                "custom config: server time zone ID = " + buildRule.getProject().getProperty("ftp.server.timezone"),
+                "custom config: system key = WINDOWS",
+                "custom config: default date format = yyyy/MM/dd HH:mm",
+                "custom config: server language code = de"
+
+        };
+        LogCounter counter = new LogCounter();
+        for (int i=0; i < messages.length; i++) {
+            counter.addLogMessageToSearch(messages[i]);
+        }
+
+        buildRule.getProject().addBuildListener(counter);
+        buildRule.getProject().executeTarget(target);
+        for (int i=0; i < messages.length; i++) {
+            assertEquals("target "+target+":message "+ i, expectedCounts[i], counter.getMatchCount(messages[i]));
+        }
+
+    }
+
+
+    /**
+     *  this test is inspired by a user reporting that deletions of directories with the ftp task do not work
+     */
+    @Test
+    public void testFTPDelete() {
+        buildRule.getProject().executeTarget("ftp-delete");
+    }
+
+    private void compareFiles(DirectoryScanner ds, String[] expectedFiles,
+                              String[] expectedDirectories) {
+        String includedFiles[] = ds.getIncludedFiles();
+        String includedDirectories[] = ds.getIncludedDirectories();
+        assertEquals("file present: ", expectedFiles.length,
+                     includedFiles.length);
+        assertEquals("directories present: ", expectedDirectories.length,
+                     includedDirectories.length);
+
+        for (int counter=0; counter < includedFiles.length; counter++) {
+            includedFiles[counter] = includedFiles[counter].replace(File.separatorChar, '/');
+        }
+        Arrays.sort(includedFiles);
+        for (int counter=0; counter < includedDirectories.length; counter++) {
+            includedDirectories[counter] = includedDirectories[counter]
+                            .replace(File.separatorChar, '/');
+        }
+        Arrays.sort(includedDirectories);
+        for (int counter=0; counter < includedFiles.length; counter++) {
+            assertEquals(expectedFiles[counter], includedFiles[counter]);
+        }
+        for (int counter=0; counter < includedDirectories.length; counter++) {
+            assertEquals(expectedDirectories[counter], includedDirectories[counter]);
+            counter++;
+        }
+    }
+    private static class myFTP extends FTP {
+        public FTP.FTPDirectoryScanner newScanner(FTPClient client) {
+            return new FTP.FTPDirectoryScanner(client);
+        }
+        // provide public visibility
+        public String resolveFile(String file) {
+            return super.resolveFile(file);
+        }
+    }
+
+
+    public abstract static class myRetryableFTP extends FTP {
+        private final int numberOfFailuresToSimulate;
+        private int simulatedFailuresLeft;
+
+        protected myRetryableFTP(int numberOfFailuresToSimulate) {
+            this.numberOfFailuresToSimulate = numberOfFailuresToSimulate;
+            this.simulatedFailuresLeft = numberOfFailuresToSimulate;
+        }
+
+        protected void getFile(FTPClient ftp, String dir, String filename)
+                throws IOException, BuildException
+        {
+            if (this.simulatedFailuresLeft > 0) {
+                this.simulatedFailuresLeft--;
+                throw new IOException("Simulated failure for testing");
+            }
+           super.getFile(ftp, dir, filename);
+        }
+        protected void executeRetryable(RetryHandler h, Retryable r,
+                String filename) throws IOException
+        {
+            this.simulatedFailuresLeft = this.numberOfFailuresToSimulate;
+            super.executeRetryable(h, r, filename);
+        }
+    }
+    public static class oneFailureFTP extends myRetryableFTP {
+        public oneFailureFTP() {
+            super(1);
+        }
+    }
+    public static class twoFailureFTP extends myRetryableFTP {
+        public twoFailureFTP() {
+            super(2);
+        }
+    }
+    public static class threeFailureFTP extends myRetryableFTP {
+        public threeFailureFTP() {
+            super(3);
+        }
+    }
+
+    public static class randomFailureFTP extends myRetryableFTP {
+        public randomFailureFTP() {
+            super(new Random().nextInt(Short.MAX_VALUE));
+        }
+    }
+    public void testGetWithSelectorRetryable1() {
+        buildRule.getProject().addTaskDefinition("ftp", oneFailureFTP.class);
+        try {
+            buildRule.getProject().executeTarget("ftp-get-with-selector-retryable");
+        } catch (BuildException bx) {
+            fail("Two retries expected, failed after one.");
+        }
+    }
+
+    @Test
+    public void testGetWithSelectorRetryable2() {
+        buildRule.getProject().addTaskDefinition("ftp", twoFailureFTP.class);
+        try {
+            buildRule.getProject().executeTarget("ftp-get-with-selector-retryable");
+        } catch (BuildException bx) {
+            fail("Two retries expected, failed after two.");
+        }
+    }
+
+    @Test
+    public void testGetWithSelectorRetryable3() {
+        buildRule.getProject().addTaskDefinition("ftp", threeFailureFTP.class);
+        try {
+            buildRule.getProject().executeTarget("ftp-get-with-selector-retryable");
+            fail("Two retries expected, continued after two.");
+        } catch (BuildException bx) {
+        }
+    }
+
+    @Test
+    public void testGetWithSelectorRetryableRandom() {
+        buildRule.getProject().addTaskDefinition("ftp", randomFailureFTP.class);
+        try {
+            buildRule.getProject().setProperty("ftp.retries", "forever");
+            buildRule.getProject().executeTarget("ftp-get-with-selector-retryable");
+        } catch (BuildException bx) {
+            fail("Retry forever specified, but failed.");
+        }
+    }
+
+    @Test
+    public void testInitialCommand() {
+        performCommandTest("test-initial-command", new int[] { 1,0 });
+    }
+
+    @Test
+    public void testSiteAction() {
+        performCommandTest("test-site-action", new int[] { 1,0 });
+    }
+
+    private void performCommandTest(String target, int[] expectedCounts) {
+        String[] messages = new String[]{
+                "Doing Site Command: umask 222",
+                "Failed to issue Site Command: umask 222",
+
+        };
+        LogCounter counter = new LogCounter();
+        for (int i=0; i < messages.length; i++) {
+            counter.addLogMessageToSearch(messages[i]);
+        }
+
+        buildRule.getProject().addBuildListener(counter);
+        buildRule.getProject().executeTarget(target);
+        for (int i=0; i < messages.length; i++) {
+            assertEquals("target "+target+":message "+ i, expectedCounts[i], counter.getMatchCount(messages[i]));
+        }
+
+    }
+
+}


[14/21] ant git commit: Normalise tabulation and line breaks

Posted by gi...@apache.org.
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/taskdefs/optional/vss/MSVSSTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/vss/MSVSSTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/vss/MSVSSTest.java
index 88a08de..aa96d8d 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/vss/MSVSSTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/vss/MSVSSTest.java
@@ -1,475 +1,475 @@
-/*
- *  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.vss;
-
-import java.io.File;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.TimeZone;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.BuildFileRule;
-import org.apache.tools.ant.Location;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.Tstamp;
-import org.apache.tools.ant.types.Commandline;
-import org.apache.tools.ant.types.Path;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-/**
- *  Testcase to ensure that command line generation and required attributes are correct.
- *
- */
-public class MSVSSTest implements MSVSSConstants {
-
-    private Commandline commandline;
-
-    private static final String VSS_PROJECT_PATH = "/SourceRoot/Project";
-    private static final String DS_VSS_PROJECT_PATH = "$/SourceRoot/Project";
-    private static final String VSS_USERNAME = "ant";
-    private static final String VSS_PASSWORD = "rocks";
-    private static final String LOCAL_PATH = "testdir";
-    private static final String SRC_LABEL = "label1";
-    private static final String LONG_LABEL = "123456789012345678901234567890";
-    private static final String SRC_COMMENT = "I fixed a bug";
-    private static final String VERSION = "007";
-    private static final String DATE = "00-00-00";
-    private static final String DATE2 = "01-01-01";
-    private static final String OUTPUT = "output.log";
-    private static final String SS_DIR = "c:/winnt".replace('/', File.separatorChar);
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-    private Project project;
-
-    @Before
-    public void setUp(){
-        project = new Project();
-        project.setBasedir(".");
-        project.init();
-    }
-
-    @After
-    public void tearDown() {
-        File file = new File(project.getBaseDir(), LOCAL_PATH);
-        if (file.exists()) {
-            file.delete();
-        }
-    }
-
-    @Test
-    public void testGetCommandLine() {
-        String[] sTestCmdLine = {MSVSS.SS_EXE, MSVSS.COMMAND_GET, DS_VSS_PROJECT_PATH,
-                MSVSS.FLAG_OVERRIDE_WORKING_DIR + project.getBaseDir()
-                        .getAbsolutePath()
-                 + File.separator + LOCAL_PATH, MSVSS.FLAG_AUTORESPONSE_DEF,
-                MSVSS.FLAG_RECURSION, MSVSS.FLAG_VERSION + VERSION, MSVSS.FLAG_LOGIN
-                 + VSS_USERNAME + "," + VSS_PASSWORD, FLAG_FILETIME_UPDATED, FLAG_SKIP_WRITABLE};
-
-        // Set up a VSSGet task
-        MSVSSGET vssGet = new MSVSSGET();
-        vssGet.setProject(project);
-        vssGet.setRecursive(true);
-        vssGet.setLocalpath(new Path(project, LOCAL_PATH));
-        vssGet.setLogin(VSS_USERNAME + "," + VSS_PASSWORD);
-        vssGet.setVersion(VERSION);
-        vssGet.setQuiet(false);
-        vssGet.setDate(DATE);
-        vssGet.setLabel(SRC_LABEL);
-        vssGet.setVsspath(VSS_PROJECT_PATH);
-        MSVSS.CurrentModUpdated cmu = new MSVSS.CurrentModUpdated();
-        cmu.setValue(TIME_UPDATED);
-        vssGet.setFileTimeStamp(cmu);
-        MSVSS.WritableFiles wf = new MSVSS.WritableFiles();
-        wf.setValue(WRITABLE_SKIP);
-        vssGet.setWritableFiles(wf);
-
-        commandline = vssGet.buildCmdLine();
-
-        checkCommandLines(sTestCmdLine, commandline.getCommandline());
-    }
-
-    /**  Tests VSSGet required attributes.  */
-    @Test
-    public void testGetExceptions() {
-        buildRule.configureProject("src/etc/testcases/taskdefs/optional/vss/vss.xml");
-        expectSpecificBuildException("vssget.1", "some cause", "vsspath attribute must be set!");
-    }
-
-    /**  Tests Label commandline generation.  */
-    @Test
-    public void testLabelCommandLine1() {
-        String[] sTestCmdLine = {MSVSS.SS_EXE, MSVSS.COMMAND_LABEL, DS_VSS_PROJECT_PATH,
-                MSVSS.FLAG_COMMENT + SRC_COMMENT, MSVSS.FLAG_AUTORESPONSE_YES,
-                MSVSS.FLAG_LABEL + SRC_LABEL, MSVSS.FLAG_VERSION + VERSION, MSVSS.FLAG_LOGIN
-                 + VSS_USERNAME + "," + VSS_PASSWORD};
-
-        // Set up a VSSLabel task
-        MSVSSLABEL vssLabel = new MSVSSLABEL();
-        vssLabel.setProject(project);
-        vssLabel.setComment(SRC_COMMENT);
-        vssLabel.setLogin(VSS_USERNAME + "," + VSS_PASSWORD);
-        vssLabel.setVersion(VERSION);
-        vssLabel.setAutoresponse("Y");
-        vssLabel.setLabel(SRC_LABEL);
-        vssLabel.setVsspath(VSS_PROJECT_PATH);
-
-        commandline = vssLabel.buildCmdLine();
-
-        checkCommandLines(sTestCmdLine, commandline.getCommandline());
-    }
-
-    /**  Tests Label commandline generation with a label of more than 31 chars.  */
-    @Test
-    public void testLabelCommandLine2() {
-        String[] sTestCmdLine = {MSVSS.SS_EXE, MSVSS.COMMAND_LABEL, DS_VSS_PROJECT_PATH,
-                MSVSS.FLAG_COMMENT + SRC_COMMENT, MSVSS.FLAG_AUTORESPONSE_DEF,
-                MSVSS.FLAG_LABEL + LONG_LABEL,
-                MSVSS.FLAG_LOGIN + VSS_USERNAME + "," + VSS_PASSWORD};
-
-        // Set up a VSSLabel task
-        MSVSSLABEL vssLabel = new MSVSSLABEL();
-        vssLabel.setProject(project);
-        vssLabel.setComment(SRC_COMMENT);
-        vssLabel.setLogin(VSS_USERNAME + "," + VSS_PASSWORD);
-        vssLabel.setLabel(LONG_LABEL + "blahblah");
-        vssLabel.setVsspath(VSS_PROJECT_PATH);
-
-        commandline = vssLabel.buildCmdLine();
-
-        checkCommandLines(sTestCmdLine, commandline.getCommandline());
-    }
-
-    /**
-     * Test VSSLabel required attributes.
-     */
-    @Test
-    public void testLabelExceptions() {
-        buildRule.configureProject("src/etc/testcases/taskdefs/optional/vss/vss.xml");
-        expectSpecificBuildException("vsslabel.1", "some cause", "vsspath attribute must be set!");
-        expectSpecificBuildException("vsslabel.2", "some cause", "label attribute must be set!");
-    }
-
-    /**  Tests VSSHistory commandline generation with from label.  */
-    @Test
-    public void testHistoryCommandLine1() {
-        String[] sTestCmdLine = {MSVSS.SS_EXE, MSVSS.COMMAND_HISTORY, DS_VSS_PROJECT_PATH,
-                MSVSS.FLAG_AUTORESPONSE_DEF, MSVSS.FLAG_VERSION_LABEL + LONG_LABEL
-                 + MSVSS.VALUE_FROMLABEL + SRC_LABEL, MSVSS.FLAG_LOGIN + VSS_USERNAME
-                 + "," + VSS_PASSWORD, MSVSS.FLAG_OUTPUT + project.getBaseDir()
-                .getAbsolutePath()
-                 + File.separator + OUTPUT};
-
-        // Set up a VSSHistory task
-        MSVSSHISTORY vssHistory = new MSVSSHISTORY();
-        vssHistory.setProject(project);
-
-        vssHistory.setLogin(VSS_USERNAME + "," + VSS_PASSWORD);
-
-        vssHistory.setFromLabel(SRC_LABEL);
-        vssHistory.setToLabel(LONG_LABEL + "blahblah");
-        vssHistory.setVsspath(VSS_PROJECT_PATH);
-        vssHistory.setRecursive(false);
-        vssHistory.setOutput(new File(project.getBaseDir().getAbsolutePath(), OUTPUT));
-
-        commandline = vssHistory.buildCmdLine();
-
-        checkCommandLines(sTestCmdLine, commandline.getCommandline());
-    }
-
-    /**  Tests VSSHistory commandline generation with from date.  */
-    @Test
-    public void testHistoryCommandLine2() {
-        String[] sTestCmdLine = {MSVSS.SS_EXE, MSVSS.COMMAND_HISTORY, DS_VSS_PROJECT_PATH,
-                MSVSS.FLAG_AUTORESPONSE_DEF, MSVSS.FLAG_VERSION_DATE + DATE + MSVSS.VALUE_FROMDATE
-                + DATE2, MSVSS.FLAG_RECURSION,  MSVSS.FLAG_LOGIN + VSS_USERNAME + "," + VSS_PASSWORD};
-
-        // Set up a VSSHistory task
-        MSVSSHISTORY vssHistory = new MSVSSHISTORY();
-        vssHistory.setProject(project);
-        vssHistory.setLogin(VSS_USERNAME + "," + VSS_PASSWORD);
-        vssHistory.setFromDate(DATE2);
-        vssHistory.setToDate(DATE);
-        vssHistory.setVsspath(VSS_PROJECT_PATH);
-        vssHistory.setRecursive(true);
-
-        commandline = vssHistory.buildCmdLine();
-
-        checkCommandLines(sTestCmdLine, commandline.getCommandline());
-    }
-
-    /**  Tests VSSHistory commandline generation with date calculation.  */
-    @Test
-    public void testHistoryCommandLine3() {
-        // Set up a Timestamp
-        Tstamp tstamp = new Tstamp();
-        Location location = new Location("src/etc/testcases/taskdefs/optional/vss/vss.xml");
-        tstamp.setLocation(location);
-        tstamp.setProject(project);
-        Tstamp.CustomFormat format = tstamp.createFormat();
-        format.setProperty("today");
-        format.setPattern("HH:mm:ss z");
-        format.setTimezone("GMT");
-        Date date = Calendar.getInstance().getTime();
-        format.execute(project, date, location);
-        String today = project.getProperty("today");
-
-        // Get today's date
-        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss z");
-        sdf.setTimeZone( TimeZone.getTimeZone("GMT") );
-        String expected = sdf.format(date);
-
-        // Set up a VSSHistory task
-        MSVSSHISTORY vssHistory = new MSVSSHISTORY();
-        vssHistory.setProject(project);
-        vssHistory.setLogin(VSS_USERNAME);
-        vssHistory.setToDate(today);
-        vssHistory.setVsspath(VSS_PROJECT_PATH);
-
-        String[] sTestCmdLine = {MSVSS.SS_EXE, MSVSS.COMMAND_HISTORY, DS_VSS_PROJECT_PATH,
-        MSVSS.FLAG_AUTORESPONSE_DEF, MSVSS.FLAG_VERSION_DATE + expected, MSVSS.FLAG_LOGIN + VSS_USERNAME};
-
-        commandline = vssHistory.buildCmdLine();
-
-        checkCommandLines(sTestCmdLine, commandline.getCommandline());
-    }
-
-    /**
-     * Tests VSSHistory required attributes.
-     */
-    @Test
-    public void testHistoryExceptions() {
-        buildRule.configureProject("src/etc/testcases/taskdefs/optional/vss/vss.xml");
-        expectSpecificBuildException("vsshistory.1", "some cause", "vsspath attribute must be set!");
-    }
-
-    private void expectSpecificBuildException(String target, String failMessage,
-                                              String exceptionMessage) {
-        try {
-            buildRule.executeTarget(target);
-            fail(failMessage);
-        } catch(BuildException ex) {
-            assertEquals(exceptionMessage, ex.getMessage());
-        }
-    }
-
-    /**  Tests CheckIn commandline generation.  */
-    @Test
-    public void testCheckinCommandLine() {
-        String[] sTestCmdLine = {MSVSS.SS_EXE, MSVSS.COMMAND_CHECKIN, DS_VSS_PROJECT_PATH,
-                MSVSS.FLAG_AUTORESPONSE_NO, MSVSS.FLAG_WRITABLE, MSVSS.FLAG_LOGIN + VSS_USERNAME,
-                MSVSS.FLAG_COMMENT + SRC_COMMENT};
-
-        // Set up a VSSCheckIn task
-        MSVSSCHECKIN vssCheckin = new MSVSSCHECKIN();
-        vssCheckin.setProject(project);
-        vssCheckin.setComment(SRC_COMMENT);
-        vssCheckin.setLogin(VSS_USERNAME);
-        vssCheckin.setAutoresponse("N");
-        vssCheckin.setVsspath(VSS_PROJECT_PATH);
-        vssCheckin.setWritable(true);
-
-        commandline = vssCheckin.buildCmdLine();
-
-        checkCommandLines(sTestCmdLine, commandline.getCommandline());
-    }
-
-    /**
-     * Test VSSCheckIn required attributes.
-     */
-    @Test
-    public void testCheckinExceptions() {
-        buildRule.configureProject("src/etc/testcases/taskdefs/optional/vss/vss.xml");
-        expectSpecificBuildException("vsscheckin.1", "some cause", "vsspath attribute must be set!");
-    }
-
-    /**  Tests CheckOut commandline generation.  */
-    @Test
-    public void testCheckoutCommandLine() {
-        String[] sTestCmdLine = {SS_DIR + File.separator + MSVSS.SS_EXE, MSVSS.COMMAND_CHECKOUT,
-                DS_VSS_PROJECT_PATH, MSVSS.FLAG_AUTORESPONSE_DEF, MSVSS.FLAG_RECURSION,
-                MSVSS.FLAG_VERSION_DATE + DATE, MSVSS.FLAG_LOGIN + VSS_USERNAME,
-                FLAG_FILETIME_MODIFIED, FLAG_NO_GET};
-
-        // Set up a VSSCheckOut task
-        MSVSSCHECKOUT vssCheckout = new MSVSSCHECKOUT();
-        vssCheckout.setProject(project);
-        vssCheckout.setLogin(VSS_USERNAME);
-        vssCheckout.setVsspath(DS_VSS_PROJECT_PATH);
-        vssCheckout.setRecursive(true);
-        vssCheckout.setDate(DATE);
-        vssCheckout.setLabel(SRC_LABEL);
-        vssCheckout.setSsdir(SS_DIR);
-        MSVSS.CurrentModUpdated cmu = new MSVSS.CurrentModUpdated();
-        cmu.setValue(TIME_MODIFIED);
-        vssCheckout.setFileTimeStamp(cmu);
-        vssCheckout.setGetLocalCopy(false);
-
-        commandline = vssCheckout.buildCmdLine();
-
-        checkCommandLines(sTestCmdLine, commandline.getCommandline());
-    }
-
-    /**
-     * Test VSSCheckout required attributes.
-     */
-    @Test
-    public void testCheckoutExceptions() {
-        buildRule.configureProject("src/etc/testcases/taskdefs/optional/vss/vss.xml");
-        expectSpecificBuildException("vsscheckout.1", "some cause", "vsspath attribute must be set!");
-        expectSpecificBuildException("vsscheckout.2", "some cause", "blah is not a legal value for this attribute");
-    }
-
-    /**  Tests Add commandline generation.  */
-    @Test
-    public void testAddCommandLine() {
-        String[] sTestCmdLine = {SS_DIR + File.separator + MSVSS.SS_EXE, MSVSS.COMMAND_ADD,
-                project.getBaseDir().getAbsolutePath() + File.separator + LOCAL_PATH,
-                MSVSS.FLAG_AUTORESPONSE_DEF, MSVSS.FLAG_RECURSION,
-                MSVSS.FLAG_LOGIN + VSS_USERNAME + "," + VSS_PASSWORD, MSVSS.FLAG_COMMENT + "-"};
-
-        // Set up a VSSAdd task
-        MSVSSADD vssAdd = new MSVSSADD();
-        vssAdd.setProject(project);
-        vssAdd.setLogin(VSS_USERNAME + "," + VSS_PASSWORD);
-        vssAdd.setVsspath(DS_VSS_PROJECT_PATH);
-        vssAdd.setRecursive(true);
-        vssAdd.setSsdir(SS_DIR);
-        vssAdd.setWritable(false);
-        vssAdd.setLocalpath(new Path(project, LOCAL_PATH));
-
-        commandline = vssAdd.buildCmdLine();
-
-        checkCommandLines(sTestCmdLine, commandline.getCommandline());
-    }
-
-    /**
-     * Test VSSAdd required attributes.
-     */
-    @Test
-    public void testAddExceptions() {
-        buildRule.configureProject("src/etc/testcases/taskdefs/optional/vss/vss.xml");
-        expectSpecificBuildException("vssadd.1", "some cause", "localPath attribute must be set!");
-    }
-
-    /**  Tests CP commandline generation.  */
-    @Test
-    public void testCpCommandLine() {
-        String[] sTestCmdLine = {MSVSS.SS_EXE, MSVSS.COMMAND_CP,
-                DS_VSS_PROJECT_PATH, MSVSS.FLAG_AUTORESPONSE_DEF, MSVSS.FLAG_LOGIN +
-                VSS_USERNAME};
-
-        // Set up a VSSCp task
-        MSVSSCP vssCp = new MSVSSCP();
-        vssCp.setProject(project);
-        vssCp.setLogin(VSS_USERNAME);
-        vssCp.setVsspath(DS_VSS_PROJECT_PATH);
-
-        commandline = vssCp.buildCmdLine();
-
-        checkCommandLines(sTestCmdLine, commandline.getCommandline());
-    }
-
-    /**
-     * Test VSSCP required attributes.
-     */
-    @Test
-    public void testCpExceptions() {
-        buildRule.configureProject("src/etc/testcases/taskdefs/optional/vss/vss.xml");
-        expectSpecificBuildException("vsscp.1", "some cause", "vsspath attribute must be set!");
-    }
-
-    /**  Tests Create commandline generation.  */
-    @Test
-    public void testCreateCommandLine() {
-        String[] sTestCmdLine = { MSVSS.SS_EXE, MSVSS.COMMAND_CREATE,
-                DS_VSS_PROJECT_PATH, MSVSS.FLAG_COMMENT + SRC_COMMENT, MSVSS.FLAG_AUTORESPONSE_NO,
-                MSVSS.FLAG_QUIET, MSVSS.FLAG_LOGIN + VSS_USERNAME};
-
-        // Set up a VSSCreate task
-        MSVSSCREATE vssCreate = new MSVSSCREATE();
-        vssCreate.setProject(project);
-        vssCreate.setComment(SRC_COMMENT);
-        vssCreate.setLogin(VSS_USERNAME);
-        vssCreate.setVsspath(DS_VSS_PROJECT_PATH);
-        vssCreate.setFailOnError(true);
-        vssCreate.setAutoresponse("N");
-        vssCreate.setQuiet(true);
-
-        commandline = vssCreate.buildCmdLine();
-
-        checkCommandLines(sTestCmdLine, commandline.getCommandline());
-    }
-
-    /**
-     * Test VSSCreate required attributes.
-     */
-    @Test
-    public void testCreateExceptions() {
-        buildRule.configureProject("src/etc/testcases/taskdefs/optional/vss/vss.xml");
-        expectSpecificBuildException("vsscreate.1", "some cause", "vsspath attribute must be set!");
-    }
-
-    /**
-     * Iterate through the generated command line comparing it to reference one.
-     * @param sTestCmdLine          The reference command line;
-     * @param sGeneratedCmdLine     The generated command line;
-     */
-    private void checkCommandLines(String[] sTestCmdLine, String[] sGeneratedCmdLine) {
-        int testLength = sTestCmdLine.length;
-        int genLength = sGeneratedCmdLine.length;
-
-        int genIndex = 0;
-        int testIndex = 0;
-
-        while (testIndex < testLength) {
-            try {
-                if (sGeneratedCmdLine[genIndex].equals("")) {
-                    genIndex++;
-                    continue;
-                }
-                assertEquals("arg # " + testIndex,
-                        sTestCmdLine[testIndex],
-                        sGeneratedCmdLine[genIndex]);
-                testIndex++;
-                genIndex++;
-            } catch (ArrayIndexOutOfBoundsException aioob) {
-                fail("missing arg " + sTestCmdLine[testIndex]);
-            }
-        }
-
-        // Count the number of empty strings
-        int cnt = 0;
-        for (int i = 0; i < genLength; i++) {
-            if (sGeneratedCmdLine[i].equals("")) {
-                cnt++;
-            }
-        }
-        if (genLength - cnt > sTestCmdLine.length) {
-            // We have extra elements
-            fail("extra args");
-        }
-    }
-}
+/*
+ *  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.vss;
+
+import java.io.File;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileRule;
+import org.apache.tools.ant.Location;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Tstamp;
+import org.apache.tools.ant.types.Commandline;
+import org.apache.tools.ant.types.Path;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ *  Testcase to ensure that command line generation and required attributes are correct.
+ *
+ */
+public class MSVSSTest implements MSVSSConstants {
+
+    private Commandline commandline;
+
+    private static final String VSS_PROJECT_PATH = "/SourceRoot/Project";
+    private static final String DS_VSS_PROJECT_PATH = "$/SourceRoot/Project";
+    private static final String VSS_USERNAME = "ant";
+    private static final String VSS_PASSWORD = "rocks";
+    private static final String LOCAL_PATH = "testdir";
+    private static final String SRC_LABEL = "label1";
+    private static final String LONG_LABEL = "123456789012345678901234567890";
+    private static final String SRC_COMMENT = "I fixed a bug";
+    private static final String VERSION = "007";
+    private static final String DATE = "00-00-00";
+    private static final String DATE2 = "01-01-01";
+    private static final String OUTPUT = "output.log";
+    private static final String SS_DIR = "c:/winnt".replace('/', File.separatorChar);
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+    private Project project;
+
+    @Before
+    public void setUp(){
+        project = new Project();
+        project.setBasedir(".");
+        project.init();
+    }
+
+    @After
+    public void tearDown() {
+        File file = new File(project.getBaseDir(), LOCAL_PATH);
+        if (file.exists()) {
+            file.delete();
+        }
+    }
+
+    @Test
+    public void testGetCommandLine() {
+        String[] sTestCmdLine = {MSVSS.SS_EXE, MSVSS.COMMAND_GET, DS_VSS_PROJECT_PATH,
+                MSVSS.FLAG_OVERRIDE_WORKING_DIR + project.getBaseDir()
+                        .getAbsolutePath()
+                 + File.separator + LOCAL_PATH, MSVSS.FLAG_AUTORESPONSE_DEF,
+                MSVSS.FLAG_RECURSION, MSVSS.FLAG_VERSION + VERSION, MSVSS.FLAG_LOGIN
+                 + VSS_USERNAME + "," + VSS_PASSWORD, FLAG_FILETIME_UPDATED, FLAG_SKIP_WRITABLE};
+
+        // Set up a VSSGet task
+        MSVSSGET vssGet = new MSVSSGET();
+        vssGet.setProject(project);
+        vssGet.setRecursive(true);
+        vssGet.setLocalpath(new Path(project, LOCAL_PATH));
+        vssGet.setLogin(VSS_USERNAME + "," + VSS_PASSWORD);
+        vssGet.setVersion(VERSION);
+        vssGet.setQuiet(false);
+        vssGet.setDate(DATE);
+        vssGet.setLabel(SRC_LABEL);
+        vssGet.setVsspath(VSS_PROJECT_PATH);
+        MSVSS.CurrentModUpdated cmu = new MSVSS.CurrentModUpdated();
+        cmu.setValue(TIME_UPDATED);
+        vssGet.setFileTimeStamp(cmu);
+        MSVSS.WritableFiles wf = new MSVSS.WritableFiles();
+        wf.setValue(WRITABLE_SKIP);
+        vssGet.setWritableFiles(wf);
+
+        commandline = vssGet.buildCmdLine();
+
+        checkCommandLines(sTestCmdLine, commandline.getCommandline());
+    }
+
+    /**  Tests VSSGet required attributes.  */
+    @Test
+    public void testGetExceptions() {
+        buildRule.configureProject("src/etc/testcases/taskdefs/optional/vss/vss.xml");
+        expectSpecificBuildException("vssget.1", "some cause", "vsspath attribute must be set!");
+    }
+
+    /**  Tests Label commandline generation.  */
+    @Test
+    public void testLabelCommandLine1() {
+        String[] sTestCmdLine = {MSVSS.SS_EXE, MSVSS.COMMAND_LABEL, DS_VSS_PROJECT_PATH,
+                MSVSS.FLAG_COMMENT + SRC_COMMENT, MSVSS.FLAG_AUTORESPONSE_YES,
+                MSVSS.FLAG_LABEL + SRC_LABEL, MSVSS.FLAG_VERSION + VERSION, MSVSS.FLAG_LOGIN
+                 + VSS_USERNAME + "," + VSS_PASSWORD};
+
+        // Set up a VSSLabel task
+        MSVSSLABEL vssLabel = new MSVSSLABEL();
+        vssLabel.setProject(project);
+        vssLabel.setComment(SRC_COMMENT);
+        vssLabel.setLogin(VSS_USERNAME + "," + VSS_PASSWORD);
+        vssLabel.setVersion(VERSION);
+        vssLabel.setAutoresponse("Y");
+        vssLabel.setLabel(SRC_LABEL);
+        vssLabel.setVsspath(VSS_PROJECT_PATH);
+
+        commandline = vssLabel.buildCmdLine();
+
+        checkCommandLines(sTestCmdLine, commandline.getCommandline());
+    }
+
+    /**  Tests Label commandline generation with a label of more than 31 chars.  */
+    @Test
+    public void testLabelCommandLine2() {
+        String[] sTestCmdLine = {MSVSS.SS_EXE, MSVSS.COMMAND_LABEL, DS_VSS_PROJECT_PATH,
+                MSVSS.FLAG_COMMENT + SRC_COMMENT, MSVSS.FLAG_AUTORESPONSE_DEF,
+                MSVSS.FLAG_LABEL + LONG_LABEL,
+                MSVSS.FLAG_LOGIN + VSS_USERNAME + "," + VSS_PASSWORD};
+
+        // Set up a VSSLabel task
+        MSVSSLABEL vssLabel = new MSVSSLABEL();
+        vssLabel.setProject(project);
+        vssLabel.setComment(SRC_COMMENT);
+        vssLabel.setLogin(VSS_USERNAME + "," + VSS_PASSWORD);
+        vssLabel.setLabel(LONG_LABEL + "blahblah");
+        vssLabel.setVsspath(VSS_PROJECT_PATH);
+
+        commandline = vssLabel.buildCmdLine();
+
+        checkCommandLines(sTestCmdLine, commandline.getCommandline());
+    }
+
+    /**
+     * Test VSSLabel required attributes.
+     */
+    @Test
+    public void testLabelExceptions() {
+        buildRule.configureProject("src/etc/testcases/taskdefs/optional/vss/vss.xml");
+        expectSpecificBuildException("vsslabel.1", "some cause", "vsspath attribute must be set!");
+        expectSpecificBuildException("vsslabel.2", "some cause", "label attribute must be set!");
+    }
+
+    /**  Tests VSSHistory commandline generation with from label.  */
+    @Test
+    public void testHistoryCommandLine1() {
+        String[] sTestCmdLine = {MSVSS.SS_EXE, MSVSS.COMMAND_HISTORY, DS_VSS_PROJECT_PATH,
+                MSVSS.FLAG_AUTORESPONSE_DEF, MSVSS.FLAG_VERSION_LABEL + LONG_LABEL
+                 + MSVSS.VALUE_FROMLABEL + SRC_LABEL, MSVSS.FLAG_LOGIN + VSS_USERNAME
+                 + "," + VSS_PASSWORD, MSVSS.FLAG_OUTPUT + project.getBaseDir()
+                .getAbsolutePath()
+                 + File.separator + OUTPUT};
+
+        // Set up a VSSHistory task
+        MSVSSHISTORY vssHistory = new MSVSSHISTORY();
+        vssHistory.setProject(project);
+
+        vssHistory.setLogin(VSS_USERNAME + "," + VSS_PASSWORD);
+
+        vssHistory.setFromLabel(SRC_LABEL);
+        vssHistory.setToLabel(LONG_LABEL + "blahblah");
+        vssHistory.setVsspath(VSS_PROJECT_PATH);
+        vssHistory.setRecursive(false);
+        vssHistory.setOutput(new File(project.getBaseDir().getAbsolutePath(), OUTPUT));
+
+        commandline = vssHistory.buildCmdLine();
+
+        checkCommandLines(sTestCmdLine, commandline.getCommandline());
+    }
+
+    /**  Tests VSSHistory commandline generation with from date.  */
+    @Test
+    public void testHistoryCommandLine2() {
+        String[] sTestCmdLine = {MSVSS.SS_EXE, MSVSS.COMMAND_HISTORY, DS_VSS_PROJECT_PATH,
+                MSVSS.FLAG_AUTORESPONSE_DEF, MSVSS.FLAG_VERSION_DATE + DATE + MSVSS.VALUE_FROMDATE
+                + DATE2, MSVSS.FLAG_RECURSION,  MSVSS.FLAG_LOGIN + VSS_USERNAME + "," + VSS_PASSWORD};
+
+        // Set up a VSSHistory task
+        MSVSSHISTORY vssHistory = new MSVSSHISTORY();
+        vssHistory.setProject(project);
+        vssHistory.setLogin(VSS_USERNAME + "," + VSS_PASSWORD);
+        vssHistory.setFromDate(DATE2);
+        vssHistory.setToDate(DATE);
+        vssHistory.setVsspath(VSS_PROJECT_PATH);
+        vssHistory.setRecursive(true);
+
+        commandline = vssHistory.buildCmdLine();
+
+        checkCommandLines(sTestCmdLine, commandline.getCommandline());
+    }
+
+    /**  Tests VSSHistory commandline generation with date calculation.  */
+    @Test
+    public void testHistoryCommandLine3() {
+        // Set up a Timestamp
+        Tstamp tstamp = new Tstamp();
+        Location location = new Location("src/etc/testcases/taskdefs/optional/vss/vss.xml");
+        tstamp.setLocation(location);
+        tstamp.setProject(project);
+        Tstamp.CustomFormat format = tstamp.createFormat();
+        format.setProperty("today");
+        format.setPattern("HH:mm:ss z");
+        format.setTimezone("GMT");
+        Date date = Calendar.getInstance().getTime();
+        format.execute(project, date, location);
+        String today = project.getProperty("today");
+
+        // Get today's date
+        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss z");
+        sdf.setTimeZone( TimeZone.getTimeZone("GMT") );
+        String expected = sdf.format(date);
+
+        // Set up a VSSHistory task
+        MSVSSHISTORY vssHistory = new MSVSSHISTORY();
+        vssHistory.setProject(project);
+        vssHistory.setLogin(VSS_USERNAME);
+        vssHistory.setToDate(today);
+        vssHistory.setVsspath(VSS_PROJECT_PATH);
+
+        String[] sTestCmdLine = {MSVSS.SS_EXE, MSVSS.COMMAND_HISTORY, DS_VSS_PROJECT_PATH,
+        MSVSS.FLAG_AUTORESPONSE_DEF, MSVSS.FLAG_VERSION_DATE + expected, MSVSS.FLAG_LOGIN + VSS_USERNAME};
+
+        commandline = vssHistory.buildCmdLine();
+
+        checkCommandLines(sTestCmdLine, commandline.getCommandline());
+    }
+
+    /**
+     * Tests VSSHistory required attributes.
+     */
+    @Test
+    public void testHistoryExceptions() {
+        buildRule.configureProject("src/etc/testcases/taskdefs/optional/vss/vss.xml");
+        expectSpecificBuildException("vsshistory.1", "some cause", "vsspath attribute must be set!");
+    }
+
+    private void expectSpecificBuildException(String target, String failMessage,
+                                              String exceptionMessage) {
+        try {
+            buildRule.executeTarget(target);
+            fail(failMessage);
+        } catch(BuildException ex) {
+            assertEquals(exceptionMessage, ex.getMessage());
+        }
+    }
+
+    /**  Tests CheckIn commandline generation.  */
+    @Test
+    public void testCheckinCommandLine() {
+        String[] sTestCmdLine = {MSVSS.SS_EXE, MSVSS.COMMAND_CHECKIN, DS_VSS_PROJECT_PATH,
+                MSVSS.FLAG_AUTORESPONSE_NO, MSVSS.FLAG_WRITABLE, MSVSS.FLAG_LOGIN + VSS_USERNAME,
+                MSVSS.FLAG_COMMENT + SRC_COMMENT};
+
+        // Set up a VSSCheckIn task
+        MSVSSCHECKIN vssCheckin = new MSVSSCHECKIN();
+        vssCheckin.setProject(project);
+        vssCheckin.setComment(SRC_COMMENT);
+        vssCheckin.setLogin(VSS_USERNAME);
+        vssCheckin.setAutoresponse("N");
+        vssCheckin.setVsspath(VSS_PROJECT_PATH);
+        vssCheckin.setWritable(true);
+
+        commandline = vssCheckin.buildCmdLine();
+
+        checkCommandLines(sTestCmdLine, commandline.getCommandline());
+    }
+
+    /**
+     * Test VSSCheckIn required attributes.
+     */
+    @Test
+    public void testCheckinExceptions() {
+        buildRule.configureProject("src/etc/testcases/taskdefs/optional/vss/vss.xml");
+        expectSpecificBuildException("vsscheckin.1", "some cause", "vsspath attribute must be set!");
+    }
+
+    /**  Tests CheckOut commandline generation.  */
+    @Test
+    public void testCheckoutCommandLine() {
+        String[] sTestCmdLine = {SS_DIR + File.separator + MSVSS.SS_EXE, MSVSS.COMMAND_CHECKOUT,
+                DS_VSS_PROJECT_PATH, MSVSS.FLAG_AUTORESPONSE_DEF, MSVSS.FLAG_RECURSION,
+                MSVSS.FLAG_VERSION_DATE + DATE, MSVSS.FLAG_LOGIN + VSS_USERNAME,
+                FLAG_FILETIME_MODIFIED, FLAG_NO_GET};
+
+        // Set up a VSSCheckOut task
+        MSVSSCHECKOUT vssCheckout = new MSVSSCHECKOUT();
+        vssCheckout.setProject(project);
+        vssCheckout.setLogin(VSS_USERNAME);
+        vssCheckout.setVsspath(DS_VSS_PROJECT_PATH);
+        vssCheckout.setRecursive(true);
+        vssCheckout.setDate(DATE);
+        vssCheckout.setLabel(SRC_LABEL);
+        vssCheckout.setSsdir(SS_DIR);
+        MSVSS.CurrentModUpdated cmu = new MSVSS.CurrentModUpdated();
+        cmu.setValue(TIME_MODIFIED);
+        vssCheckout.setFileTimeStamp(cmu);
+        vssCheckout.setGetLocalCopy(false);
+
+        commandline = vssCheckout.buildCmdLine();
+
+        checkCommandLines(sTestCmdLine, commandline.getCommandline());
+    }
+
+    /**
+     * Test VSSCheckout required attributes.
+     */
+    @Test
+    public void testCheckoutExceptions() {
+        buildRule.configureProject("src/etc/testcases/taskdefs/optional/vss/vss.xml");
+        expectSpecificBuildException("vsscheckout.1", "some cause", "vsspath attribute must be set!");
+        expectSpecificBuildException("vsscheckout.2", "some cause", "blah is not a legal value for this attribute");
+    }
+
+    /**  Tests Add commandline generation.  */
+    @Test
+    public void testAddCommandLine() {
+        String[] sTestCmdLine = {SS_DIR + File.separator + MSVSS.SS_EXE, MSVSS.COMMAND_ADD,
+                project.getBaseDir().getAbsolutePath() + File.separator + LOCAL_PATH,
+                MSVSS.FLAG_AUTORESPONSE_DEF, MSVSS.FLAG_RECURSION,
+                MSVSS.FLAG_LOGIN + VSS_USERNAME + "," + VSS_PASSWORD, MSVSS.FLAG_COMMENT + "-"};
+
+        // Set up a VSSAdd task
+        MSVSSADD vssAdd = new MSVSSADD();
+        vssAdd.setProject(project);
+        vssAdd.setLogin(VSS_USERNAME + "," + VSS_PASSWORD);
+        vssAdd.setVsspath(DS_VSS_PROJECT_PATH);
+        vssAdd.setRecursive(true);
+        vssAdd.setSsdir(SS_DIR);
+        vssAdd.setWritable(false);
+        vssAdd.setLocalpath(new Path(project, LOCAL_PATH));
+
+        commandline = vssAdd.buildCmdLine();
+
+        checkCommandLines(sTestCmdLine, commandline.getCommandline());
+    }
+
+    /**
+     * Test VSSAdd required attributes.
+     */
+    @Test
+    public void testAddExceptions() {
+        buildRule.configureProject("src/etc/testcases/taskdefs/optional/vss/vss.xml");
+        expectSpecificBuildException("vssadd.1", "some cause", "localPath attribute must be set!");
+    }
+
+    /**  Tests CP commandline generation.  */
+    @Test
+    public void testCpCommandLine() {
+        String[] sTestCmdLine = {MSVSS.SS_EXE, MSVSS.COMMAND_CP,
+                DS_VSS_PROJECT_PATH, MSVSS.FLAG_AUTORESPONSE_DEF, MSVSS.FLAG_LOGIN +
+                VSS_USERNAME};
+
+        // Set up a VSSCp task
+        MSVSSCP vssCp = new MSVSSCP();
+        vssCp.setProject(project);
+        vssCp.setLogin(VSS_USERNAME);
+        vssCp.setVsspath(DS_VSS_PROJECT_PATH);
+
+        commandline = vssCp.buildCmdLine();
+
+        checkCommandLines(sTestCmdLine, commandline.getCommandline());
+    }
+
+    /**
+     * Test VSSCP required attributes.
+     */
+    @Test
+    public void testCpExceptions() {
+        buildRule.configureProject("src/etc/testcases/taskdefs/optional/vss/vss.xml");
+        expectSpecificBuildException("vsscp.1", "some cause", "vsspath attribute must be set!");
+    }
+
+    /**  Tests Create commandline generation.  */
+    @Test
+    public void testCreateCommandLine() {
+        String[] sTestCmdLine = { MSVSS.SS_EXE, MSVSS.COMMAND_CREATE,
+                DS_VSS_PROJECT_PATH, MSVSS.FLAG_COMMENT + SRC_COMMENT, MSVSS.FLAG_AUTORESPONSE_NO,
+                MSVSS.FLAG_QUIET, MSVSS.FLAG_LOGIN + VSS_USERNAME};
+
+        // Set up a VSSCreate task
+        MSVSSCREATE vssCreate = new MSVSSCREATE();
+        vssCreate.setProject(project);
+        vssCreate.setComment(SRC_COMMENT);
+        vssCreate.setLogin(VSS_USERNAME);
+        vssCreate.setVsspath(DS_VSS_PROJECT_PATH);
+        vssCreate.setFailOnError(true);
+        vssCreate.setAutoresponse("N");
+        vssCreate.setQuiet(true);
+
+        commandline = vssCreate.buildCmdLine();
+
+        checkCommandLines(sTestCmdLine, commandline.getCommandline());
+    }
+
+    /**
+     * Test VSSCreate required attributes.
+     */
+    @Test
+    public void testCreateExceptions() {
+        buildRule.configureProject("src/etc/testcases/taskdefs/optional/vss/vss.xml");
+        expectSpecificBuildException("vsscreate.1", "some cause", "vsspath attribute must be set!");
+    }
+
+    /**
+     * Iterate through the generated command line comparing it to reference one.
+     * @param sTestCmdLine          The reference command line;
+     * @param sGeneratedCmdLine     The generated command line;
+     */
+    private void checkCommandLines(String[] sTestCmdLine, String[] sGeneratedCmdLine) {
+        int testLength = sTestCmdLine.length;
+        int genLength = sGeneratedCmdLine.length;
+
+        int genIndex = 0;
+        int testIndex = 0;
+
+        while (testIndex < testLength) {
+            try {
+                if (sGeneratedCmdLine[genIndex].equals("")) {
+                    genIndex++;
+                    continue;
+                }
+                assertEquals("arg # " + testIndex,
+                        sTestCmdLine[testIndex],
+                        sGeneratedCmdLine[genIndex]);
+                testIndex++;
+                genIndex++;
+            } catch (ArrayIndexOutOfBoundsException aioob) {
+                fail("missing arg " + sTestCmdLine[testIndex]);
+            }
+        }
+
+        // Count the number of empty strings
+        int cnt = 0;
+        for (int i = 0; i < genLength; i++) {
+            if (sGeneratedCmdLine[i].equals("")) {
+                cnt++;
+            }
+        }
+        if (genLength - cnt > sTestCmdLine.length) {
+            // We have extra elements
+            fail("extra args");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/AbstractFileSetTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/AbstractFileSetTest.java b/src/tests/junit/org/apache/tools/ant/types/AbstractFileSetTest.java
index f344b15..aa4fd39 100644
--- a/src/tests/junit/org/apache/tools/ant/types/AbstractFileSetTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/AbstractFileSetTest.java
@@ -1,248 +1,248 @@
-/*
- *  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.types;
-
-import java.io.File;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-/**
- * Base class for FileSetTest and DirSetTest.
- *
- * <p>This doesn't actually test much, mainly reference handling.
- *
- */
-
-public abstract class AbstractFileSetTest {
-
-    private Project project;
-
-
-    @Before
-    public void setUp() {
-        project = new Project();
-        project.setBasedir(".");
-    }
-
-    protected abstract AbstractFileSet getInstance();
-
-    protected final Project getProject() {
-        return project;
-    }
-
-    @Test
-    public final void testEmptyElementIfIsReference() {
-        AbstractFileSet f = getInstance();
-        f.setIncludes("**/*.java");
-        try {
-            f.setRefid(new Reference(getProject(), "dummyref"));
-            fail("Can add reference to "
-                 + f.getDataTypeName()
-                 + " with elements from setIncludes");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute "
-                         + "when using refid", be.getMessage());
-        }
-
-        f = getInstance();
-        f.createPatternSet();
-        try {
-            f.setRefid(new Reference(getProject(), "dummyref"));
-            fail("Can add reference to "
-                 + f.getDataTypeName()
-                 + " with nested patternset element.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify nested elements when "
-                         + "using refid", be.getMessage());
-        }
-
-        f = getInstance();
-        f.createInclude();
-        try {
-            f.setRefid(new Reference(getProject(), "dummyref"));
-            fail("Can add reference to "
-                 + f.getDataTypeName()
-                 + " with nested include element.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute "
-                         + "when using refid", be.getMessage());
-        }
-
-        f = getInstance();
-        f.setRefid(new Reference(getProject(), "dummyref"));
-        try {
-            f.setIncludes("**/*.java");
-            fail("Can set includes in "
-                 + f.getDataTypeName()
-                 + " that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute "
-                         + "when using refid", be.getMessage());
-        }
-        try {
-            f.setIncludesfile(new File("/a"));
-            fail("Can set includesfile in "
-                 + f.getDataTypeName()
-                 + " that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute "
-                         + "when using refid", be.getMessage());
-        }
-        try {
-            f.setExcludes("**/*.java");
-            fail("Can set excludes in "
-                 + f.getDataTypeName()
-                 + " that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute "
-                         + "when using refid", be.getMessage());
-        }
-        try {
-            f.setExcludesfile(new File("/a"));
-            fail("Can set excludesfile in "
-                 + f.getDataTypeName()
-                 + " that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute "
-                         + "when using refid", be.getMessage());
-        }
-        try {
-            f.setDir(project.resolveFile("."));
-            fail("Can set dir in "
-                 + f.getDataTypeName()
-                 + " that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify more than one attribute "
-                         + "when using refid", be.getMessage());
-        }
-        try {
-            f.createInclude();
-            fail("Can add nested include in "
-                 + f.getDataTypeName()
-                 + " that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify nested elements when using "
-                         + "refid", be.getMessage());
-        }
-        try {
-            f.createExclude();
-            fail("Can add nested exclude in "
-                 + f.getDataTypeName()
-                 + " that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify nested elements when using "
-                         + "refid", be.getMessage());
-        }
-        try {
-            f.createIncludesFile();
-            fail("Can add nested includesfile in "
-                 + f.getDataTypeName()
-                 + " that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify nested elements when using "
-                         + "refid", be.getMessage());
-        }
-        try {
-            f.createExcludesFile();
-            fail("Can add nested excludesfile in "
-                 + f.getDataTypeName()
-                 + " that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify nested elements when using "
-                         + "refid", be.getMessage());
-        }
-        try {
-            f.createPatternSet();
-            fail("Can add nested patternset in "
-                 + f.getDataTypeName()
-                 + " that is a reference.");
-        } catch (BuildException be) {
-            assertEquals("You must not specify nested elements when using "
-                         + "refid", be.getMessage());
-        }
-    }
-
-    @Test
-    public void testCircularReferenceCheck() {
-        AbstractFileSet f = getInstance();
-        project.addReference("dummy", f);
-        f.setRefid(new Reference(getProject(), "dummy"));
-        try {
-            f.getDir(project);
-            fail("Can make " + f.getDataTypeName()
-                 + " a Reference to itself.");
-        } catch (BuildException be) {
-            assertEquals("This data type contains a circular reference.",
-                         be.getMessage());
-        }
-        try {
-            f.getDirectoryScanner(project);
-            fail("Can make " + f.getDataTypeName()
-                 + " a Reference to itself.");
-        } catch (BuildException be) {
-            assertEquals("This data type contains a circular reference.",
-                         be.getMessage());
-        }
-
-        // dummy1 --> dummy2 --> dummy3 --> dummy1
-        AbstractFileSet f1 = getInstance();
-        project.addReference("dummy1", f1);
-        f1.setRefid(new Reference(getProject(), "dummy2"));
-        AbstractFileSet f2 = getInstance();
-        project.addReference("dummy2", f2);
-        f2.setRefid(new Reference(getProject(), "dummy3"));
-        AbstractFileSet f3 = getInstance();
-        project.addReference("dummy3", f3);
-        f3.setRefid(new Reference(getProject(), "dummy1"));
-        try {
-            f1.getDir(project);
-            fail("Can make circular reference.");
-        } catch (BuildException be) {
-            assertEquals("This data type contains a circular reference.",
-                         be.getMessage());
-        }
-        try {
-            f1.getDirectoryScanner(project);
-            fail("Can make circular reference.");
-        } catch (BuildException be) {
-            assertEquals("This data type contains a circular reference.",
-                         be.getMessage());
-        }
-
-        // dummy1 --> dummy2 --> dummy3
-        // (which has the Project's basedir as root).
-        f1 = getInstance();
-        project.addReference("dummy1", f1);
-        f1.setRefid(new Reference(getProject(), "dummy2"));
-        f2 = getInstance();
-        project.addReference("dummy2", f2);
-        f2.setRefid(new Reference(getProject(), "dummy3"));
-        f3 = getInstance();
-        project.addReference("dummy3", f3);
-        f3.setDir(project.resolveFile("."));
-        File dir = f1.getDir(project);
-        assertEquals("Dir is basedir", dir, project.getBaseDir());
-    }
-}
+/*
+ *  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.types;
+
+import java.io.File;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Base class for FileSetTest and DirSetTest.
+ *
+ * <p>This doesn't actually test much, mainly reference handling.
+ *
+ */
+
+public abstract class AbstractFileSetTest {
+
+    private Project project;
+
+
+    @Before
+    public void setUp() {
+        project = new Project();
+        project.setBasedir(".");
+    }
+
+    protected abstract AbstractFileSet getInstance();
+
+    protected final Project getProject() {
+        return project;
+    }
+
+    @Test
+    public final void testEmptyElementIfIsReference() {
+        AbstractFileSet f = getInstance();
+        f.setIncludes("**/*.java");
+        try {
+            f.setRefid(new Reference(getProject(), "dummyref"));
+            fail("Can add reference to "
+                 + f.getDataTypeName()
+                 + " with elements from setIncludes");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute "
+                         + "when using refid", be.getMessage());
+        }
+
+        f = getInstance();
+        f.createPatternSet();
+        try {
+            f.setRefid(new Reference(getProject(), "dummyref"));
+            fail("Can add reference to "
+                 + f.getDataTypeName()
+                 + " with nested patternset element.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify nested elements when "
+                         + "using refid", be.getMessage());
+        }
+
+        f = getInstance();
+        f.createInclude();
+        try {
+            f.setRefid(new Reference(getProject(), "dummyref"));
+            fail("Can add reference to "
+                 + f.getDataTypeName()
+                 + " with nested include element.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute "
+                         + "when using refid", be.getMessage());
+        }
+
+        f = getInstance();
+        f.setRefid(new Reference(getProject(), "dummyref"));
+        try {
+            f.setIncludes("**/*.java");
+            fail("Can set includes in "
+                 + f.getDataTypeName()
+                 + " that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute "
+                         + "when using refid", be.getMessage());
+        }
+        try {
+            f.setIncludesfile(new File("/a"));
+            fail("Can set includesfile in "
+                 + f.getDataTypeName()
+                 + " that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute "
+                         + "when using refid", be.getMessage());
+        }
+        try {
+            f.setExcludes("**/*.java");
+            fail("Can set excludes in "
+                 + f.getDataTypeName()
+                 + " that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute "
+                         + "when using refid", be.getMessage());
+        }
+        try {
+            f.setExcludesfile(new File("/a"));
+            fail("Can set excludesfile in "
+                 + f.getDataTypeName()
+                 + " that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute "
+                         + "when using refid", be.getMessage());
+        }
+        try {
+            f.setDir(project.resolveFile("."));
+            fail("Can set dir in "
+                 + f.getDataTypeName()
+                 + " that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify more than one attribute "
+                         + "when using refid", be.getMessage());
+        }
+        try {
+            f.createInclude();
+            fail("Can add nested include in "
+                 + f.getDataTypeName()
+                 + " that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify nested elements when using "
+                         + "refid", be.getMessage());
+        }
+        try {
+            f.createExclude();
+            fail("Can add nested exclude in "
+                 + f.getDataTypeName()
+                 + " that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify nested elements when using "
+                         + "refid", be.getMessage());
+        }
+        try {
+            f.createIncludesFile();
+            fail("Can add nested includesfile in "
+                 + f.getDataTypeName()
+                 + " that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify nested elements when using "
+                         + "refid", be.getMessage());
+        }
+        try {
+            f.createExcludesFile();
+            fail("Can add nested excludesfile in "
+                 + f.getDataTypeName()
+                 + " that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify nested elements when using "
+                         + "refid", be.getMessage());
+        }
+        try {
+            f.createPatternSet();
+            fail("Can add nested patternset in "
+                 + f.getDataTypeName()
+                 + " that is a reference.");
+        } catch (BuildException be) {
+            assertEquals("You must not specify nested elements when using "
+                         + "refid", be.getMessage());
+        }
+    }
+
+    @Test
+    public void testCircularReferenceCheck() {
+        AbstractFileSet f = getInstance();
+        project.addReference("dummy", f);
+        f.setRefid(new Reference(getProject(), "dummy"));
+        try {
+            f.getDir(project);
+            fail("Can make " + f.getDataTypeName()
+                 + " a Reference to itself.");
+        } catch (BuildException be) {
+            assertEquals("This data type contains a circular reference.",
+                         be.getMessage());
+        }
+        try {
+            f.getDirectoryScanner(project);
+            fail("Can make " + f.getDataTypeName()
+                 + " a Reference to itself.");
+        } catch (BuildException be) {
+            assertEquals("This data type contains a circular reference.",
+                         be.getMessage());
+        }
+
+        // dummy1 --> dummy2 --> dummy3 --> dummy1
+        AbstractFileSet f1 = getInstance();
+        project.addReference("dummy1", f1);
+        f1.setRefid(new Reference(getProject(), "dummy2"));
+        AbstractFileSet f2 = getInstance();
+        project.addReference("dummy2", f2);
+        f2.setRefid(new Reference(getProject(), "dummy3"));
+        AbstractFileSet f3 = getInstance();
+        project.addReference("dummy3", f3);
+        f3.setRefid(new Reference(getProject(), "dummy1"));
+        try {
+            f1.getDir(project);
+            fail("Can make circular reference.");
+        } catch (BuildException be) {
+            assertEquals("This data type contains a circular reference.",
+                         be.getMessage());
+        }
+        try {
+            f1.getDirectoryScanner(project);
+            fail("Can make circular reference.");
+        } catch (BuildException be) {
+            assertEquals("This data type contains a circular reference.",
+                         be.getMessage());
+        }
+
+        // dummy1 --> dummy2 --> dummy3
+        // (which has the Project's basedir as root).
+        f1 = getInstance();
+        project.addReference("dummy1", f1);
+        f1.setRefid(new Reference(getProject(), "dummy2"));
+        f2 = getInstance();
+        project.addReference("dummy2", f2);
+        f2.setRefid(new Reference(getProject(), "dummy3"));
+        f3 = getInstance();
+        project.addReference("dummy3", f3);
+        f3.setDir(project.resolveFile("."));
+        File dir = f1.getDir(project);
+        assertEquals("Dir is basedir", dir, project.getBaseDir());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/AddTypeTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/AddTypeTest.java b/src/tests/junit/org/apache/tools/ant/types/AddTypeTest.java
index c037b0a..4f95c35 100644
--- a/src/tests/junit/org/apache/tools/ant/types/AddTypeTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/AddTypeTest.java
@@ -1,223 +1,223 @@
-/*
- *  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.types;
-
-import org.apache.tools.ant.AntAssert;
-import org.apache.tools.ant.BuildFileRule;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.taskdefs.condition.Condition;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.fail;
-
-public class AddTypeTest {
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-    
-    @Before
-    public void setUp() {
-        buildRule.configureProject("src/etc/testcases/types/addtype.xml");
-    }
-
-    @Test
-    public void testAddPath() {
-        buildRule.executeTarget("addpath");
-    }
-
-    @Test
-    public void testAddCondition() {
-        buildRule.executeTarget("addcondition");
-    }
-
-    @Test
-    public void testAddFilter() {
-        buildRule.executeTarget("addfilter");
-    }
-
-    @Test
-    public void testAddSelector() {
-        buildRule.executeTarget("addselector");
-    }
-
-    @Test
-    public void testNestedA() {
-        buildRule.executeTarget("nested.a");
-        AntAssert.assertContains("add A called", buildRule.getLog());
-    }
-
-    @Test
-    public void testNestedB() {
-        buildRule.executeTarget("nested.b");
-         AntAssert.assertContains( "add B called", buildRule.getLog());
-    }
-
-    @Test
-    public void testNestedC() {
-        buildRule.executeTarget("nested.c");
-        AntAssert.assertContains( "add C called", buildRule.getLog());
-    }
-
-    @Test
-    public void testNestedAB() {
-        try {
-            buildRule.executeTarget("nested.ab");
-            fail("Build exception expected: Should have got ambiguous");
-        } catch (BuildException ex) {
-            AntAssert.assertContains("ambiguous", ex.getMessage());
-        }
-    }
-
-    @Test
-    public void testConditionType() {
-        buildRule.executeTarget("condition.type");
-        AntAssert.assertContains( "beforeafter", buildRule.getLog());
-    }
-
-    @Test
-    public void testConditionTask() {
-        buildRule.executeTarget("condition.task");
-        AntAssert.assertContains( "My Condition execution", buildRule.getLog());
-    }
-    
-    @Test
-    public void testConditionConditionType() {
-        buildRule.executeTarget("condition.condition.type");
-        AntAssert.assertContains( "My Condition eval", buildRule.getLog());
-    }
-    
-    @Test
-    public void testConditionConditionTask() {
-        try {
-            buildRule.executeTarget("condition.condition.task");
-            fail("Build exception expected: Task masking condition");
-        } catch (BuildException ex) {
-             AntAssert.assertContains("doesn't support the nested", ex.getMessage());
-        }
-    }
-
-    @Test
-    public void testAddConfigured() {
-        buildRule.executeTarget("myaddconfigured");
-        AntAssert.assertContains("value is Value Setexecute: value is Value Set",
-                buildRule.getLog());
-    }
-
-    @Test
-    public void testAddConfiguredValue() {
-        buildRule.executeTarget("myaddconfiguredvalue");
-        AntAssert.assertContains("value is Value Setexecute: value is Value Set",
-                buildRule.getLog());
-    }
-
-    @Test
-    public void testNamespace() {
-        buildRule.executeTarget("namespacetest");
-    }
-
-    // The following will be used as types and tasks
-
-    public static interface A {}
-    public static interface B {}
-    public static interface C extends A {}
-    public static interface AB extends A, B {}
-
-    public static class AImpl implements A{}
-    public static class BImpl implements B{}
-    public static class CImpl implements C{}
-    public static class ABImpl implements AB{}
-
-    public static class NestedContainer
-        extends Task
-    {
-        public void add(A el) {
-            log("add A called");
-        }
-        public void add(B el) {
-            log("add B called");
-        }
-        public void add(C el) {
-            log("add C called");
-        }
-    }
-
-    public static class MyCondition
-        implements Condition
-    {
-        Project project;
-        public void setProject(Project project) {
-            this.project = project;
-        }
-        public boolean eval() {
-            project.log("My Condition eval");
-            return true;
-        }
-        public void execute() {
-            project.log("My Condition execution");
-        }
-    }
-
-    public static class MyValue
-    {
-        private String text = "NOT SET YET";
-        public void addText(String text) {
-            this.text = text;
-        }
-        public String toString() {
-            return text;
-        }
-    }
-
-    public static class MyAddConfigured
-        extends Task
-    {
-        MyValue value;
-        public void addConfigured(MyValue value) {
-            log("value is " + value);
-            this.value = value;
-        }
-        public void add(MyValue value) {
-            throw new BuildException("Should not be called");
-        }
-        public void execute() {
-            log("execute: value is " + value);
-        }
-    }
-
-    public static class MyAddConfiguredValue
-        extends Task
-    {
-        MyValue value;
-        public void addConfiguredValue(MyValue value) {
-            log("value is " + value);
-            this.value = value;
-        }
-        public void addValue(MyValue value) {
-            throw new BuildException("Should not be called");
-        }
-        public void execute() {
-            log("execute: value is " + value);
-        }
-    }
-
-}
+/*
+ *  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.types;
+
+import org.apache.tools.ant.AntAssert;
+import org.apache.tools.ant.BuildFileRule;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.condition.Condition;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.fail;
+
+public class AddTypeTest {
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject("src/etc/testcases/types/addtype.xml");
+    }
+
+    @Test
+    public void testAddPath() {
+        buildRule.executeTarget("addpath");
+    }
+
+    @Test
+    public void testAddCondition() {
+        buildRule.executeTarget("addcondition");
+    }
+
+    @Test
+    public void testAddFilter() {
+        buildRule.executeTarget("addfilter");
+    }
+
+    @Test
+    public void testAddSelector() {
+        buildRule.executeTarget("addselector");
+    }
+
+    @Test
+    public void testNestedA() {
+        buildRule.executeTarget("nested.a");
+        AntAssert.assertContains("add A called", buildRule.getLog());
+    }
+
+    @Test
+    public void testNestedB() {
+        buildRule.executeTarget("nested.b");
+         AntAssert.assertContains( "add B called", buildRule.getLog());
+    }
+
+    @Test
+    public void testNestedC() {
+        buildRule.executeTarget("nested.c");
+        AntAssert.assertContains( "add C called", buildRule.getLog());
+    }
+
+    @Test
+    public void testNestedAB() {
+        try {
+            buildRule.executeTarget("nested.ab");
+            fail("Build exception expected: Should have got ambiguous");
+        } catch (BuildException ex) {
+            AntAssert.assertContains("ambiguous", ex.getMessage());
+        }
+    }
+
+    @Test
+    public void testConditionType() {
+        buildRule.executeTarget("condition.type");
+        AntAssert.assertContains( "beforeafter", buildRule.getLog());
+    }
+
+    @Test
+    public void testConditionTask() {
+        buildRule.executeTarget("condition.task");
+        AntAssert.assertContains( "My Condition execution", buildRule.getLog());
+    }
+
+    @Test
+    public void testConditionConditionType() {
+        buildRule.executeTarget("condition.condition.type");
+        AntAssert.assertContains( "My Condition eval", buildRule.getLog());
+    }
+
+    @Test
+    public void testConditionConditionTask() {
+        try {
+            buildRule.executeTarget("condition.condition.task");
+            fail("Build exception expected: Task masking condition");
+        } catch (BuildException ex) {
+             AntAssert.assertContains("doesn't support the nested", ex.getMessage());
+        }
+    }
+
+    @Test
+    public void testAddConfigured() {
+        buildRule.executeTarget("myaddconfigured");
+        AntAssert.assertContains("value is Value Setexecute: value is Value Set",
+                buildRule.getLog());
+    }
+
+    @Test
+    public void testAddConfiguredValue() {
+        buildRule.executeTarget("myaddconfiguredvalue");
+        AntAssert.assertContains("value is Value Setexecute: value is Value Set",
+                buildRule.getLog());
+    }
+
+    @Test
+    public void testNamespace() {
+        buildRule.executeTarget("namespacetest");
+    }
+
+    // The following will be used as types and tasks
+
+    public static interface A {}
+    public static interface B {}
+    public static interface C extends A {}
+    public static interface AB extends A, B {}
+
+    public static class AImpl implements A{}
+    public static class BImpl implements B{}
+    public static class CImpl implements C{}
+    public static class ABImpl implements AB{}
+
+    public static class NestedContainer
+        extends Task
+    {
+        public void add(A el) {
+            log("add A called");
+        }
+        public void add(B el) {
+            log("add B called");
+        }
+        public void add(C el) {
+            log("add C called");
+        }
+    }
+
+    public static class MyCondition
+        implements Condition
+    {
+        Project project;
+        public void setProject(Project project) {
+            this.project = project;
+        }
+        public boolean eval() {
+            project.log("My Condition eval");
+            return true;
+        }
+        public void execute() {
+            project.log("My Condition execution");
+        }
+    }
+
+    public static class MyValue
+    {
+        private String text = "NOT SET YET";
+        public void addText(String text) {
+            this.text = text;
+        }
+        public String toString() {
+            return text;
+        }
+    }
+
+    public static class MyAddConfigured
+        extends Task
+    {
+        MyValue value;
+        public void addConfigured(MyValue value) {
+            log("value is " + value);
+            this.value = value;
+        }
+        public void add(MyValue value) {
+            throw new BuildException("Should not be called");
+        }
+        public void execute() {
+            log("execute: value is " + value);
+        }
+    }
+
+    public static class MyAddConfiguredValue
+        extends Task
+    {
+        MyValue value;
+        public void addConfiguredValue(MyValue value) {
+            log("value is " + value);
+            this.value = value;
+        }
+        public void addValue(MyValue value) {
+            throw new BuildException("Should not be called");
+        }
+        public void execute() {
+            log("execute: value is " + value);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/AssertionsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/AssertionsTest.java b/src/tests/junit/org/apache/tools/ant/types/AssertionsTest.java
index 4bd26af..03d0c97 100644
--- a/src/tests/junit/org/apache/tools/ant/types/AssertionsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/AssertionsTest.java
@@ -1,125 +1,123 @@
-/*
- *  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.types;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.apache.tools.ant.AntAssert.assertContains;
-import static org.junit.Assert.fail;
-
-/**
- * test assertion handling
- */
-public class AssertionsTest {
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject("src/etc/testcases/types/assertions.xml");
-    }
-
-
-    /**
-     * runs a test and expects an assertion thrown in forked code
-     * @param target
-     */
-    private void expectAssertion(String target) {
-        try {
-            buildRule.executeTarget(target);
-            fail("BuildException should have been thrown by assertion fail in task");
-        } catch (BuildException ex) {
-            assertContains("assertion not thrown in "+target, "Java returned: 1", ex.getMessage());
-        }
-    }
-
-    @Test
-    public void testClassname() {
-        expectAssertion("test-classname");
-    }
-
-    @Test
-    public void testPackage() {
-        expectAssertion("test-package");
-    }
-
-    @Test
-    public void testEmptyAssertions() {
-        buildRule.executeTarget("test-empty-assertions");
-    }
-
-    @Test
-    public void testDisable() {
-        buildRule.executeTarget("test-disable");
-    }
-
-    @Test
-    public void testOverride() {
-        expectAssertion("test-override");
-    }
-
-    @Test
-    public void testOverride2() {
-        buildRule.executeTarget("test-override2");
-    }
-
-    @Test
-    public void testReferences() {
-        expectAssertion("test-references");
-    }
-
-    @Test
-    public void testMultipleAssertions() {
-        try {
-            buildRule.executeTarget("test-multiple-assertions");
-            fail("BuildException should have been thrown by assertion fail in task");
-        } catch (BuildException ex) {
-            assertContains("multiple assertions rejected", "Only one assertion declaration is allowed", ex.getMessage());
-        }
-    }
-
-    @Test
-    public void testReferenceAbuse() {
-        try {
-            buildRule.executeTarget("test-reference-abuse");
-            fail("BuildException should have been thrown by reference abuse");
-        } catch (BuildException ex) {
-            assertContains("reference abuse rejected", "You must not specify", ex.getMessage());
-        }
-    }
-
-    @Test
-    public void testNofork() {
-        Assume.assumeFalse("ran Ant tests with -ea and this would fail spuriously", AssertionsTest.class.desiredAssertionStatus());
-        buildRule.executeTarget("test-nofork");
-        assertContains("Assertion statements are currently ignored in non-forked mode", buildRule.getLog());
-    }
-
-    @Test
-    public void testJUnit() {
-        buildRule.executeTarget("test-junit");
-    }
-}
-
-
+/*
+ *  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.types;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.apache.tools.ant.AntAssert.assertContains;
+import static org.junit.Assert.fail;
+
+/**
+ * test assertion handling
+ */
+public class AssertionsTest {
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject("src/etc/testcases/types/assertions.xml");
+    }
+
+
+    /**
+     * runs a test and expects an assertion thrown in forked code
+     * @param target
+     */
+    private void expectAssertion(String target) {
+        try {
+            buildRule.executeTarget(target);
+            fail("BuildException should have been thrown by assertion fail in task");
+        } catch (BuildException ex) {
+            assertContains("assertion not thrown in "+target, "Java returned: 1", ex.getMessage());
+        }
+    }
+
+    @Test
+    public void testClassname() {
+        expectAssertion("test-classname");
+    }
+
+    @Test
+    public void testPackage() {
+        expectAssertion("test-package");
+    }
+
+    @Test
+    public void testEmptyAssertions() {
+        buildRule.executeTarget("test-empty-assertions");
+    }
+
+    @Test
+    public void testDisable() {
+        buildRule.executeTarget("test-disable");
+    }
+
+    @Test
+    public void testOverride() {
+        expectAssertion("test-override");
+    }
+
+    @Test
+    public void testOverride2() {
+        buildRule.executeTarget("test-override2");
+    }
+
+    @Test
+    public void testReferences() {
+        expectAssertion("test-references");
+    }
+
+    @Test
+    public void testMultipleAssertions() {
+        try {
+            buildRule.executeTarget("test-multiple-assertions");
+            fail("BuildException should have been thrown by assertion fail in task");
+        } catch (BuildException ex) {
+            assertContains("multiple assertions rejected", "Only one assertion declaration is allowed", ex.getMessage());
+        }
+    }
+
+    @Test
+    public void testReferenceAbuse() {
+        try {
+            buildRule.executeTarget("test-reference-abuse");
+            fail("BuildException should have been thrown by reference abuse");
+        } catch (BuildException ex) {
+            assertContains("reference abuse rejected", "You must not specify", ex.getMessage());
+        }
+    }
+
+    @Test
+    public void testNofork() {
+        Assume.assumeFalse("ran Ant tests with -ea and this would fail spuriously", AssertionsTest.class.desiredAssertionStatus());
+        buildRule.executeTarget("test-nofork");
+        assertContains("Assertion statements are currently ignored in non-forked mode", buildRule.getLog());
+    }
+
+    @Test
+    public void testJUnit() {
+        buildRule.executeTarget("test-junit");
+    }
+}