Browse Source

More hardcoded assumptions about file tree structure

master
Gintas Grigelionis 6 years ago
parent
commit
f32cf7cfa5
7 changed files with 29 additions and 34 deletions
  1. +3
    -2
      build.xml
  2. +3
    -3
      src/etc/poms/ant/pom.xml
  3. +14
    -20
      src/etc/testcases/taskdefs/signjar.xml
  4. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  5. +4
    -4
      src/tests/junit/org/apache/tools/ant/AntClassLoaderDelegationTest.java
  6. +2
    -2
      src/tests/junit/org/apache/tools/ant/taskdefs/ExecuteJavaTest.java
  7. +2
    -2
      src/tests/junit/org/apache/tools/ant/taskdefs/ExecuteWatchdogTest.java

+ 3
- 2
build.xml View File

@@ -84,13 +84,14 @@
<property name="build.junit.xml" location="${build.tests}/xml"/>
<property name="build.junit.tmpdir" location="${build.tests}/tmp"/>
<property name="build.junit.reports" location="${build.tests}/reports"/>
<property name="build.pkg.dir" value="${build.dir}/pkg"/>
<property name="antunit.xml" location="${build.dir}/antunit/xml"/>
<property name="antunit.tmpdir" location="${build.dir}/antunit/tmp"/>
<property name="antunit.reports" location="${build.dir}/antunit/reports"/>
<property name="antunit.loglevel" value="none"/>
<!-- the absolute path -->
<property name="build.classes.value" location="${build.classes}"/>
<property name="build.tests.value" location="${build.tests}"/>
<property name="build.pkg.dir" value="${build.dir}/pkg"/>

<!--
===================================================================
@@ -1704,7 +1705,7 @@ ${antunit.reports}
errorproperty="junit.failed"
filtertrace="${junit.filtertrace}">
<sysproperty key="ant.home" value="${ant.home}"/>
<sysproperty key="build.tests" file="${build.tests}"/>
<sysproperty key="build.classes.value" value="${build.classes.value}"/>
<sysproperty key="build.tests.value" value="${build.tests.value}"/>
<sysproperty key="offline" value="${offline}"/>
<sysproperty key="tests-classpath.value"


+ 3
- 3
src/etc/poms/ant/pom.xml View File

@@ -228,12 +228,12 @@
<value>${env.ANT_HOME}</value>
</property>
<property>
<name>build.tests</name>
<value>target/${project.artifactId}/testcases</value>
<name>build.classes.value</name>
<value>${project.basedir}/../../../../target/${project.artifactId}/classes</value>
</property>
<property>
<name>build.tests.value</name>
<value>${project.basedir}/target/${project.artifactId}/testcases</value>
<value>${project.basedir}/../../../../target/${project.artifactId}/testcases</value>
</property>
<property>
<name>offline</name>


+ 14
- 20
src/etc/testcases/taskdefs/signjar.xml View File

@@ -20,42 +20,38 @@
<import file="../buildfiletest-base.xml"/>

<target name="setUp">
<mkdir dir="${output}" />
<property name="subdir" location="${output}/subdir" />
<property name="classes.dir" value="../../../build/classes"/>
<property name="test.jar" location="${output}/signtest.jar" />
<property name="subdirtest.jar" location="${subdir}/signtest.jar" />

<mkdir dir="${output}"/>
<property name="subdir" location="${output}/subdir"/>
<property name="test.jar" location="${output}/signtest.jar"/>
<property name="subdirtest.jar" location="${subdir}/signtest.jar"/>
</target>


<macrodef name="assertSigned">
<attribute name="jar" default="${test.jar}" />
<attribute name="jar" default="${test.jar}"/>
<sequential>
<fail message="not signed: @{jar}" >
<fail message="not signed: @{jar}">
<condition>
<not><issigned file="@{jar}" /></not>
<not><issigned file="@{jar}"/></not>
</condition>
</fail>
</sequential>
</macrodef>

<presetdef name="sign-base">
<signjar alias="testonly" keystore="testkeystore"
storepass="apacheant"/>
<signjar alias="testonly" keystore="testkeystore" storepass="apacheant"/>
</presetdef>

