You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

java.xml 4.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <?xml version="1.0"?>
  2. <project name="java-test" basedir="." default="foo">
  3. <fail unless="tests-classpath.value"
  4. message="the property tests-classpath.value is required by this test" />
  5. <!-- this property gets overridden programmatically-->
  6. <property name="timeToWait" value="4"/>
  7. <!-- this property gets overridden programmatically-->
  8. <property name="logFile" value="spawn.log"/>
  9. <property name="app"
  10. value="org.apache.tools.ant.taskdefs.JavaTest$$EntryPoint" />
  11. <property name="app2"
  12. value="org.apache.tools.ant.taskdefs.JavaTest$$ExceptingEntryPoint" />
  13. <property name="spawnapp"
  14. value="org.apache.tools.ant.taskdefs.JavaTest$$SpawnEntryPoint" />
  15. <target name="testNoJarNoClassname">
  16. <java/>
  17. </target>
  18. <target name="testJarNoFork">
  19. <java jar="test.jar" fork="false"/>
  20. </target>
  21. <target name="testJarAndClassName">
  22. <java jar="test.jar" classname="${app}" />
  23. </target>
  24. <target name="testClassnameAndJar">
  25. <java classname="${app}" jar="test.jar" />
  26. </target>
  27. <target name="testRun">
  28. <fail unless="tests-classpath.value" />
  29. <java classname="${app}"
  30. classpath="${tests-classpath.value}"/>
  31. </target>
  32. <target name="testRunFail">
  33. <java classname="${app}"
  34. classpath="${tests-classpath.value}"
  35. >
  36. <arg value="2"/>
  37. </java>
  38. </target>
  39. <target name="testRunFailFoe">
  40. <java classname="${app}"
  41. classpath="${tests-classpath.value}"
  42. failonerror="true">
  43. <arg value="2"/>
  44. </java>
  45. </target>
  46. <target name="testRunFailFoeFork">
  47. <java classname="${app}"
  48. classpath="${tests-classpath.value}"
  49. failonerror="true"
  50. fork="true">
  51. <arg value="2"/>
  52. </java>
  53. </target>
  54. <target name="testExcepting">
  55. <java classname="${app2}"
  56. classpath="${tests-classpath.value}"
  57. >
  58. </java>
  59. </target>
  60. <target name="testExceptingFork">
  61. <java classname="${app2}"
  62. classpath="${tests-classpath.value}"
  63. fork="true">
  64. </java>
  65. </target>
  66. <target name="testExceptingFoe">
  67. <java classname="${app2}"
  68. classpath="${tests-classpath.value}"
  69. failonerror="true">
  70. </java>
  71. </target>
  72. <target name="testExceptingFoeFork">
  73. <java classname="${app2}"
  74. classpath="${tests-classpath.value}"
  75. failonerror="true"
  76. fork="true">
  77. </java>
  78. </target>
  79. <target name="testResultPropertyZero">
  80. <java classname="${app}"
  81. classpath="${tests-classpath.value}"
  82. resultproperty="exitcode"
  83. fork="true"
  84. >
  85. </java>
  86. <echo message="exitcode = ${exitcode}"/>
  87. </target>
  88. <target name="testResultPropertyNonZero">
  89. <java classname="${app}"
  90. classpath="${tests-classpath.value}"
  91. resultproperty="exitcode"
  92. failonerror="false"
  93. fork="true"
  94. >
  95. <arg value="2"/>
  96. </java>
  97. <echo message="exitcode = ${exitcode}"/>
  98. </target>
  99. <target name="testResultPropertyZeroNoFork">
  100. <java classname="${app}"
  101. classpath="${tests-classpath.value}"
  102. resultproperty="exitcode"
  103. fork="false"
  104. >
  105. <permissions/>
  106. </java>
  107. <echo message="exitcode = ${exitcode}"/>
  108. </target>
  109. <target name="testResultPropertyNonZeroNoFork">
  110. <java classname="${app}"
  111. classpath="${tests-classpath.value}"
  112. resultproperty="exitcode"
  113. failonerror="false"
  114. fork="false"
  115. >
  116. <arg value="-1"/>
  117. <permissions/>
  118. </java>
  119. <echo message="exitcode = ${exitcode}"/>
  120. </target>
  121. <target name="testRunFailWithFailOnError">
  122. <java classname="${app}"
  123. classpath="${tests-classpath.value}"
  124. failonerror="true"
  125. >
  126. <arg value="2"/>
  127. </java>
  128. </target>
  129. <target name="testRunSuccessWithFailOnError">
  130. <java classname="${app}"
  131. classpath="${tests-classpath.value}"
  132. failonerror="true"
  133. >
  134. <arg value="0"/>
  135. </java>
  136. </target>
  137. <target name="testSpawn">
  138. <java classname="${spawnapp}" fork="true" spawn="true" classpath="${tests-classpath.value}">
  139. <arg value="${timeToWait}"/>
  140. <arg value="${logFile}" />
  141. </java>
  142. </target>
  143. <target name="cleanup">
  144. <delete file="${logFile}"/>
  145. </target>
  146. <target name="foo" />
  147. </project>