You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by gi...@apache.org on 2017/11/29 16:18:13 UTC
[09/21] ant git commit: Normalise tabulation and line breaks
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/resources/TarResourceTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/resources/TarResourceTest.java b/src/tests/junit/org/apache/tools/ant/types/resources/TarResourceTest.java
index d0a0fe3..a9593f0 100644
--- a/src/tests/junit/org/apache/tools/ant/types/resources/TarResourceTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/resources/TarResourceTest.java
@@ -1,54 +1,54 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.tools.ant.types.resources;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import java.io.File;
-
-import static org.apache.tools.ant.FileUtilities.getFileContents;
-import static org.junit.Assert.assertEquals;
-
-
-public class TarResourceTest {
-
- @Rule
- public BuildFileRule buildRule = new BuildFileRule();
-
- @Before
- public void setUp() throws Exception {
- buildRule.configureProject("src/etc/testcases/types/resources/tarentry.xml");
- }
-
-
- @After
- public void tearDown() throws Exception {
- buildRule.executeTarget("tearDown");
- }
-
- @Test
- public void testUncompressSource() throws java.io.IOException {
- buildRule.executeTarget("uncompressSource");
- assertEquals(getFileContents(buildRule.getProject().resolveFile("../../asf-logo.gif")),
- getFileContents(new File(buildRule.getProject().getProperty("output"), "asf-logo.gif")));
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.tools.ant.types.resources;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import java.io.File;
+
+import static org.apache.tools.ant.FileUtilities.getFileContents;
+import static org.junit.Assert.assertEquals;
+
+
+public class TarResourceTest {
+
+ @Rule
+ public BuildFileRule buildRule = new BuildFileRule();
+
+ @Before
+ public void setUp() throws Exception {
+ buildRule.configureProject("src/etc/testcases/types/resources/tarentry.xml");
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+ buildRule.executeTarget("tearDown");
+ }
+
+ @Test
+ public void testUncompressSource() throws java.io.IOException {
+ buildRule.executeTarget("uncompressSource");
+ assertEquals(getFileContents(buildRule.getProject().resolveFile("../../asf-logo.gif")),
+ getFileContents(new File(buildRule.getProject().getProperty("output"), "asf-logo.gif")));
+ }
+}
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorRule.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorRule.java b/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorRule.java
index 8862cb1..d5613b2 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorRule.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorRule.java
@@ -1,125 +1,125 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.tools.ant.types.selectors;
-
-import java.io.File;
-
-
-import org.apache.tools.ant.BuildFileRule;
-
-
-/**
- * Base test case for Selectors. Provides a shared test as well as
- * a test bed for selecting on, and a helper method for determining
- * whether selections are correct.
- *
- */
-public class BaseSelectorRule extends BuildFileRule {
-
- private File beddir;
- private File mirrordir;
- private final String[] filenames = {".","asf-logo.gif.md5","asf-logo.gif.bz2",
- "asf-logo.gif.gz","copy.filterset.filtered","zip/asf-logo.gif.zip",
- "tar/asf-logo.gif.tar","tar/asf-logo-huge.tar.gz",
- "tar/gz/asf-logo.gif.tar.gz","tar/bz2/asf-logo.gif.tar.bz2",
- "tar/bz2/asf-logo-huge.tar.bz2","tar/bz2"};
- private File[] files = new File[filenames.length];
- private File[] mirrorfiles = new File[filenames.length];
-
- @Override
- public void before() throws Throwable {
- super.before();
- configureProject("src/etc/testcases/types/selectors.xml");
- executeTarget("setUp");
-
- executeTarget("setupfiles");
- executeTarget("mirrorfiles");
-
- beddir = new File(super.getProject().getProperty("test.dir"));
- mirrordir = new File(super.getProject().getProperty("mirror.dir"));
-
- for (int x = 0; x < files.length; x++) {
- files[x] = new File(beddir,filenames[x]);
- mirrorfiles[x] = new File(mirrordir,filenames[x]);
- }
- }
-
- @Override
- public void after() {
- super.after();
- executeTarget("tearDown");
- }
-
- public File getBeddir() {
- return beddir;
- }
-
- public File[] getMirrorFiles() {
- return mirrorfiles;
- }
-
- public File[] getFiles() {
- return files;
- }
-
- public String[] getFilenames() {
- return filenames;
- }
-
-
- /**
- * This is a helper method that takes a selector and calls its
- * isSelected() method on each file in the testbed. It returns
- * a string of "T"s amd "F"s
- */
- public String selectionString(FileSelector selector) {
- return selectionString(beddir,files,selector);
- }
-
- /**
- * This is a helper method that takes a selector and calls its
- * isSelected() method on each file in the mirror testbed. This
- * variation is used for dependency checks and to get around the
- * limitations in the touch task when running JDK 1.1. It returns
- * a string of "T"s amd "F"s.
- */
- public String mirrorSelectionString(FileSelector selector) {
- return selectionString(mirrordir,mirrorfiles,selector);
- }
-
- /**
- * Worker method for the two convenience methods above. Applies a
- * selector on a set of files passed in and returns a string of
- * "T"s amd "F"s from applying the selector to each file.
- */
- public String selectionString(File basedir, File[] files, FileSelector selector) {
- StringBuilder buf = new StringBuilder();
- for (int x = 0; x < files.length; x++) {
- if (selector.isSelected(basedir,filenames[x],files[x])) {
- buf.append('T');
- }
- else {
- buf.append('F');
- }
- }
- return buf.toString();
- }
-
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.tools.ant.types.selectors;
+
+import java.io.File;
+
+
+import org.apache.tools.ant.BuildFileRule;
+
+
+/**
+ * Base test case for Selectors. Provides a shared test as well as
+ * a test bed for selecting on, and a helper method for determining
+ * whether selections are correct.
+ *
+ */
+public class BaseSelectorRule extends BuildFileRule {
+
+ private File beddir;
+ private File mirrordir;
+ private final String[] filenames = {".","asf-logo.gif.md5","asf-logo.gif.bz2",
+ "asf-logo.gif.gz","copy.filterset.filtered","zip/asf-logo.gif.zip",
+ "tar/asf-logo.gif.tar","tar/asf-logo-huge.tar.gz",
+ "tar/gz/asf-logo.gif.tar.gz","tar/bz2/asf-logo.gif.tar.bz2",
+ "tar/bz2/asf-logo-huge.tar.bz2","tar/bz2"};
+ private File[] files = new File[filenames.length];
+ private File[] mirrorfiles = new File[filenames.length];
+
+ @Override
+ public void before() throws Throwable {
+ super.before();
+ configureProject("src/etc/testcases/types/selectors.xml");
+ executeTarget("setUp");
+
+ executeTarget("setupfiles");
+ executeTarget("mirrorfiles");
+
+ beddir = new File(super.getProject().getProperty("test.dir"));
+ mirrordir = new File(super.getProject().getProperty("mirror.dir"));
+
+ for (int x = 0; x < files.length; x++) {
+ files[x] = new File(beddir,filenames[x]);
+ mirrorfiles[x] = new File(mirrordir,filenames[x]);
+ }
+ }
+
+ @Override
+ public void after() {
+ super.after();
+ executeTarget("tearDown");
+ }
+
+ public File getBeddir() {
+ return beddir;
+ }
+
+ public File[] getMirrorFiles() {
+ return mirrorfiles;
+ }
+
+ public File[] getFiles() {
+ return files;
+ }
+
+ public String[] getFilenames() {
+ return filenames;
+ }
+
+
+ /**
+ * This is a helper method that takes a selector and calls its
+ * isSelected() method on each file in the testbed. It returns
+ * a string of "T"s amd "F"s
+ */
+ public String selectionString(FileSelector selector) {
+ return selectionString(beddir,files,selector);
+ }
+
+ /**
+ * This is a helper method that takes a selector and calls its
+ * isSelected() method on each file in the mirror testbed. This
+ * variation is used for dependency checks and to get around the
+ * limitations in the touch task when running JDK 1.1. It returns
+ * a string of "T"s amd "F"s.
+ */
+ public String mirrorSelectionString(FileSelector selector) {
+ return selectionString(mirrordir,mirrorfiles,selector);
+ }
+
+ /**
+ * Worker method for the two convenience methods above. Applies a
+ * selector on a set of files passed in and returns a string of
+ * "T"s amd "F"s from applying the selector to each file.
+ */
+ public String selectionString(File basedir, File[] files, FileSelector selector) {
+ StringBuilder buf = new StringBuilder();
+ for (int x = 0; x < files.length; x++) {
+ if (selector.isSelected(basedir,filenames[x],files[x])) {
+ buf.append('T');
+ }
+ else {
+ buf.append('F');
+ }
+ }
+ return buf.toString();
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorTest.java
index 1cc38d4..2332778 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorTest.java
@@ -1,295 +1,295 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.tools.ant.types.selectors;
-
-import java.io.File;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.BuildFileTest;
-import org.apache.tools.ant.Project;
-
-/**
- * Base test case for Selectors. Provides a shared test as well as
- * a test bed for selecting on, and a helper method for determining
- * whether selections are correct.
- *
- * @deprecated as of 1.9.4. Use {@link org.apache.tools.ant.types.selectors.BaseSelectorRule} instead.
- */
-@Deprecated
-public abstract class BaseSelectorTest extends BuildFileTest {
-
- private Project project;
- private TaskdefForMakingBed tbed = null;
- protected File basedir;
- protected File beddir;
- protected File mirrordir;
- protected String[] filenames = {".","asf-logo.gif.md5","asf-logo.gif.bz2",
- "asf-logo.gif.gz","copy.filterset.filtered","zip/asf-logo.gif.zip",
- "tar/asf-logo.gif.tar","tar/asf-logo-huge.tar.gz",
- "tar/gz/asf-logo.gif.tar.gz","tar/bz2/asf-logo.gif.tar.bz2",
- "tar/bz2/asf-logo-huge.tar.bz2","tar/bz2"};
- protected File[] files = new File[filenames.length];
- protected File[] mirrorfiles = new File[filenames.length];
-
- public BaseSelectorTest(String name) {
- super(name);
- }
-
- public void setUp() {
- configureProject("src/etc/testcases/types/selectors.xml");
- executeTarget("setUp");
- beddir = new File(super.getProject().getProperty("test.dir"));
- mirrordir = new File(super.getProject().getProperty("mirror.dir"));
- basedir = getProjectDir();
- project = new Project();
- project.init();
- project.setBaseDir(basedir);
- for (int x = 0; x < files.length; x++) {
- files[x] = new File(beddir,filenames[x]);
- mirrorfiles[x] = new File(mirrordir,filenames[x]);
- }
- }
-
- /**
- * Override this in child classes to return a specific Selector
- */
- public abstract BaseSelector getInstance();
-
-
- /**
- * Return a preconfigured selector (with a set reference to
- * project instance).
- * @return the selector
- */
- public BaseSelector getSelector() {
- BaseSelector selector = getInstance();
- selector.setProject( getProject() );
- return selector;
- }
-
-
- public Project getProject() {
- return project;
- }
-
- /**
- * This is a test that all Selectors derived from BaseSelector can
- * use. It calls the setError() method and checks to ensure that a
- * BuildException is thrown as a result.
- */
- public void testRespondsToError() {
- BaseSelector s = getInstance();
- if (s == null) {
- return;
- }
- s.setError("test error");
- try {
- s.isSelected(beddir,filenames[0],files[0]);
- fail("Cannot cause BuildException when setError() is called");
- } catch (BuildException be) {
- assertEquals("test error",
- be.getMessage());
- }
- }
-
-
- /**
- * This is a helper method that takes a selector and calls its
- * isSelected() method on each file in the testbed. It returns
- * a string of "T"s amd "F"s
- */
- public String selectionString(FileSelector selector) {
- return selectionString(beddir,files,selector);
- }
-
- /**
- * This is a helper method that takes a selector and calls its
- * isSelected() method on each file in the mirror testbed. This
- * variation is used for dependency checks and to get around the
- * limitations in the touch task when running JDK 1.1. It returns
- * a string of "T"s amd "F"s.
- */
- public String mirrorSelectionString(FileSelector selector) {
- return selectionString(mirrordir,mirrorfiles,selector);
- }
-
- /**
- * Worker method for the two convenience methods above. Applies a
- * selector on a set of files passed in and returns a string of
- * "T"s amd "F"s from applying the selector to each file.
- */
- public String selectionString(File basedir, File[] files, FileSelector selector) {
- StringBuffer buf = new StringBuffer();
- for (int x = 0; x < files.length; x++) {
- if (selector.isSelected(basedir,filenames[x],files[x])) {
- buf.append('T');
- }
- else {
- buf.append('F');
- }
- }
- return buf.toString();
- }
-
- /**
- * Does the selection test for a given selector and prints the
- * filenames of the differing files (selected but shouldn't,
- * not selected but should).
- * @param selector The selector to test
- * @param expected The expected result
- */
- public void performTests(FileSelector selector, String expected) {
- String result = selectionString(selector);
- String diff = diff(expected, result);
- String resolved = resolve(diff);
- assertEquals("Differing files: " + resolved, result, expected);
- }
-
- /**
- * Checks which files are selected and shouldn't be or which
- * are not selected but should.
- * @param expected String containing 'F's and 'T's
- * @param result String containing 'F's and 'T's
- * @return Difference as String containing '-' (equal) and
- * 'X' (difference).
- */
- public String diff(String expected, String result) {
- int length1 = expected.length();
- int length2 = result.length();
- int min = (length1 > length2) ? length2 : length1;
- StringBuffer sb = new StringBuffer();
- for (int i=0; i<min; i++) {
- sb.append(
- (expected.charAt(i) == result.charAt(i))
- ? "-"
- : "X"
- );
- }
- return sb.toString();
- }
-
-
- /**
- * Resolves a diff-String (@see diff()) against the (inherited) filenames-
- * and files arrays.
- * @param filelist Diff-String
- * @return String containing the filenames for all differing files,
- * separated with semicolons ';'
- */
- public String resolve(String filelist) {
- StringBuffer sb = new StringBuffer();
- int min = (filenames.length > filelist.length())
- ? filelist.length()
- : filenames.length;
- for (int i=0; i<min; i++) {
- if ('X'==filelist.charAt(i)) {
- sb.append(filenames[i]);
- sb.append(";");
- }
- }
- return sb.toString();
- }
-
-
- /**
- * <p>Creates a testbed. We avoid the dreaded "test" word so that we
- * don't falsely identify this as a test to be run. The actual
- * setting up of the testbed is done in the
- * <code>src/etc/testcases/types/selectors.xml</code> build file.</p>
- *
- * <p>Note that the right way to call this is within a try block,
- * with a finally clause that calls cleanupBed(). You place tests of
- * the isSelected() method within the try block.</p>
- */
- protected void makeBed() {
- tbed = new TaskdefForMakingBed("setupfiles");
- tbed.setUp();
- tbed.makeTestbed();
- }
-
- /**
- * Cleans up the testbed by calling a target in the
- * <code>src/etc/testcases/types/selectors.xml</code> file.
- */
- protected void cleanupBed() {
- if (tbed != null) {
- tbed.tearDown();
- tbed = null;
- }
- }
-
-
- /**
- * <p>Creates a mirror of the testbed for use in dependency checks.</p>
- *
- * <p>Note that the right way to call this is within a try block,
- * with a finally clause that calls cleanupMirror(). You place tests of
- * the isSelected() method within the try block.</p>
- */
- protected void makeMirror() {
- tbed = new TaskdefForMakingBed("mirrorfiles");
- tbed.setUp();
- tbed.makeMirror();
- }
-
- /**
- * Cleans up the mirror testbed by calling a target in the
- * <code>src/etc/testcases/types/selectors.xml</code> file.
- */
- protected void cleanupMirror() {
- if (tbed != null) {
- tbed.deleteMirror();
- tbed = null;
- }
- }
-
- private class TaskdefForMakingBed extends BuildFileTest {
-
- TaskdefForMakingBed(String name) {
- super(name);
- }
-
- public void setUp() {
- configureProject("src/etc/testcases/types/selectors.xml");
- }
-
- public void tearDown() {
- try {
- super.tearDown();
- } catch (Exception exc) {
- // ignore
- }
- }
-
- public void makeTestbed() {
- executeTarget("setupfiles");
- }
-
- public void makeMirror() {
- executeTarget("mirrorfiles");
- }
-
- public void deleteMirror() {
- executeTarget("tearDown");
- }
- }
-
-
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.tools.ant.types.selectors;
+
+import java.io.File;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileTest;
+import org.apache.tools.ant.Project;
+
+/**
+ * Base test case for Selectors. Provides a shared test as well as
+ * a test bed for selecting on, and a helper method for determining
+ * whether selections are correct.
+ *
+ * @deprecated as of 1.9.4. Use {@link org.apache.tools.ant.types.selectors.BaseSelectorRule} instead.
+ */
+@Deprecated
+public abstract class BaseSelectorTest extends BuildFileTest {
+
+ private Project project;
+ private TaskdefForMakingBed tbed = null;
+ protected File basedir;
+ protected File beddir;
+ protected File mirrordir;
+ protected String[] filenames = {".","asf-logo.gif.md5","asf-logo.gif.bz2",
+ "asf-logo.gif.gz","copy.filterset.filtered","zip/asf-logo.gif.zip",
+ "tar/asf-logo.gif.tar","tar/asf-logo-huge.tar.gz",
+ "tar/gz/asf-logo.gif.tar.gz","tar/bz2/asf-logo.gif.tar.bz2",
+ "tar/bz2/asf-logo-huge.tar.bz2","tar/bz2"};
+ protected File[] files = new File[filenames.length];
+ protected File[] mirrorfiles = new File[filenames.length];
+
+ public BaseSelectorTest(String name) {
+ super(name);
+ }
+
+ public void setUp() {
+ configureProject("src/etc/testcases/types/selectors.xml");
+ executeTarget("setUp");
+ beddir = new File(super.getProject().getProperty("test.dir"));
+ mirrordir = new File(super.getProject().getProperty("mirror.dir"));
+ basedir = getProjectDir();
+ project = new Project();
+ project.init();
+ project.setBaseDir(basedir);
+ for (int x = 0; x < files.length; x++) {
+ files[x] = new File(beddir,filenames[x]);
+ mirrorfiles[x] = new File(mirrordir,filenames[x]);
+ }
+ }
+
+ /**
+ * Override this in child classes to return a specific Selector
+ */
+ public abstract BaseSelector getInstance();
+
+
+ /**
+ * Return a preconfigured selector (with a set reference to
+ * project instance).
+ * @return the selector
+ */
+ public BaseSelector getSelector() {
+ BaseSelector selector = getInstance();
+ selector.setProject( getProject() );
+ return selector;
+ }
+
+
+ public Project getProject() {
+ return project;
+ }
+
+ /**
+ * This is a test that all Selectors derived from BaseSelector can
+ * use. It calls the setError() method and checks to ensure that a
+ * BuildException is thrown as a result.
+ */
+ public void testRespondsToError() {
+ BaseSelector s = getInstance();
+ if (s == null) {
+ return;
+ }
+ s.setError("test error");
+ try {
+ s.isSelected(beddir,filenames[0],files[0]);
+ fail("Cannot cause BuildException when setError() is called");
+ } catch (BuildException be) {
+ assertEquals("test error",
+ be.getMessage());
+ }
+ }
+
+
+ /**
+ * This is a helper method that takes a selector and calls its
+ * isSelected() method on each file in the testbed. It returns
+ * a string of "T"s amd "F"s
+ */
+ public String selectionString(FileSelector selector) {
+ return selectionString(beddir,files,selector);
+ }
+
+ /**
+ * This is a helper method that takes a selector and calls its
+ * isSelected() method on each file in the mirror testbed. This
+ * variation is used for dependency checks and to get around the
+ * limitations in the touch task when running JDK 1.1. It returns
+ * a string of "T"s amd "F"s.
+ */
+ public String mirrorSelectionString(FileSelector selector) {
+ return selectionString(mirrordir,mirrorfiles,selector);
+ }
+
+ /**
+ * Worker method for the two convenience methods above. Applies a
+ * selector on a set of files passed in and returns a string of
+ * "T"s amd "F"s from applying the selector to each file.
+ */
+ public String selectionString(File basedir, File[] files, FileSelector selector) {
+ StringBuffer buf = new StringBuffer();
+ for (int x = 0; x < files.length; x++) {
+ if (selector.isSelected(basedir,filenames[x],files[x])) {
+ buf.append('T');
+ }
+ else {
+ buf.append('F');
+ }
+ }
+ return buf.toString();
+ }
+
+ /**
+ * Does the selection test for a given selector and prints the
+ * filenames of the differing files (selected but shouldn't,
+ * not selected but should).
+ * @param selector The selector to test
+ * @param expected The expected result
+ */
+ public void performTests(FileSelector selector, String expected) {
+ String result = selectionString(selector);
+ String diff = diff(expected, result);
+ String resolved = resolve(diff);
+ assertEquals("Differing files: " + resolved, result, expected);
+ }
+
+ /**
+ * Checks which files are selected and shouldn't be or which
+ * are not selected but should.
+ * @param expected String containing 'F's and 'T's
+ * @param result String containing 'F's and 'T's
+ * @return Difference as String containing '-' (equal) and
+ * 'X' (difference).
+ */
+ public String diff(String expected, String result) {
+ int length1 = expected.length();
+ int length2 = result.length();
+ int min = (length1 > length2) ? length2 : length1;
+ StringBuffer sb = new StringBuffer();
+ for (int i=0; i<min; i++) {
+ sb.append(
+ (expected.charAt(i) == result.charAt(i))
+ ? "-"
+ : "X"
+ );
+ }
+ return sb.toString();
+ }
+
+
+ /**
+ * Resolves a diff-String (@see diff()) against the (inherited) filenames-
+ * and files arrays.
+ * @param filelist Diff-String
+ * @return String containing the filenames for all differing files,
+ * separated with semicolons ';'
+ */
+ public String resolve(String filelist) {
+ StringBuffer sb = new StringBuffer();
+ int min = (filenames.length > filelist.length())
+ ? filelist.length()
+ : filenames.length;
+ for (int i=0; i<min; i++) {
+ if ('X'==filelist.charAt(i)) {
+ sb.append(filenames[i]);
+ sb.append(";");
+ }
+ }
+ return sb.toString();
+ }
+
+
+ /**
+ * <p>Creates a testbed. We avoid the dreaded "test" word so that we
+ * don't falsely identify this as a test to be run. The actual
+ * setting up of the testbed is done in the
+ * <code>src/etc/testcases/types/selectors.xml</code> build file.</p>
+ *
+ * <p>Note that the right way to call this is within a try block,
+ * with a finally clause that calls cleanupBed(). You place tests of
+ * the isSelected() method within the try block.</p>
+ */
+ protected void makeBed() {
+ tbed = new TaskdefForMakingBed("setupfiles");
+ tbed.setUp();
+ tbed.makeTestbed();
+ }
+
+ /**
+ * Cleans up the testbed by calling a target in the
+ * <code>src/etc/testcases/types/selectors.xml</code> file.
+ */
+ protected void cleanupBed() {
+ if (tbed != null) {
+ tbed.tearDown();
+ tbed = null;
+ }
+ }
+
+
+ /**
+ * <p>Creates a mirror of the testbed for use in dependency checks.</p>
+ *
+ * <p>Note that the right way to call this is within a try block,
+ * with a finally clause that calls cleanupMirror(). You place tests of
+ * the isSelected() method within the try block.</p>
+ */
+ protected void makeMirror() {
+ tbed = new TaskdefForMakingBed("mirrorfiles");
+ tbed.setUp();
+ tbed.makeMirror();
+ }
+
+ /**
+ * Cleans up the mirror testbed by calling a target in the
+ * <code>src/etc/testcases/types/selectors.xml</code> file.
+ */
+ protected void cleanupMirror() {
+ if (tbed != null) {
+ tbed.deleteMirror();
+ tbed = null;
+ }
+ }
+
+ private class TaskdefForMakingBed extends BuildFileTest {
+
+ TaskdefForMakingBed(String name) {
+ super(name);
+ }
+
+ public void setUp() {
+ configureProject("src/etc/testcases/types/selectors.xml");
+ }
+
+ public void tearDown() {
+ try {
+ super.tearDown();
+ } catch (Exception exc) {
+ // ignore
+ }
+ }
+
+ public void makeTestbed() {
+ executeTarget("setupfiles");
+ }
+
+ public void makeMirror() {
+ executeTarget("mirrorfiles");
+ }
+
+ public void deleteMirror() {
+ executeTarget("tearDown");
+ }
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/selectors/ContainsRegexpTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/ContainsRegexpTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/ContainsRegexpTest.java
index 6dc8d72..4928e76 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/ContainsRegexpTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/ContainsRegexpTest.java
@@ -1,56 +1,55 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.tools.ant.types.selectors;
-
-import java.io.File;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-
-public class ContainsRegexpTest {
-
- @Rule
- public BuildFileRule buildRule = new BuildFileRule();
-
- @Before
- public void setUp() {
- buildRule.configureProject("src/etc/testcases/types/selectors.xml");
- }
-
- @Test
- public void testContainsRegexp() {
- buildRule.executeTarget("containsregexp");
- File dir = new File(buildRule.getOutputDir(), "regexpseltestdest");
- File[] files = dir.listFiles();
- int filecount = files.length;
-
- if (filecount != 1) {
- assertEquals("ContainsRegexp test should have copied 1 file",
- 1, files.length);
-
- }
- }
-
-}
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.tools.ant.types.selectors;
+
+import java.io.File;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+
+public class ContainsRegexpTest {
+
+ @Rule
+ public BuildFileRule buildRule = new BuildFileRule();
+
+ @Before
+ public void setUp() {
+ buildRule.configureProject("src/etc/testcases/types/selectors.xml");
+ }
+
+ @Test
+ public void testContainsRegexp() {
+ buildRule.executeTarget("containsregexp");
+ File dir = new File(buildRule.getOutputDir(), "regexpseltestdest");
+ File[] files = dir.listFiles();
+ int filecount = files.length;
+
+ if (filecount != 1) {
+ assertEquals("ContainsRegexp test should have copied 1 file",
+ 1, files.length);
+
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/selectors/ContainsSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/ContainsSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/ContainsSelectorTest.java
index 822bf3e..e964e84 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/ContainsSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/ContainsSelectorTest.java
@@ -1,114 +1,114 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.tools.ant.types.selectors;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.types.Parameter;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-/**
- * Tests Contains Selectors.
- *
- */
-public class ContainsSelectorTest {
-
- @Rule
- public final BaseSelectorRule selectorRule = new BaseSelectorRule();
-
-
- /**
- * Test the code that validates the selector.
- */
- @Test
- public void testValidate() {
- ContainsSelector s = new ContainsSelector();
- try {
- s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
- fail("ContainsSelector did not check for required field 'text'");
- } catch (BuildException be1) {
- assertEquals("The text attribute is required", be1.getMessage());
- }
-
- s = new ContainsSelector();
- Parameter param = new Parameter();
- param.setName("garbage in");
- param.setValue("garbage out");
- Parameter[] params = {param};
- s.setParameters(params);
- try {
- s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
- fail("ContainsSelector did not check for valid parameter element");
- } catch (BuildException be2) {
- assertEquals("Invalid parameter garbage in", be2.getMessage());
- }
-
- }
-
- /**
- * Tests to make sure that the selector is selecting files correctly.
- */
- @Test
- public void testSelectionBehaviour() {
- ContainsSelector s;
- String results;
-
-
- s = new ContainsSelector();
- s.setText("no such string in test files");
- results = selectorRule.selectionString(s);
- assertEquals("TFFFFFFFFFFT", results);
-
- s = new ContainsSelector();
- s.setText("Apache Ant");
- results = selectorRule.selectionString(s);
- assertEquals("TFFFTFFFFFFT", results);
-
- s = new ContainsSelector();
- s.setText("apache ant");
- s.setCasesensitive(true);
- results = selectorRule.selectionString(s);
- assertEquals("TFFFFFFFFFFT", results);
-
- s = new ContainsSelector();
- s.setText("apache ant");
- s.setCasesensitive(false);
- results = selectorRule.selectionString(s);
- assertEquals("TFFFTFFFFFFT", results);
-
- s = new ContainsSelector();
- s.setText("ApacheAnt");
- s.setIgnorewhitespace(true);
- results = selectorRule.selectionString(s);
- assertEquals("TFFFTFFFFFFT", results);
-
- s = new ContainsSelector();
- s.setText("A p a c h e A n t");
- s.setIgnorewhitespace(true);
- results = selectorRule.selectionString(s);
- assertEquals("TFFFTFFFFFFT", results);
-
-
-
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.tools.ant.types.selectors;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.Parameter;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Tests Contains Selectors.
+ *
+ */
+public class ContainsSelectorTest {
+
+ @Rule
+ public final BaseSelectorRule selectorRule = new BaseSelectorRule();
+
+
+ /**
+ * Test the code that validates the selector.
+ */
+ @Test
+ public void testValidate() {
+ ContainsSelector s = new ContainsSelector();
+ try {
+ s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+ fail("ContainsSelector did not check for required field 'text'");
+ } catch (BuildException be1) {
+ assertEquals("The text attribute is required", be1.getMessage());
+ }
+
+ s = new ContainsSelector();
+ Parameter param = new Parameter();
+ param.setName("garbage in");
+ param.setValue("garbage out");
+ Parameter[] params = {param};
+ s.setParameters(params);
+ try {
+ s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+ fail("ContainsSelector did not check for valid parameter element");
+ } catch (BuildException be2) {
+ assertEquals("Invalid parameter garbage in", be2.getMessage());
+ }
+
+ }
+
+ /**
+ * Tests to make sure that the selector is selecting files correctly.
+ */
+ @Test
+ public void testSelectionBehaviour() {
+ ContainsSelector s;
+ String results;
+
+
+ s = new ContainsSelector();
+ s.setText("no such string in test files");
+ results = selectorRule.selectionString(s);
+ assertEquals("TFFFFFFFFFFT", results);
+
+ s = new ContainsSelector();
+ s.setText("Apache Ant");
+ results = selectorRule.selectionString(s);
+ assertEquals("TFFFTFFFFFFT", results);
+
+ s = new ContainsSelector();
+ s.setText("apache ant");
+ s.setCasesensitive(true);
+ results = selectorRule.selectionString(s);
+ assertEquals("TFFFFFFFFFFT", results);
+
+ s = new ContainsSelector();
+ s.setText("apache ant");
+ s.setCasesensitive(false);
+ results = selectorRule.selectionString(s);
+ assertEquals("TFFFTFFFFFFT", results);
+
+ s = new ContainsSelector();
+ s.setText("ApacheAnt");
+ s.setIgnorewhitespace(true);
+ results = selectorRule.selectionString(s);
+ assertEquals("TFFFTFFFFFFT", results);
+
+ s = new ContainsSelector();
+ s.setText("A p a c h e A n t");
+ s.setIgnorewhitespace(true);
+ results = selectorRule.selectionString(s);
+ assertEquals("TFFFTFFFFFFT", results);
+
+
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/selectors/DependSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/DependSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/DependSelectorTest.java
index 078052f..ec95878 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/DependSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/DependSelectorTest.java
@@ -1,185 +1,185 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.tools.ant.types.selectors;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.types.Mapper;
-import org.junit.Rule;
-import org.junit.Test;
-
-import java.io.File;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-
-/**
- * Tests Depend Selectors
- *
- */
-public class DependSelectorTest {
-
- @Rule
- public final BaseSelectorRule selectorRule = new BaseSelectorRule();
-
- @Test
- public void testValidateSingleMapper() {
- try {
- DependSelector s = new DependSelector();
- s.createMapper();
- s.createMapper();
- fail("DependSelector allowed more than one nested mapper.");
- } catch (BuildException be1) {
- assertEquals("Cannot define more than one mapper",
- be1.getMessage());
- }
- }
-
-
- @Test
- public void testValidateRequiredFields() {
- try {
- DependSelector s = new DependSelector();
- s.isSelected(selectorRule.getProject().getBaseDir(), selectorRule.getFilenames()[0], selectorRule.getFiles()[0]);
- fail("DependSelector did not check for required fields");
- } catch (BuildException be2) {
- assertEquals("The targetdir attribute is required.",
- be2.getMessage());
- }
-
- }
-
- @Test
- public void testNoMapper() {
- DependSelector s = new DependSelector();
- s.setTargetdir(selectorRule.getBeddir());
-
- String results = selectorRule.selectionString(s);
- assertEquals("FFFFFFFFFFFF", results);
- }
-
- @Test
- public void testIdentityMapper() {
- DependSelector s = new DependSelector();
- s.setTargetdir(selectorRule.getBeddir());
-
- Mapper.MapperType identity = new Mapper.MapperType();
- identity.setValue("identity");
-
- Mapper m = s.createMapper();
- m.setType(identity);
-
- String results = selectorRule.selectionString(s);
- assertEquals("FFFFFFFFFFFF", results);
- }
-
- @Test
- public void testMergeMapper() {
- DependSelector s = new DependSelector();
- s.setTargetdir(selectorRule.getBeddir());
-
- Mapper.MapperType merge = new Mapper.MapperType();
- merge.setValue("merge");
-
- Mapper m = s.createMapper();
- m.setType(merge);
- m.setTo("asf-logo.gif.gz");
-
- String results = selectorRule.selectionString(s);
- assertEquals("TFFFFTTTFFF", results.substring(0,11));
- }
-
- @Test
- public void testMergeMapper2() {
- DependSelector s = new DependSelector();
- s.setTargetdir(selectorRule.getBeddir());
-
- Mapper.MapperType merge = new Mapper.MapperType();
- merge.setValue("merge");
-
- Mapper m = s.createMapper();
- m.setType(merge);
- m.setTo("asf-logo.gif.bz2");
- String results = selectorRule.selectionString(s);
- assertEquals("TTFTTTTTTTTT", results);
- }
-
- @Test
- public void testGlobMapperRelativePath() {
- DependSelector s = new DependSelector();
- File subdir = new File("selectortest/tar/bz2");
- s.setTargetdir(subdir);
-
- Mapper.MapperType glob = new Mapper.MapperType();
- glob.setValue("glob");
-
- Mapper m = s.createMapper();
- m.setType(glob);
- m.setFrom("*.bz2");
- m.setTo("*.tar.bz2");
-
- String results = selectorRule.selectionString(s);
- assertEquals("FFTFFFFFFTTF", results);
- }
-
- @Test
- public void testRestrictedGlobMapper() {
- DependSelector s = new DependSelector();
- File subdir = new File(selectorRule.getBeddir(), "tar/bz2");
- s.setTargetdir(subdir);
-
- Mapper.MapperType glob = new Mapper.MapperType();
- glob.setValue("glob");
-
- Mapper m = s.createMapper();
- m.setType(glob);
- m.setFrom("*.bz2");
- m.setTo("*.tar.bz2");
- String results = selectorRule.selectionString(s);
- assertEquals("FFFFFFFFFTTF", results);
- }
-
- @Test
- public void testSelectionNoMapper() {
- DependSelector s = new DependSelector();
- s.setTargetdir(new File(selectorRule.getOutputDir(), "selectortest2"));
- String results = selectorRule.selectionString(s);
- assertEquals("FFFTTFFFFFFF", results);
- }
-
-
- @Test
- public void testMirroredSelection() {
- DependSelector s = new DependSelector();
- s.setTargetdir(new File(selectorRule.getOutputDir(), "selectortest2/tar/bz2"));
-
- Mapper.MapperType glob = new Mapper.MapperType();
- glob.setValue("glob");
-
- Mapper m = s.createMapper();
- m.setType(glob);
- m.setFrom("*.bz2");
- m.setTo("*.tar.bz2");
- String results = selectorRule.mirrorSelectionString(s);
- assertEquals("FFFFFFFFFTTF", results);
- results = selectorRule.selectionString(s);
- assertEquals("FFFFFFFFFTTF", results);
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.tools.ant.types.selectors;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.Mapper;
+import org.junit.Rule;
+import org.junit.Test;
+
+import java.io.File;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+
+/**
+ * Tests Depend Selectors
+ *
+ */
+public class DependSelectorTest {
+
+ @Rule
+ public final BaseSelectorRule selectorRule = new BaseSelectorRule();
+
+ @Test
+ public void testValidateSingleMapper() {
+ try {
+ DependSelector s = new DependSelector();
+ s.createMapper();
+ s.createMapper();
+ fail("DependSelector allowed more than one nested mapper.");
+ } catch (BuildException be1) {
+ assertEquals("Cannot define more than one mapper",
+ be1.getMessage());
+ }
+ }
+
+
+ @Test
+ public void testValidateRequiredFields() {
+ try {
+ DependSelector s = new DependSelector();
+ s.isSelected(selectorRule.getProject().getBaseDir(), selectorRule.getFilenames()[0], selectorRule.getFiles()[0]);
+ fail("DependSelector did not check for required fields");
+ } catch (BuildException be2) {
+ assertEquals("The targetdir attribute is required.",
+ be2.getMessage());
+ }
+
+ }
+
+ @Test
+ public void testNoMapper() {
+ DependSelector s = new DependSelector();
+ s.setTargetdir(selectorRule.getBeddir());
+
+ String results = selectorRule.selectionString(s);
+ assertEquals("FFFFFFFFFFFF", results);
+ }
+
+ @Test
+ public void testIdentityMapper() {
+ DependSelector s = new DependSelector();
+ s.setTargetdir(selectorRule.getBeddir());
+
+ Mapper.MapperType identity = new Mapper.MapperType();
+ identity.setValue("identity");
+
+ Mapper m = s.createMapper();
+ m.setType(identity);
+
+ String results = selectorRule.selectionString(s);
+ assertEquals("FFFFFFFFFFFF", results);
+ }
+
+ @Test
+ public void testMergeMapper() {
+ DependSelector s = new DependSelector();
+ s.setTargetdir(selectorRule.getBeddir());
+
+ Mapper.MapperType merge = new Mapper.MapperType();
+ merge.setValue("merge");
+
+ Mapper m = s.createMapper();
+ m.setType(merge);
+ m.setTo("asf-logo.gif.gz");
+
+ String results = selectorRule.selectionString(s);
+ assertEquals("TFFFFTTTFFF", results.substring(0,11));
+ }
+
+ @Test
+ public void testMergeMapper2() {
+ DependSelector s = new DependSelector();
+ s.setTargetdir(selectorRule.getBeddir());
+
+ Mapper.MapperType merge = new Mapper.MapperType();
+ merge.setValue("merge");
+
+ Mapper m = s.createMapper();
+ m.setType(merge);
+ m.setTo("asf-logo.gif.bz2");
+ String results = selectorRule.selectionString(s);
+ assertEquals("TTFTTTTTTTTT", results);
+ }
+
+ @Test
+ public void testGlobMapperRelativePath() {
+ DependSelector s = new DependSelector();
+ File subdir = new File("selectortest/tar/bz2");
+ s.setTargetdir(subdir);
+
+ Mapper.MapperType glob = new Mapper.MapperType();
+ glob.setValue("glob");
+
+ Mapper m = s.createMapper();
+ m.setType(glob);
+ m.setFrom("*.bz2");
+ m.setTo("*.tar.bz2");
+
+ String results = selectorRule.selectionString(s);
+ assertEquals("FFTFFFFFFTTF", results);
+ }
+
+ @Test
+ public void testRestrictedGlobMapper() {
+ DependSelector s = new DependSelector();
+ File subdir = new File(selectorRule.getBeddir(), "tar/bz2");
+ s.setTargetdir(subdir);
+
+ Mapper.MapperType glob = new Mapper.MapperType();
+ glob.setValue("glob");
+
+ Mapper m = s.createMapper();
+ m.setType(glob);
+ m.setFrom("*.bz2");
+ m.setTo("*.tar.bz2");
+ String results = selectorRule.selectionString(s);
+ assertEquals("FFFFFFFFFTTF", results);
+ }
+
+ @Test
+ public void testSelectionNoMapper() {
+ DependSelector s = new DependSelector();
+ s.setTargetdir(new File(selectorRule.getOutputDir(), "selectortest2"));
+ String results = selectorRule.selectionString(s);
+ assertEquals("FFFTTFFFFFFF", results);
+ }
+
+
+ @Test
+ public void testMirroredSelection() {
+ DependSelector s = new DependSelector();
+ s.setTargetdir(new File(selectorRule.getOutputDir(), "selectortest2/tar/bz2"));
+
+ Mapper.MapperType glob = new Mapper.MapperType();
+ glob.setValue("glob");
+
+ Mapper m = s.createMapper();
+ m.setType(glob);
+ m.setFrom("*.bz2");
+ m.setTo("*.tar.bz2");
+ String results = selectorRule.mirrorSelectionString(s);
+ assertEquals("FFFFFFFFFTTF", results);
+ results = selectorRule.selectionString(s);
+ assertEquals("FFFFFFFFFTTF", results);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/selectors/DepthSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/DepthSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/DepthSelectorTest.java
index 924995c..526a5bf 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/DepthSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/DepthSelectorTest.java
@@ -1,147 +1,147 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.tools.ant.types.selectors;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.types.Parameter;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-/**
- * Tests Depth Selectors
- *
- */
-public class DepthSelectorTest {
-
- @Rule
- public final BaseSelectorRule selectorRule = new BaseSelectorRule();
-
-
- /**
- * Test the code that validates the selector.
- */
- @Test
- public void testValidate() {
- DepthSelector s = new DepthSelector();
- try {
- s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
- fail("DepthSelector did not check for required fields");
- } catch (BuildException be1) {
- assertEquals("You must set at least one of the min or the " +
- "max levels.", be1.getMessage());
- }
-
- s = new DepthSelector();
- s.setMin(5);
- s.setMax(2);
- try {
- s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
- fail("DepthSelector did not check for maximum being higher "
- + "than minimum");
- } catch (BuildException be2) {
- assertEquals("The maximum depth is lower than the minimum.",
- be2.getMessage());
- }
-
- s = new DepthSelector();
- Parameter param = new Parameter();
- param.setName("garbage in");
- param.setValue("garbage out");
- Parameter[] params = new Parameter[1];
- params[0] = param;
- s.setParameters(params);
- try {
- s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
- fail("DepthSelector did not check for valid parameter element");
- } catch (BuildException be3) {
- assertEquals("Invalid parameter garbage in", be3.getMessage());
- }
-
- s = new DepthSelector();
- param = new Parameter();
- param.setName("min");
- param.setValue("garbage out");
- params[0] = param;
- s.setParameters(params);
- try {
- s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
- fail("DepthSelector accepted bad minimum as parameter");
- } catch (BuildException be4) {
- assertEquals("Invalid minimum value garbage out",
- be4.getMessage());
- }
-
- s = new DepthSelector();
- param = new Parameter();
- param.setName("max");
- param.setValue("garbage out");
- params[0] = param;
- s.setParameters(params);
- try {
- s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
- fail("DepthSelector accepted bad maximum as parameter");
- } catch (BuildException be5) {
- assertEquals("Invalid maximum value garbage out",
- be5.getMessage());
- }
-
- }
-
- /**
- * Tests to make sure that the selector is selecting files correctly.
- */
- @Test
- public void testSelectionBehaviour() {
- DepthSelector s;
- String results;
-
- s = new DepthSelector();
- s.setMin(20);
- s.setMax(25);
- results = selectorRule.selectionString(s);
- assertEquals("FFFFFFFFFFFF", results);
-
- s = new DepthSelector();
- s.setMin(0);
- results = selectorRule.selectionString(s);
- assertEquals("TTTTTTTTTTTT", results);
-
- s = new DepthSelector();
- s.setMin(1);
- results = selectorRule.selectionString(s);
- assertEquals("FFFFFTTTTTTT", results);
-
- s = new DepthSelector();
- s.setMax(0);
- results = selectorRule.selectionString(s);
- assertEquals("TTTTTFFFFFFF", results);
-
- s = new DepthSelector();
- s.setMin(1);
- s.setMax(1);
- results = selectorRule.selectionString(s);
- assertEquals("FFFFFTTTFFFT", results);
-
-
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.tools.ant.types.selectors;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.Parameter;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Tests Depth Selectors
+ *
+ */
+public class DepthSelectorTest {
+
+ @Rule
+ public final BaseSelectorRule selectorRule = new BaseSelectorRule();
+
+
+ /**
+ * Test the code that validates the selector.
+ */
+ @Test
+ public void testValidate() {
+ DepthSelector s = new DepthSelector();
+ try {
+ s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+ fail("DepthSelector did not check for required fields");
+ } catch (BuildException be1) {
+ assertEquals("You must set at least one of the min or the " +
+ "max levels.", be1.getMessage());
+ }
+
+ s = new DepthSelector();
+ s.setMin(5);
+ s.setMax(2);
+ try {
+ s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+ fail("DepthSelector did not check for maximum being higher "
+ + "than minimum");
+ } catch (BuildException be2) {
+ assertEquals("The maximum depth is lower than the minimum.",
+ be2.getMessage());
+ }
+
+ s = new DepthSelector();
+ Parameter param = new Parameter();
+ param.setName("garbage in");
+ param.setValue("garbage out");
+ Parameter[] params = new Parameter[1];
+ params[0] = param;
+ s.setParameters(params);
+ try {
+ s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+ fail("DepthSelector did not check for valid parameter element");
+ } catch (BuildException be3) {
+ assertEquals("Invalid parameter garbage in", be3.getMessage());
+ }
+
+ s = new DepthSelector();
+ param = new Parameter();
+ param.setName("min");
+ param.setValue("garbage out");
+ params[0] = param;
+ s.setParameters(params);
+ try {
+ s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+ fail("DepthSelector accepted bad minimum as parameter");
+ } catch (BuildException be4) {
+ assertEquals("Invalid minimum value garbage out",
+ be4.getMessage());
+ }
+
+ s = new DepthSelector();
+ param = new Parameter();
+ param.setName("max");
+ param.setValue("garbage out");
+ params[0] = param;
+ s.setParameters(params);
+ try {
+ s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+ fail("DepthSelector accepted bad maximum as parameter");
+ } catch (BuildException be5) {
+ assertEquals("Invalid maximum value garbage out",
+ be5.getMessage());
+ }
+
+ }
+
+ /**
+ * Tests to make sure that the selector is selecting files correctly.
+ */
+ @Test
+ public void testSelectionBehaviour() {
+ DepthSelector s;
+ String results;
+
+ s = new DepthSelector();
+ s.setMin(20);
+ s.setMax(25);
+ results = selectorRule.selectionString(s);
+ assertEquals("FFFFFFFFFFFF", results);
+
+ s = new DepthSelector();
+ s.setMin(0);
+ results = selectorRule.selectionString(s);
+ assertEquals("TTTTTTTTTTTT", results);
+
+ s = new DepthSelector();
+ s.setMin(1);
+ results = selectorRule.selectionString(s);
+ assertEquals("FFFFFTTTTTTT", results);
+
+ s = new DepthSelector();
+ s.setMax(0);
+ results = selectorRule.selectionString(s);
+ assertEquals("TTTTTFFFFFFF", results);
+
+ s = new DepthSelector();
+ s.setMin(1);
+ s.setMax(1);
+ results = selectorRule.selectionString(s);
+ assertEquals("FFFFFTTTFFFT", results);
+
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/selectors/FilenameSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/FilenameSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/FilenameSelectorTest.java
index 121f433..357fe49 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/FilenameSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/FilenameSelectorTest.java
@@ -1,115 +1,115 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.tools.ant.types.selectors;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.types.Parameter;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-/**
- * Tests Filename Selectors
- *
- */
-public class FilenameSelectorTest {
-
- @Rule
- public final BaseSelectorRule selectorRule = new BaseSelectorRule();
-
- /**
- * Test the code that validates the selector.
- */
- @Test
- public void testValidate() {
- FilenameSelector s = new FilenameSelector();
- try {
- s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
- fail("FilenameSelector did not check for required fields");
- } catch (BuildException be1) {
- assertEquals("The name or regex attribute is required", be1.getMessage());
- }
-
- s = new FilenameSelector();
- Parameter param = new Parameter();
- param.setName("garbage in");
- param.setValue("garbage out");
- Parameter[] params = {param};
- s.setParameters(params);
- try {
- s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
- fail("FilenameSelector did not check for valid parameter element");
- } catch (BuildException be2) {
- assertEquals("Invalid parameter garbage in", be2.getMessage());
- }
-
- }
-
- /**
- * Tests to make sure that the selector is selecting files correctly.
- */
- @Test
- public void testSelectionBehaviour() {
- FilenameSelector s;
- String results;
-
-
- s = new FilenameSelector();
- s.setName("no match possible");
- results = selectorRule.selectionString(s);
- assertEquals("FFFFFFFFFFFF", results);
-
- s = new FilenameSelector();
- s.setName("*.gz");
- results = selectorRule.selectionString(s);
- // This is turned off temporarily. There appears to be a bug
- // in SelectorUtils.matchPattern() where it is recursive on
- // Windows even if no ** is in pattern.
- //assertEquals("FFFTFFFFFFFF", results); // Unix
- // vs
- //assertEquals("FFFTFFFFTFFF", results); // Windows
-
- s = new FilenameSelector();
- s.setName("**/*.gz");
- s.setNegate(true);
- results = selectorRule.selectionString(s);
- assertEquals("TTTFTTTFFTTT", results);
-
- s = new FilenameSelector();
- s.setName("**/*.GZ");
- s.setCasesensitive(false);
- results = selectorRule.selectionString(s);
- assertEquals("FFFTFFFTTFFF", results);
-
- s = new FilenameSelector();
- Parameter param1 = new Parameter();
- param1.setName("name");
- param1.setValue("**/*.bz2");
- Parameter[] params = {param1};
- s.setParameters(params);
- results = selectorRule.selectionString(s);
- assertEquals("FFTFFFFFFTTF", results);
-
-
-
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.tools.ant.types.selectors;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.Parameter;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Tests Filename Selectors
+ *
+ */
+public class FilenameSelectorTest {
+
+ @Rule
+ public final BaseSelectorRule selectorRule = new BaseSelectorRule();
+
+ /**
+ * Test the code that validates the selector.
+ */
+ @Test
+ public void testValidate() {
+ FilenameSelector s = new FilenameSelector();
+ try {
+ s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+ fail("FilenameSelector did not check for required fields");
+ } catch (BuildException be1) {
+ assertEquals("The name or regex attribute is required", be1.getMessage());
+ }
+
+ s = new FilenameSelector();
+ Parameter param = new Parameter();
+ param.setName("garbage in");
+ param.setValue("garbage out");
+ Parameter[] params = {param};
+ s.setParameters(params);
+ try {
+ s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+ fail("FilenameSelector did not check for valid parameter element");
+ } catch (BuildException be2) {
+ assertEquals("Invalid parameter garbage in", be2.getMessage());
+ }
+
+ }
+
+ /**
+ * Tests to make sure that the selector is selecting files correctly.
+ */
+ @Test
+ public void testSelectionBehaviour() {
+ FilenameSelector s;
+ String results;
+
+
+ s = new FilenameSelector();
+ s.setName("no match possible");
+ results = selectorRule.selectionString(s);
+ assertEquals("FFFFFFFFFFFF", results);
+
+ s = new FilenameSelector();
+ s.setName("*.gz");
+ results = selectorRule.selectionString(s);
+ // This is turned off temporarily. There appears to be a bug
+ // in SelectorUtils.matchPattern() where it is recursive on
+ // Windows even if no ** is in pattern.
+ //assertEquals("FFFTFFFFFFFF", results); // Unix
+ // vs
+ //assertEquals("FFFTFFFFTFFF", results); // Windows
+
+ s = new FilenameSelector();
+ s.setName("**/*.gz");
+ s.setNegate(true);
+ results = selectorRule.selectionString(s);
+ assertEquals("TTTFTTTFFTTT", results);
+
+ s = new FilenameSelector();
+ s.setName("**/*.GZ");
+ s.setCasesensitive(false);
+ results = selectorRule.selectionString(s);
+ assertEquals("FFFTFFFTTFFF", results);
+
+ s = new FilenameSelector();
+ Parameter param1 = new Parameter();
+ param1.setName("name");
+ param1.setValue("**/*.bz2");
+ Parameter[] params = {param1};
+ s.setParameters(params);
+ results = selectorRule.selectionString(s);
+ assertEquals("FFTFFFFFFTTF", results);
+
+
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/selectors/MockAlgorithm.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/MockAlgorithm.java b/src/tests/junit/org/apache/tools/ant/types/selectors/MockAlgorithm.java
index c741952..458c83f 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/MockAlgorithm.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/MockAlgorithm.java
@@ -1,37 +1,37 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.tools.ant.types.selectors;
-
-
-import java.io.File;
-import org.apache.tools.ant.types.selectors.modifiedselector.Algorithm;
-
-public class MockAlgorithm implements Algorithm {
- public boolean isValid() {
- return true;
- }
-
- public String getValue(File file) {
- return "TEST";
- }
-
- public String toString() {
- return "MockAlgorithm@" + hashCode();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.tools.ant.types.selectors;
+
+
+import java.io.File;
+import org.apache.tools.ant.types.selectors.modifiedselector.Algorithm;
+
+public class MockAlgorithm implements Algorithm {
+ public boolean isValid() {
+ return true;
+ }
+
+ public String getValue(File file) {
+ return "TEST";
+ }
+
+ public String toString() {
+ return "MockAlgorithm@" + hashCode();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/selectors/MockCache.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/MockCache.java b/src/tests/junit/org/apache/tools/ant/types/selectors/MockCache.java
index 6fc87f3..359a179 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/MockCache.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/MockCache.java
@@ -1,68 +1,68 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.tools.ant.types.selectors;
-
-
-import java.util.Iterator;
-import org.apache.tools.ant.types.selectors.modifiedselector.Cache;
-
-public class MockCache implements Cache {
-
- public boolean debug = false;
- public boolean saved = false;
-
-
- public MockCache() {
- log("()");
- }
-
- public boolean isValid() {
- log(".isValid()");
- return true;
- }
- public void delete() {
- log(".delete()");
- }
- public void load() {
- log(".load()");
- }
- public void save() {
- log(".save()");
- saved = true;
- }
- public Object get(Object key) {
- log(".get("+key+")");
- return key;
- }
- public void put(Object key, Object value) {
- log(".put("+key+", "+value+")");
- saved = false;
- }
- public Iterator<String> iterator() {
- log("iterator()");
- return null;
- }
- public String toString() {
- return "MockCache@" + hashCode();
- }
-
- private void log(String msg) {
- if (debug) System.out.println(this+msg);
- }
-}//class-MockCache
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.tools.ant.types.selectors;
+
+
+import java.util.Iterator;
+import org.apache.tools.ant.types.selectors.modifiedselector.Cache;
+
+public class MockCache implements Cache {
+
+ public boolean debug = false;
+ public boolean saved = false;
+
+
+ public MockCache() {
+ log("()");
+ }
+
+ public boolean isValid() {
+ log(".isValid()");
+ return true;
+ }
+ public void delete() {
+ log(".delete()");
+ }
+ public void load() {
+ log(".load()");
+ }
+ public void save() {
+ log(".save()");
+ saved = true;
+ }
+ public Object get(Object key) {
+ log(".get("+key+")");
+ return key;
+ }
+ public void put(Object key, Object value) {
+ log(".put("+key+", "+value+")");
+ saved = false;
+ }
+ public Iterator<String> iterator() {
+ log("iterator()");
+ return null;
+ }
+ public String toString() {
+ return "MockCache@" + hashCode();
+ }
+
+ private void log(String msg) {
+ if (debug) System.out.println(this+msg);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ant/blob/4422804d/src/tests/junit/org/apache/tools/ant/types/selectors/MockComparator.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/MockComparator.java b/src/tests/junit/org/apache/tools/ant/types/selectors/MockComparator.java
index fdbb75d..180aa46 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/MockComparator.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/MockComparator.java
@@ -1,32 +1,32 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.tools.ant.types.selectors;
-
-import java.util.Comparator;
-
-public class MockComparator implements Comparator {
-
- public int compare(Object o1, Object o2) {
- return 0;
- }
-
- public String toString() {
- return "MockComparator";
- }
-}//class-MockCache
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.tools.ant.types.selectors;
+
+import java.util.Comparator;
+
+public class MockComparator implements Comparator {
+
+ public int compare(Object o1, Object o2) {
+ return 0;
+ }
+
+ public String toString() {
+ return "MockComparator";
+ }
+}