<presetdef name="verify-base">
<verifyjar keystore="testkeystore"
storepass="apacheant"/>
<verifyjar keystore="testkeystore" storepass="apacheant"/>
</presetdef>

<presetdef name="sign">
<sign-base jar="${test.jar}" />
<sign-base jar="${test.jar}"/>
</presetdef>

<target name="jar" depends="setUp">
<jar jarfile="${test.jar}" basedir="${classes.dir}" includes="**/Task.class"/>
<jar jarfile="${test.jar}" basedir="${build.classes.value}" includes="**/Task.class"/>
</target>

<target name="help">
@@ -63,7 +59,7 @@
</target>

<target name="basic" depends="jar">
<sign />
<sign/>
<assertSigned/>
</target>

@@ -84,14 +80,12 @@
</target>

<target name="urlKeystoreHTTP" depends="jar">
<sign
keystore="http://ant.apache.org/webtest/testkeystore"
/>
<sign keystore="http://ant.apache.org/webtest/testkeystore"/>
<assertSigned/>
</target>

<target name="testTsaLocalhost" depends="jar">
<sign tsaurl="http://localhost:0/" />
<sign tsaurl="http://localhost:0/"/>
</target>

</project>

+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java View File

@@ -102,7 +102,7 @@ import org.apache.tools.ant.util.StringUtils;
* &lt;junit printsummary="no" haltonfailure="yes" fork="${junit.fork}"&gt;
* &lt;jvmarg value="-classic"/&gt;
* &lt;classpath refid="tests-classpath"/&gt;
* &lt;sysproperty key="build.tests" value="${build.tests}"/&gt;
* &lt;sysproperty key="build.tests.value" value="${build.tests.value}"/&gt;
* &lt;formatter type="brief" usefile="false" /&gt;
* &lt;batchtest&gt;
* &lt;fileset dir="${tests.dir}"&gt;


+ 4
- 4
src/tests/junit/org/apache/tools/ant/AntClassLoaderDelegationTest.java View File

@@ -58,8 +58,8 @@ public class AntClassLoaderDelegationTest {
@Test
public void testFindResources() throws Exception {
// This path should contain the class files for these testcases:
String buildTestcases = System.getProperty("build.tests");
assertNotNull("defined ${build.tests}", buildTestcases);
String buildTestcases = System.getProperty("build.tests.value");
assertNotNull("defined ${build.tests.value}", buildTestcases);
assertTrue("have a dir " + buildTestcases,
new File(buildTestcases).isDirectory());
Path path = new Path(p, buildTestcases + "/org");
@@ -84,8 +84,8 @@ public class AntClassLoaderDelegationTest {
@SuppressWarnings("resource")
@Test
public void testFindIsolateResources() throws Exception {
String buildTestcases = System.getProperty("build.tests");
assertNotNull("defined ${build.tests}", buildTestcases);
String buildTestcases = System.getProperty("build.tests.value");
assertNotNull("defined ${build.tests.value}", buildTestcases);
assertTrue("have a dir " + buildTestcases,
new File(buildTestcases).isDirectory());
Path path = new Path(p, buildTestcases + "/org");


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

@@ -119,9 +119,9 @@ public class ExecuteJavaTest {
* This is severely dependent on the build.xml properties.
*/
private static String getTestClassPath() {
String classpath = System.getProperty("build.tests");
String classpath = System.getProperty("build.tests.value");
if (classpath == null) {
System.err.println("WARNING: 'build.tests' property is not available!");
System.err.println("WARNING: 'build.tests.value' property is not available!");
classpath = System.getProperty("java.class.path");
}



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

@@ -56,9 +56,9 @@ public class ExecuteWatchdogTest {
* severely tied to the build.xml properties.
*/
private static String getTestClassPath() {
String classpath = System.getProperty("build.tests");
String classpath = System.getProperty("build.tests.value");
if (classpath == null) {
System.err.println("WARNING: 'build.tests' property is not available!");
System.err.println("WARNING: 'build.tests.value' property is not available!");
classpath = System.getProperty("java.class.path");
}



Loading…
Cancel
Save