Browse Source

Inline buildfile names, make search easier

master
Gintas Grigelionis 7 years ago
parent
commit
f3dfb7779a
20 changed files with 25 additions and 81 deletions
  1. +1
    -3
      src/tests/junit/org/apache/tools/ant/taskdefs/ExecTaskTest.java
  2. +1
    -5
      src/tests/junit/org/apache/tools/ant/taskdefs/JavadocTest.java
  3. +1
    -4
      src/tests/junit/org/apache/tools/ant/taskdefs/ParallelTest.java
  4. +1
    -3
      src/tests/junit/org/apache/tools/ant/taskdefs/PathConvertTest.java
  5. +1
    -3
      src/tests/junit/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java
  6. +1
    -2
      src/tests/junit/org/apache/tools/ant/taskdefs/SleepTest.java
  7. +1
    -3
      src/tests/junit/org/apache/tools/ant/taskdefs/WarTest.java
  8. +1
    -3
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/ANTLRTest.java
  9. +6
    -15
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java
  10. +1
    -3
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/JavahTest.java
  11. +1
    -3
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/JspcTest.java
  12. +1
    -4
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/Native2AsciiTest.java
  13. +1
    -2
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/ReplaceRegExpTest.java
  14. +1
    -2
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/RhinoReferenceTest.java
  15. +1
    -6
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/SchemaValidateTest.java
  16. +1
    -6
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/XmlValidateCatalogTest.java
  17. +1
    -6
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/XmlValidateTest.java
  18. +1
    -4
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/depend/DependTest.java
  19. +1
    -2
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageTest.java
  20. +1
    -2
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLFormatterWithCDATAOnSystemOut.java

+ 1
- 3
src/tests/junit/org/apache/tools/ant/taskdefs/ExecTaskTest.java View File

