aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util')
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/Base64ConverterTest.java43
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/ClasspathUtilsTest.java67
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/CollectionUtilsTest.java102
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/DOMElementWriterTest.java305
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/DateUtilsTest.java106
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/DeweyDecimalTest.java70
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java625
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/GlobPatternMapperTest.java102
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/JAXPUtilsTest.java43
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java144
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java316
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/LazyFileOutputStreamTest.java75
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/LineOrientedOutputStreamTest.java153
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/LinkedHashtableTest.java165
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/LoaderUtilsTest.java43
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/PackageNameMapperTest.java43
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java142
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/ResourceUtilsTest.java63
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/StringUtilsTest.java170
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/SymlinkUtilsTest.java40
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/UnPackageNameMapperTest.java42
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/UnicodeUtilTest.java33
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/VectorSetTest.java295
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/XMLFragmentTest.java91
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/facade/FacadeTaskHelperTest.java64
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/facade/ImplementationSpecificArgumentTest.java59
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaOroMatcherTest.java35
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaOroRegexpTest.java35
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpMatcherTest.java63
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpRegexpTest.java62
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcherTest.java70
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexpTest.java71
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java204
-rw-r--r--framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpTest.java63
34 files changed, 0 insertions, 4004 deletions
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/Base64ConverterTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/Base64ConverterTest.java
deleted file mode 100644
index 48a4cbd7..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/Base64ConverterTest.java
+++ /dev/null
@@ -1,43 +0,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;
-
-/**
- * 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));
- }
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/ClasspathUtilsTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/ClasspathUtilsTest.java
deleted file mode 100644
index 3cffa100..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/ClasspathUtilsTest.java
+++ /dev/null
@@ -1,67 +0,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 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);
- }
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/CollectionUtilsTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/CollectionUtilsTest.java
deleted file mode 100644
index 425dc471..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/CollectionUtilsTest.java
+++ /dev/null
@@ -1,102 +0,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 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));
- }
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/DOMElementWriterTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/DOMElementWriterTest.java
deleted file mode 100644
index fe09ce93..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/DOMElementWriterTest.java
+++ /dev/null
@@ -1,305 +0,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 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("", w.isReference(""));
- assertTrue(" ", w.isReference(" "));
- assertTrue(" ", w.isReference(" "));
- assertTrue("&#A0;", !w.isReference("&#A0;"));
- assertTrue("20;", !w.isReference("20;"));
- assertTrue("&#20", !w.isReference("&#20"));
- assertTrue(""", w.isReference("""));
- assertTrue("'", w.isReference("'"));
- assertTrue(">", w.isReference(">"));
- assertTrue("<", w.isReference("<"));
- assertTrue("&", w.isReference("&"));
- }
-
- @Test
- public void testEncode() {
- assertEquals("", w.encode(""));
- assertEquals(" ", w.encode(" "));
- assertEquals(" ", w.encode(" "));
- assertEquals("&#A0;", w.encode("&#A0;"));
- assertEquals("20;", w.encode("20;"));
- assertEquals("&#20", w.encode("&#20"));
- assertEquals(""", w.encode("""));
- assertEquals("'", w.encode("'"));
- assertEquals(">", w.encode(">"));
- assertEquals("<", w.encode("<"));
- assertEquals("&", w.encode("&"));
- assertEquals(""", 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());
- }
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/DateUtilsTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/DateUtilsTest.java
deleted file mode 100644
index 4f5aa844..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/DateUtilsTest.java
+++ /dev/null
@@ -1,106 +0,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 java.util.Calendar;
-import java.util.TimeZone;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * TestCase for DateUtils.
- *
- */
-public class DateUtilsTest {
-
-
- @Test
- public void testElapsedTime(){
- String text = DateUtils.formatElapsedTime(50*1000);
- assertEquals("50 seconds", text);
- text = DateUtils.formatElapsedTime(65*1000);
- assertEquals("1 minute 5 seconds", text);
- text = DateUtils.formatElapsedTime(120*1000);
- assertEquals("2 minutes 0 seconds", text);
- text = DateUtils.formatElapsedTime(121*1000);
- assertEquals("2 minutes 1 second", text);
- }
-
- // https://issues.apache.org/bugzilla/show_bug.cgi?id=44659
- @Test
- public void testLongElapsedTime(){
- assertEquals("2926 minutes 13 seconds",
- DateUtils.formatElapsedTime(1000 * 175573));
- assertEquals("153722867280912 minutes 55 seconds",
- DateUtils.formatElapsedTime(Long.MAX_VALUE));
- }
-
- @Test
- public void testDateTimeISO(){
- TimeZone timeZone = TimeZone.getTimeZone("GMT+1");
- Calendar cal = Calendar.getInstance(timeZone);
- cal.set(2002,1,23,10,11,12);
- String text = DateUtils.format(cal.getTime(),
- DateUtils.ISO8601_DATETIME_PATTERN);
- assertEquals("2002-02-23T09:11:12", text);
- }
-
- @Test
- public void testDateISO(){
- TimeZone timeZone = TimeZone.getTimeZone("GMT");
- Calendar cal = Calendar.getInstance(timeZone);
- cal.set(2002,1,23);
- String text = DateUtils.format(cal.getTime(),
- DateUtils.ISO8601_DATE_PATTERN);
- assertEquals("2002-02-23", text);
- }
-
- @Test
- public void testTimeISODate(){
- // make sure that elapsed time in set via date works
- TimeZone timeZone = TimeZone.getTimeZone("GMT+1");
- Calendar cal = Calendar.getInstance(timeZone);
- cal.set(2002,1,23, 21, 11, 12);
- String text = DateUtils.format(cal.getTime(),
- DateUtils.ISO8601_TIME_PATTERN);
- assertEquals("20:11:12", text);
- }
-
- @Test
- public void testTimeISO(){
- // make sure that elapsed time in ms works
- long ms = (20*3600 + 11*60 + 12)*1000;
- String text = DateUtils.format(ms,
- DateUtils.ISO8601_TIME_PATTERN);
- assertEquals("20:11:12", text);
- }
-
- @Test
- public void testPhaseOfMoon() {
- TimeZone timeZone = TimeZone.getTimeZone("GMT");
- Calendar cal = Calendar.getInstance(timeZone);
- // should be full moon
- cal.set(2002, 2, 27);
- assertEquals(4, DateUtils.getPhaseOfMoon(cal));
- // should be new moon
- cal.set(2002, 2, 12);
- assertEquals(0, DateUtils.getPhaseOfMoon(cal));
- }
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/DeweyDecimalTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/DeweyDecimalTest.java
deleted file mode 100644
index bcda609b..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/DeweyDecimalTest.java
+++ /dev/null
@@ -1,70 +0,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 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, ...
-
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java
deleted file mode 100644
index d0361cc5..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java
+++ /dev/null
@@ -1,625 +0,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 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);
- }
- }
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/GlobPatternMapperTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/GlobPatternMapperTest.java
deleted file mode 100644
index 5bd7db60..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/GlobPatternMapperTest.java
+++ /dev/null
@@ -1,102 +0,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]);
- }
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/JAXPUtilsTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/JAXPUtilsTest.java
deleted file mode 100644
index 105c33d1..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/JAXPUtilsTest.java
+++ /dev/null
@@ -1,43 +0,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 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:////"));
- }
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java
deleted file mode 100644
index 8bcb1f2c..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java
+++ /dev/null
@@ -1,144 +0,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 java.io.File;
-
-import junit.framework.AssertionFailedError;
-
-import org.apache.tools.ant.taskdefs.condition.Os;
-import org.junit.Assume;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-/**
- * TestCase for JavaEnvUtils.
- *
- */
-public class JavaEnvUtilsTest {
-
- private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
-
-
- @Test
- public void testGetExecutableNetware() {
- Assume.assumeTrue("Test only runs on netware", Os.isName("netware"));
- assertEquals("java", JavaEnvUtils.getJreExecutable("java"));
- assertEquals("javac", JavaEnvUtils.getJdkExecutable("javac"));
- assertEquals("foo", JavaEnvUtils.getJreExecutable("foo"));
- assertEquals("foo", JavaEnvUtils.getJdkExecutable("foo"));
- }
-
- @Test
- public void testGetExecutableWindows() {
- Assume.assumeTrue("Test only runs on windows", Os.isFamily("windows"));
- String javaHome =
- FILE_UTILS.normalize(System.getProperty("java.home"))
- .getAbsolutePath();
-
- String j = JavaEnvUtils.getJreExecutable("java");
- assertTrue(j.endsWith(".exe"));
- assertTrue(j+" is absolute", (new File(j)).isAbsolute());
- try {
- assertTrue(j+" is normalized and in the JRE dir",
- j.startsWith(javaHome));
- } catch (AssertionFailedError e) {
- // java.home is bogus
- assertEquals("java.exe", j);
- }
-
- j = JavaEnvUtils.getJdkExecutable("javac");
- assertTrue(j.endsWith(".exe"));
- try {
- assertTrue(j+" is absolute", (new File(j)).isAbsolute());
- String javaHomeParent =
- FILE_UTILS.normalize(javaHome+"/..").getAbsolutePath();
- assertTrue(j+" is normalized and in the JDK dir",
- j.startsWith(javaHomeParent));
- assertTrue(j+" is normalized and not in the JRE dir",
- !j.startsWith(javaHome));
-
- } catch (AssertionFailedError e) {
- // java.home is bogus
- assertEquals("javac.exe", j);
- }
-
- assertEquals("foo.exe", JavaEnvUtils.getJreExecutable("foo"));
- assertEquals("foo.exe", JavaEnvUtils.getJdkExecutable("foo"));
- }
-
- @Test
- public void testGetExecutableMostPlatforms() {
- Assume.assumeTrue("Test only runs on non Netware and non Windows systems",
- !Os.isName("netware") && !Os.isFamily("windows"));
- String javaHome =
- FILE_UTILS.normalize(System.getProperty("java.home"))
- .getAbsolutePath();
-
- // could still be OS/2
- String extension = Os.isFamily("dos") ? ".exe" : "";
-
- String j = JavaEnvUtils.getJreExecutable("java");
- if (!extension.equals("")) {
- assertTrue(j.endsWith(extension));
- }
- assertTrue(j+" is absolute", (new File(j)).isAbsolute());
- assertTrue(j+" is normalized and in the JRE dir",
- j.startsWith(javaHome));
-
- j = JavaEnvUtils.getJdkExecutable("javac");
- if (!extension.equals("")) {
- assertTrue(j.endsWith(extension));
- }
- assertTrue(j+" is absolute", (new File(j)).isAbsolute());
-
- String javaHomeParent =
- FILE_UTILS.normalize(javaHome+"/..").getAbsolutePath();
- assertTrue(j+" is normalized and in the JDK dir",
- j.startsWith(javaHomeParent));
-
- if ((Os.isFamily("mac") && JavaEnvUtils.getJavaVersionNumber() <= JavaEnvUtils.VERSION_1_6)
- || JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_1_9)) {
- assertTrue(j+" is normalized and in the JRE dir",
- j.startsWith(javaHome));
- } else {
- assertTrue(j+" is normalized and not in the JRE dir",
- !j.startsWith(javaHome));
- }
-
- assertEquals("foo"+extension,
- JavaEnvUtils.getJreExecutable("foo"));
- assertEquals("foo"+extension,
- JavaEnvUtils.getJdkExecutable("foo"));
- }
-
- @Test
- public void testIsAtLeastJavaVersion()
- {
- assertTrue(
- "Current java version is not at least the current java version...",
- JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.getJavaVersion()));
- assertFalse(
- "In case the current java version is higher than 9.0 definitely a new algorithem will be needed",
- JavaEnvUtils.isAtLeastJavaVersion("9.0"));
- }
-
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java
deleted file mode 100644
index 89cd3daa..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java
+++ /dev/null
@@ -1,316 +0,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 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;
- }
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/LazyFileOutputStreamTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/LazyFileOutputStreamTest.java
deleted file mode 100644
index 82c36340..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/LazyFileOutputStreamTest.java
+++ /dev/null
@@ -1,75 +0,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 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());
- }
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/LineOrientedOutputStreamTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/LineOrientedOutputStreamTest.java
deleted file mode 100644
index 1fa23e84..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/LineOrientedOutputStreamTest.java
+++ /dev/null
@@ -1,153 +0,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 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
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/LinkedHashtableTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/LinkedHashtableTest.java
deleted file mode 100644
index bfd2cda7..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/LinkedHashtableTest.java
+++ /dev/null
@@ -1,165 +0,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 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());
- }
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/LoaderUtilsTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/LoaderUtilsTest.java
deleted file mode 100644
index 9935edd6..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/LoaderUtilsTest.java
+++ /dev/null
@@ -1,43 +0,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 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());
- }
-
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/PackageNameMapperTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/PackageNameMapperTest.java
deleted file mode 100644
index fdf73931..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/PackageNameMapperTest.java
+++ /dev/null
@@ -1,43 +0,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 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);
- }
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java
deleted file mode 100644
index bd07251e..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java
+++ /dev/null
@@ -1,142 +0,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 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);
- }
- }
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/ResourceUtilsTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/ResourceUtilsTest.java
deleted file mode 100644
index 96cc9cbf..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/ResourceUtilsTest.java
+++ /dev/null
@@ -1,63 +0,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.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"};
- }
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/StringUtilsTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/StringUtilsTest.java
deleted file mode 100644
index 53ef1b29..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/StringUtilsTest.java
+++ /dev/null
@@ -1,170 +0,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 java.util.Vector;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Test for StringUtils
- */
-public class StringUtilsTest {
-
- @Test
- public void testSplit(){
- final String data = "a,b,,";
- Vector res = StringUtils.split(data, ',');
- assertEquals(4, res.size());
- assertEquals("a", res.elementAt(0));
- assertEquals("b", res.elementAt(1));
- assertEquals("", res.elementAt(2));
- assertEquals("", res.elementAt(3));
- }
-
- @Test
- public void testSplitLines(){
- final String data = "a\r\nb\nc\nd\ne";
- Vector res = StringUtils.lineSplit(data);
- assertEquals(5, res.size());
- assertEquals("a\r", res.elementAt(0));
- assertEquals("b", res.elementAt(1));
- assertEquals("c", res.elementAt(2));
- assertEquals("d", res.elementAt(3));
- assertEquals("e", res.elementAt(4));
- }
-
- @Test
- public void testReplace() {
- final String data = "abcabcabca";
- String res = StringUtils.replace(data, "a", "");
- assertEquals("bcbcbc", res);
- }
-
- @Test
- public void testEndsWithBothEmpty() {
- assertTrue( StringUtils.endsWith( new StringBuffer(), "") );
- }
-
- @Test
- public void testEndsWithEmptyString() {
- assertTrue( StringUtils.endsWith( new StringBuffer("12234545"), "") );
- }
-
- @Test
- public void testEndsWithShorterString() {
- assertTrue( StringUtils.endsWith( new StringBuffer("12345678"), "78"));
- }
-
- @Test
- public void testEndsWithSameString() {
- assertTrue( StringUtils.endsWith( new StringBuffer("123"), "123"));
- }
-
- @Test
- public void testEndsWithLongerString() {
- assertFalse( StringUtils.endsWith( new StringBuffer("12"), "1245"));
- }
-
- @Test
- public void testEndsWithNoMatch() {
- assertFalse( StringUtils.endsWith( new StringBuffer("12345678"), "789"));
- }
-
- @Test
- public void testEndsWithEmptyBuffer() {
- assertFalse( StringUtils.endsWith( new StringBuffer(""), "12345667") );
- }
-
- @Test
- public void testEndsWithJDKPerf() {
- StringBuffer buf = getFilledBuffer(1024*300, 'a');
- for (int i = 0; i < 1000; i++) {
- assertTrue(buf.toString().endsWith("aa"));
- }
- }
-
- @Test
- public void testEndsWithPerf() {
- StringBuffer buf = getFilledBuffer(1024*300, 'a');
- for (int i = 0; i < 1000; i++) {
- assertTrue(StringUtils.endsWith(buf, "aa"));
- }
- }
-
- private StringBuffer getFilledBuffer(int size, char ch) {
- StringBuffer buf = new StringBuffer(size);
- for (int i = 0; i < size; i++) { buf.append(ch); };
- return buf;
- }
-
- @Test
- public void testParseHumanSizes() throws Exception {
- final long KILOBYTE = 1024;
- final long MEGABYTE = KILOBYTE * 1024;
- final long GIGABYTE = MEGABYTE * 1024;
- final long TERABYTE = GIGABYTE * 1024;
- final long PETABYTE = TERABYTE * 1024;
- assertEquals(StringUtils.parseHumanSizes("1K"), KILOBYTE);
- assertEquals(StringUtils.parseHumanSizes("1M"), MEGABYTE);
- assertEquals(StringUtils.parseHumanSizes("1G"), GIGABYTE);
- assertEquals(StringUtils.parseHumanSizes("1T"), TERABYTE);
- assertEquals(StringUtils.parseHumanSizes("1P"), PETABYTE);
- assertEquals(StringUtils.parseHumanSizes("1"), 1L);
- }
-
- @Test
- public void testRemoveSuffix() {
- String prefix = "Prefix";
- String name = "Name";
- String suffix = "Suffix";
- String input = prefix + name + suffix;
- assertEquals(
- "Does not remove the suffix right.",
- prefix + name,
- StringUtils.removeSuffix(input, suffix)
- );
- assertEquals(
- "Should leave the string unattended.",
- prefix + name + suffix,
- StringUtils.removeSuffix(input, "bla")
- );
- }
-
- @Test
- public void testRemovePrefix() {
- String prefix = "Prefix";
- String name = "Name";
- String suffix = "Suffix";
- String input = prefix + name + suffix;
- assertEquals(
- "Does not remove the prefix right.",
- name + suffix,
- StringUtils.removePrefix(input, prefix)
- );
- assertEquals(
- "Should leave the string unattended.",
- prefix + name + suffix,
- StringUtils.removePrefix(input, "bla")
- );
- }
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/SymlinkUtilsTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/SymlinkUtilsTest.java
deleted file mode 100644
index d1de1b1a..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/SymlinkUtilsTest.java
+++ /dev/null
@@ -1,40 +0,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 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("/"));
- }
-
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/UnPackageNameMapperTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/UnPackageNameMapperTest.java
deleted file mode 100644
index 7586950d..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/UnPackageNameMapperTest.java
+++ /dev/null
@@ -1,42 +0,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 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);
- }
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/UnicodeUtilTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/UnicodeUtilTest.java
deleted file mode 100644
index 090da569..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/UnicodeUtilTest.java
+++ /dev/null
@@ -1,33 +0,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;
-
-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());
- }
-
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/VectorSetTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/VectorSetTest.java
deleted file mode 100644
index 11491e3a..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/VectorSetTest.java
+++ /dev/null
@@ -1,295 +0,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 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());
- }
-
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/XMLFragmentTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/XMLFragmentTest.java
deleted file mode 100644
index 0ac938f0..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/XMLFragmentTest.java
+++ /dev/null
@@ -1,91 +0,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.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());
- }
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/facade/FacadeTaskHelperTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/facade/FacadeTaskHelperTest.java
deleted file mode 100644
index df2d43b3..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/facade/FacadeTaskHelperTest.java
+++ /dev/null
@@ -1,64 +0,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.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());
- }
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/facade/ImplementationSpecificArgumentTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/facade/ImplementationSpecificArgumentTest.java
deleted file mode 100644
index a1b97d1d..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/facade/ImplementationSpecificArgumentTest.java
+++ /dev/null
@@ -1,59 +0,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.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]);
- }
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaOroMatcherTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaOroMatcherTest.java
deleted file mode 100644
index d1405f4a..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaOroMatcherTest.java
+++ /dev/null
@@ -1,35 +0,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.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);
- }
-
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaOroRegexpTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaOroRegexpTest.java
deleted file mode 100644
index e869c62e..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaOroRegexpTest.java
+++ /dev/null
@@ -1,35 +0,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.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);
- }
-
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpMatcherTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpMatcherTest.java
deleted file mode 100644
index 3340b59c..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpMatcherTest.java
+++ /dev/null
@@ -1,63 +0,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.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) {}
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpRegexpTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpRegexpTest.java
deleted file mode 100644
index 078fbb1b..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpRegexpTest.java
+++ /dev/null
@@ -1,62 +0,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.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) {}
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcherTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcherTest.java
deleted file mode 100644
index c042e715..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcherTest.java
+++ /dev/null
@@ -1,70 +0,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.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){
- }
- }
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexpTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexpTest.java
deleted file mode 100644
index 2b60406a..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexpTest.java
+++ /dev/null
@@ -1,71 +0,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.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){
- }
- }
-
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java
deleted file mode 100644
index 09508274..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java
+++ /dev/null
@@ -1,204 +0,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.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));
- }
-
-}
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpTest.java b/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpTest.java
deleted file mode 100644
index 5cfe8c97..00000000
--- a/framework/src/ant/apache-ant-1.9.6/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpTest.java
+++ /dev/null
@@ -1,63 +0,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.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));
- }
-}