@@ -44,8 +44,6 @@ public class ExecTaskTest {
@Rule @Rule
public BuildFileRule buildRule = new BuildFileRule(); public BuildFileRule buildRule = new BuildFileRule();


private static final String BUILD_PATH = "src/etc/testcases/taskdefs/exec/";
private static final String BUILD_FILE = BUILD_PATH + "exec.xml";
private static final int TIME_TO_WAIT = 1; private static final int TIME_TO_WAIT = 1;
/** maximum time allowed for the build in milliseconds */ /** maximum time allowed for the build in milliseconds */
private static final int MAX_BUILD_TIME = 6000; private static final int MAX_BUILD_TIME = 6000;
@@ -60,7 +58,7 @@ public class ExecTaskTest {


@Before @Before
public void setUp() { public void setUp() {
buildRule.configureProject(BUILD_FILE);
buildRule.configureProject("src/etc/testcases/taskdefs/exec/exec.xml");
} }


@Test @Test


+ 1
- 5
src/tests/junit/org/apache/tools/ant/taskdefs/JavadocTest.java View File

@@ -28,13 +28,9 @@ public class JavadocTest {
@Rule @Rule
public final BuildFileRule buildRule = new BuildFileRule(); public final BuildFileRule buildRule = new BuildFileRule();


private static final String BUILD_PATH = "src/etc/testcases/taskdefs/javadoc/";
private static final String BUILD_FILENAME = "javadoc.xml";
private static final String BUILD_FILE = BUILD_PATH + BUILD_FILENAME;

@Before @Before
public void setUp() { public void setUp() {
buildRule.configureProject(BUILD_FILE);
buildRule.configureProject("src/etc/testcases/taskdefs/javadoc/javadoc.xml");
} }


// PR 38370 // PR 38370


+ 1
- 4
src/tests/junit/org/apache/tools/ant/taskdefs/ParallelTest.java View File

@@ -52,14 +52,11 @@ public class ParallelTest {
/** Standard property value for the fail test */ /** Standard property value for the fail test */
public static final String FAILURE_MESSAGE = "failure"; public static final String FAILURE_MESSAGE = "failure";


/** the build file associated with this test */
public static final String TEST_BUILD_FILE = "src/etc/testcases/taskdefs/parallel.xml";

private Project p; private Project p;
/** The JUnit setup method */ /** The JUnit setup method */
@Before @Before
public void setUp() { public void setUp() {
buildRule.configureProject(TEST_BUILD_FILE);
buildRule.configureProject("src/etc/testcases/taskdefs/parallel.xml");
p = buildRule.getProject(); p = buildRule.getProject();
} }




+ 1
- 3
src/tests/junit/org/apache/tools/ant/taskdefs/PathConvertTest.java View File

@@ -33,13 +33,11 @@ public class PathConvertTest {
@Rule @Rule
public final BuildFileRule buildRule = new BuildFileRule(); public final BuildFileRule buildRule = new BuildFileRule();


private static final String BUILD_PATH = "src/etc/testcases/taskdefs/";
private static final String BUILD_FILENAME = "pathconvert.xml"; private static final String BUILD_FILENAME = "pathconvert.xml";
private static final String BUILD_FILE = BUILD_PATH + BUILD_FILENAME;


@Before @Before
public void setUp() { public void setUp() {
buildRule.configureProject(BUILD_FILE);
buildRule.configureProject("src/etc/testcases/taskdefs/" + BUILD_FILENAME);
} }


@Test @Test


+ 1
- 3
src/tests/junit/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java View File

@@ -41,8 +41,6 @@ import static org.junit.Assume.assumeTrue;
*/ */
public class RmicAdvancedTest { public class RmicAdvancedTest {


private static final String TASKDEFS_DIR = "src/etc/testcases/taskdefs/rmic/";

@Rule @Rule
public BuildFileRule buildRule = new BuildFileRule(); public BuildFileRule buildRule = new BuildFileRule();


@@ -54,7 +52,7 @@ public class RmicAdvancedTest {
*/ */
@Before @Before
public void setUp() { public void setUp() {
buildRule.configureProject(TASKDEFS_DIR + "rmic.xml");
buildRule.configureProject("src/etc/testcases/taskdefs/rmic/rmic.xml");
} }


/** /**


+ 1
- 2
src/tests/junit/org/apache/tools/ant/taskdefs/SleepTest.java View File

@@ -31,12 +31,11 @@ public class SleepTest {
@Rule @Rule
public final BuildFileRule buildRule = new BuildFileRule(); public final BuildFileRule buildRule = new BuildFileRule();


private static final String TASKDEFS_DIR = "src/etc/testcases/taskdefs/";
private static final int ERROR_RANGE = 1000; private static final int ERROR_RANGE = 1000;


@Before @Before
public void setUp() { public void setUp() {
buildRule.configureProject(TASKDEFS_DIR + "sleep.xml");
buildRule.configureProject("src/etc/testcases/taskdefs/sleep.xml");
} }


@Test @Test


+ 1
- 3
src/tests/junit/org/apache/tools/ant/taskdefs/WarTest.java View File

@@ -32,15 +32,13 @@ import static org.junit.Assert.assertTrue;
* *
*/ */
public class WarTest { public class WarTest {
public static final String TEST_BUILD_FILE
= "src/etc/testcases/taskdefs/war.xml";


@Rule @Rule
public BuildFileRule buildRule = new BuildFileRule(); public BuildFileRule buildRule = new BuildFileRule();


@Before @Before
public void setUp() { public void setUp() {
buildRule.configureProject(TEST_BUILD_FILE);
buildRule.configureProject("src/etc/testcases/taskdefs/war.xml");
} }


/** /**


+ 1
- 3
src/tests/junit/org/apache/tools/ant/taskdefs/optional/ANTLRTest.java View File

@@ -46,14 +46,12 @@ import static org.junit.Assert.assertThat;
*/ */
public class ANTLRTest { public class ANTLRTest {


private static final String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/antlr/";

@Rule @Rule
public BuildFileRule buildRule = new BuildFileRule(); public BuildFileRule buildRule = new BuildFileRule();


@Before @Before
public void setUp() { public void setUp() {
buildRule.configureProject(TASKDEFS_DIR + "antlr.xml");
buildRule.configureProject("src/etc/testcases/taskdefs/optional/antlr/antlr.xml");
} }


/** /**


+ 6
- 15
src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java View File

@@ -20,6 +20,7 @@ package org.apache.tools.ant.taskdefs.optional;


import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
@@ -51,7 +52,6 @@ import org.junit.rules.ExpectedException;
*/ */
public class EchoPropertiesTest { public class EchoPropertiesTest {


private static final String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/";
private static final String GOOD_OUTFILE = "test.properties"; private static final String GOOD_OUTFILE = "test.properties";
private static final String GOOD_OUTFILE_XML = "test.xml"; private static final String GOOD_OUTFILE_XML = "test.xml";
private static final String PREFIX_OUTFILE = "test-prefix.properties"; private static final String PREFIX_OUTFILE = "test-prefix.properties";
@@ -65,7 +65,7 @@ public class EchoPropertiesTest {


@Before @Before
public void setUp() { public void setUp() {
buildRule.configureProject(TASKDEFS_DIR + "echoproperties.xml");
buildRule.configureProject("src/etc/testcases/taskdefs/optional/echoproperties.xml");
buildRule.getProject().setProperty("test.property", TEST_VALUE); buildRule.getProject().setProperty("test.property", TEST_VALUE);
} }


@@ -123,7 +123,7 @@ public class EchoPropertiesTest {
buildRule.executeTarget("testEchoToGoodFileXml"); buildRule.executeTarget("testEchoToGoodFileXml");


// read in the file // read in the file
File f = createRelativeFile(GOOD_OUTFILE_XML);
File f = new File(buildRule.getProject().getBaseDir(), GOOD_OUTFILE_XML);
try (BufferedReader br = new BufferedReader(new FileReader(f))) { try (BufferedReader br = new BufferedReader(new FileReader(f))) {
assertTrue("did not encounter set property in generated file.", br.lines().anyMatch(line assertTrue("did not encounter set property in generated file.", br.lines().anyMatch(line
-> line.contains("<property name=\"test.property\" value=\"" + TEST_VALUE + "\" />"))); -> line.contains("<property name=\"test.property\" value=\"" + TEST_VALUE + "\" />")));
@@ -196,7 +196,9 @@ public class EchoPropertiesTest {


protected Properties loadPropFile(String relativeFilename) protected Properties loadPropFile(String relativeFilename)
throws IOException { throws IOException {
File f = createRelativeFile(relativeFilename);
assertNotNull("Null property file name", relativeFilename);
File f = new File(buildRule.getProject().getBaseDir(), relativeFilename);
assertTrue("Did not create " + f.getAbsolutePath(), f.exists());
Properties props = new Properties(); Properties props = new Properties();
try (InputStream in = new BufferedInputStream(new FileInputStream(f))) { try (InputStream in = new BufferedInputStream(new FileInputStream(f))) {
props.load(in); props.load(in);
@@ -205,21 +207,10 @@ public class EchoPropertiesTest {
} }


protected void assertGoodFile() throws Exception { protected void assertGoodFile() throws Exception {
File f = createRelativeFile(GOOD_OUTFILE);
assertTrue("Did not create " + f.getAbsolutePath(),
f.exists());
Properties props = loadPropFile(GOOD_OUTFILE); Properties props = loadPropFile(GOOD_OUTFILE);
props.list(System.out); props.list(System.out);
assertEquals("test property not found ", assertEquals("test property not found ",
TEST_VALUE, props.getProperty("test.property")); TEST_VALUE, props.getProperty("test.property"));
} }


protected String toAbsolute(String filename) {
return createRelativeFile(filename).getAbsolutePath();
}

protected File createRelativeFile(String filename) {
return filename.equals(".") ? buildRule.getProject().getBaseDir()
: new File(buildRule.getProject().getBaseDir(), filename);
}
} }

+ 1
- 3
src/tests/junit/org/apache/tools/ant/taskdefs/optional/JavahTest.java View File

@@ -31,14 +31,12 @@ import static org.junit.Assume.assumeFalse;


public class JavahTest { public class JavahTest {


private static final String BUILD_XML = "src/etc/testcases/taskdefs/optional/javah/build.xml";

@Rule @Rule
public BuildFileRule buildRule = new BuildFileRule(); public BuildFileRule buildRule = new BuildFileRule();


@Before @Before
public void setUp() { public void setUp() {
buildRule.configureProject(BUILD_XML);
buildRule.configureProject("src/etc/testcases/taskdefs/optional/javah/build.xml");
} }


@After @After


+ 1
- 3
src/tests/junit/org/apache/tools/ant/taskdefs/optional/JspcTest.java View File

@@ -47,8 +47,6 @@ import static org.junit.Assert.assertTrue;
*/ */
public class JspcTest { public class JspcTest {


private static final String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/";

@Rule @Rule
public ExpectedException thrown = ExpectedException.none(); public ExpectedException thrown = ExpectedException.none();


@@ -57,7 +55,7 @@ public class JspcTest {


@Before @Before
public void setUp() { public void setUp() {
buildRule.configureProject(TASKDEFS_DIR + "jspc.xml");
buildRule.configureProject("src/etc/testcases/taskdefs/optional/jspc.xml");
} }


@Test @Test


+ 1
- 4
src/tests/junit/org/apache/tools/ant/taskdefs/optional/Native2AsciiTest.java View File

@@ -32,15 +32,12 @@ import static org.junit.Assert.assertTrue;


public class Native2AsciiTest { public class Native2AsciiTest {


private static final String BUILD_XML =
"src/etc/testcases/taskdefs/optional/native2ascii/build.xml";

@Rule @Rule
public BuildFileRule buildRule = new BuildFileRule(); public BuildFileRule buildRule = new BuildFileRule();


@Before @Before
public void setUp() { public void setUp() {
buildRule.configureProject(BUILD_XML);
buildRule.configureProject("src/etc/testcases/taskdefs/optional/native2ascii/build.xml");
} }


@After @After


+ 1
- 2
src/tests/junit/org/apache/tools/ant/taskdefs/optional/ReplaceRegExpTest.java View File

@@ -39,14 +39,13 @@ import static org.junit.Assume.assumeTrue;
* *
*/ */
public class ReplaceRegExpTest { public class ReplaceRegExpTest {
private static final String PROJECT_PATH = "src/etc/testcases/taskdefs/optional";


@Rule @Rule
public BuildFileRule buildRule = new BuildFileRule(); public BuildFileRule buildRule = new BuildFileRule();


@Before @Before
public void setUp() { public void setUp() {
buildRule.configureProject(PROJECT_PATH + "/replaceregexp.xml");
buildRule.configureProject("src/etc/testcases/taskdefs/optional/replaceregexp.xml");
} }


@Test @Test


+ 1
- 2
src/tests/junit/org/apache/tools/ant/taskdefs/optional/RhinoReferenceTest.java View File

@@ -34,8 +34,7 @@ public class RhinoReferenceTest {


@Before @Before
public void setUp() { public void setUp() {
buildRule.configureProject(
"src/etc/testcases/taskdefs/optional/script_reference.xml");
buildRule.configureProject("src/etc/testcases/taskdefs/optional/script_reference.xml");
} }


@Test @Test


+ 1
- 6
src/tests/junit/org/apache/tools/ant/taskdefs/optional/SchemaValidateTest.java View File

@@ -30,11 +30,6 @@ import org.junit.rules.ExpectedException;


public class SchemaValidateTest { public class SchemaValidateTest {


/**
* where tasks run
*/
private static final String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/";

@Rule @Rule
public BuildFileRule buildRule = new BuildFileRule(); public BuildFileRule buildRule = new BuildFileRule();


@@ -43,7 +38,7 @@ public class SchemaValidateTest {


@Before @Before
public void setUp() { public void setUp() {
buildRule.configureProject(TASKDEFS_DIR + "schemavalidate.xml");
buildRule.configureProject("src/etc/testcases/taskdefs/optional/schemavalidate.xml");
} }


/** /**


+ 1
- 6
src/tests/junit/org/apache/tools/ant/taskdefs/optional/XmlValidateCatalogTest.java View File

@@ -30,17 +30,12 @@ import org.junit.Test;
*/ */
public class XmlValidateCatalogTest { public class XmlValidateCatalogTest {


/**
* where tasks run
*/
private static final String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/";

@Rule @Rule
public BuildFileRule buildRule = new BuildFileRule(); public BuildFileRule buildRule = new BuildFileRule();


@Before @Before
public void setUp() { public void setUp() {
buildRule.configureProject(TASKDEFS_DIR + "xmlvalidate.xml");
buildRule.configureProject("src/etc/testcases/taskdefs/optional/xmlvalidate.xml");
} }






+ 1
- 6
src/tests/junit/org/apache/tools/ant/taskdefs/optional/XmlValidateTest.java View File

@@ -34,11 +34,6 @@ import org.junit.rules.ExpectedException;
*/ */
public class XmlValidateTest { public class XmlValidateTest {


/**
* where tasks run
*/
private static final String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/";

@Rule @Rule
public BuildFileRule buildRule = new BuildFileRule(); public BuildFileRule buildRule = new BuildFileRule();


@@ -47,7 +42,7 @@ public class XmlValidateTest {


@Before @Before
public void setUp() { public void setUp() {
buildRule.configureProject(TASKDEFS_DIR + "xmlvalidate.xml");
buildRule.configureProject("src/etc/testcases/taskdefs/optional/xmlvalidate.xml");
} }


/** /**


+ 1
- 4
src/tests/junit/org/apache/tools/ant/taskdefs/optional/depend/DependTest.java View File

@@ -47,9 +47,6 @@ import static org.junit.Assert.assertTrue;
public class DependTest { public class DependTest {
public static final String RESULT_FILESET = "result"; public static final String RESULT_FILESET = "result";


public static final String TEST_BUILD_FILE
= "src/etc/testcases/taskdefs/optional/depend/depend.xml";

@Rule @Rule
public BuildFileRule buildRule = new BuildFileRule(); public BuildFileRule buildRule = new BuildFileRule();


@@ -58,7 +55,7 @@ public class DependTest {


@Before @Before
public void setUp() { public void setUp() {
buildRule.configureProject(TEST_BUILD_FILE);
buildRule.configureProject("src/etc/testcases/taskdefs/optional/depend/depend.xml");
} }


/** /**


+ 1
- 2
src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageTest.java View File

@@ -44,7 +44,6 @@ import static org.junit.Assume.assumeTrue;
public class ImageTest { public class ImageTest {


private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
private static final String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/image/";
private static final String LARGEIMAGE = "largeimage.jpg"; private static final String LARGEIMAGE = "largeimage.jpg";


@Rule @Rule
@@ -57,7 +56,7 @@ public class ImageTest {
public void setUp() { public void setUp() {
/* JAI depends on internal API removed in Java 9 */ /* JAI depends on internal API removed in Java 9 */
assumeFalse(JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)); assumeFalse(JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9));
buildRule.configureProject(TASKDEFS_DIR + "image.xml");
buildRule.configureProject("src/etc/testcases/taskdefs/optional/image/image.xml");
} }






+ 1
- 2
src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLFormatterWithCDATAOnSystemOut.java View File

@@ -31,7 +31,6 @@ import static org.junit.Assert.assertThat;


public class XMLFormatterWithCDATAOnSystemOut { public class XMLFormatterWithCDATAOnSystemOut {


private static final String DIR = "src/etc/testcases/taskdefs/optional/junit";
private static final String REPORT = private static final String REPORT =
"TEST-" + XMLFormatterWithCDATAOnSystemOut.class.getName() + ".xml"; "TEST-" + XMLFormatterWithCDATAOnSystemOut.class.getName() + ".xml";


@@ -61,7 +60,7 @@ public class XMLFormatterWithCDATAOnSystemOut {


@Test @Test
public void testBuildfile() throws IOException { public void testBuildfile() throws IOException {
buildRule.configureProject(DIR + "/cdataoutput.xml");
buildRule.configureProject("src/etc/testcases/taskdefs/optional/junit/cdataoutput.xml");
if (buildRule.getProject().getProperty("cdata.inner") == null) { if (buildRule.getProject().getProperty("cdata.inner") == null) {
// avoid endless loop // avoid endless loop
buildRule.executeTarget("run-junit"); buildRule.executeTarget("run-junit");


Loading…
Cancel
Save