Compare commits
2 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
58254db5d4 | |
|
|
b66006a39a |
14
.asf.yaml
14
.asf.yaml
|
|
@ -1,14 +0,0 @@
|
|||
github:
|
||||
rulesets:
|
||||
- name: "Default Branch Protection"
|
||||
type: branch
|
||||
branches:
|
||||
includes:
|
||||
- "~DEFAULT_BRANCH"
|
||||
- "release/*"
|
||||
- "rel/*"
|
||||
excludes: []
|
||||
bypass_teams:
|
||||
- root
|
||||
restrict_deletion: true
|
||||
restrict_force_push: true
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
*.bat eol=crlf
|
||||
*.bz2 binary
|
||||
*.cmd eol=crlf
|
||||
*.css text
|
||||
*.dtd text
|
||||
*.g text
|
||||
*.gif binary
|
||||
*.gz binary
|
||||
*.html text diff=html
|
||||
*.ico binary
|
||||
*.inc text
|
||||
*.jar binary
|
||||
*.jpg binary
|
||||
*.jsp text
|
||||
*.md text
|
||||
*.md5 text
|
||||
*.md5sum text
|
||||
*.mf text
|
||||
*.pl text diff=perl
|
||||
*.properties text
|
||||
*.py text diff=python
|
||||
*.result text
|
||||
*.sample text
|
||||
*.sh eol=lf
|
||||
*.tar binary
|
||||
*.test text
|
||||
*.txt text
|
||||
*.wxs text
|
||||
*.xml text
|
||||
*.xsd text
|
||||
*.xsl text
|
||||
*.zip binary
|
||||
.gitattributes text
|
||||
.gitignore text
|
||||
NOTICE text
|
||||
README text
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
/build/
|
||||
/docs/style.css
|
||||
/ivy/
|
||||
/lib/
|
||||
/target/
|
||||
distribution
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
[submodule "common"]
|
||||
path = common
|
||||
url = https://gitbox.apache.org/repos/asf/ant-antlibs-common.git
|
||||
203
LICENSE
203
LICENSE
|
|
@ -1,203 +0,0 @@
|
|||
/*
|
||||
* Apache License
|
||||
* Version 2.0, January 2004
|
||||
* http://www.apache.org/licenses/
|
||||
*
|
||||
* TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
*
|
||||
* 1. Definitions.
|
||||
*
|
||||
* "License" shall mean the terms and conditions for use, reproduction,
|
||||
* and distribution as defined by Sections 1 through 9 of this document.
|
||||
*
|
||||
* "Licensor" shall mean the copyright owner or entity authorized by
|
||||
* the copyright owner that is granting the License.
|
||||
*
|
||||
* "Legal Entity" shall mean the union of the acting entity and all
|
||||
* other entities that control, are controlled by, or are under common
|
||||
* control with that entity. For the purposes of this definition,
|
||||
* "control" means (i) the power, direct or indirect, to cause the
|
||||
* direction or management of such entity, whether by contract or
|
||||
* otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
* outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
*
|
||||
* "You" (or "Your") shall mean an individual or Legal Entity
|
||||
* exercising permissions granted by this License.
|
||||
*
|
||||
* "Source" form shall mean the preferred form for making modifications,
|
||||
* including but not limited to software source code, documentation
|
||||
* source, and configuration files.
|
||||
*
|
||||
* "Object" form shall mean any form resulting from mechanical
|
||||
* transformation or translation of a Source form, including but
|
||||
* not limited to compiled object code, generated documentation,
|
||||
* and conversions to other media types.
|
||||
*
|
||||
* "Work" shall mean the work of authorship, whether in Source or
|
||||
* Object form, made available under the License, as indicated by a
|
||||
* copyright notice that is included in or attached to the work
|
||||
* (an example is provided in the Appendix below).
|
||||
*
|
||||
* "Derivative Works" shall mean any work, whether in Source or Object
|
||||
* form, that is based on (or derived from) the Work and for which the
|
||||
* editorial revisions, annotations, elaborations, or other modifications
|
||||
* represent, as a whole, an original work of authorship. For the purposes
|
||||
* of this License, Derivative Works shall not include works that remain
|
||||
* separable from, or merely link (or bind by name) to the interfaces of,
|
||||
* the Work and Derivative Works thereof.
|
||||
*
|
||||
* "Contribution" shall mean any work of authorship, including
|
||||
* the original version of the Work and any modifications or additions
|
||||
* to that Work or Derivative Works thereof, that is intentionally
|
||||
* submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
* or by an individual or Legal Entity authorized to submit on behalf of
|
||||
* the copyright owner. For the purposes of this definition, "submitted"
|
||||
* means any form of electronic, verbal, or written communication sent
|
||||
* to the Licensor or its representatives, including but not limited to
|
||||
* communication on electronic mailing lists, source code control systems,
|
||||
* and issue tracking systems that are managed by, or on behalf of, the
|
||||
* Licensor for the purpose of discussing and improving the Work, but
|
||||
* excluding communication that is conspicuously marked or otherwise
|
||||
* designated in writing by the copyright owner as "Not a Contribution."
|
||||
*
|
||||
* "Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
* on behalf of whom a Contribution has been received by Licensor and
|
||||
* subsequently incorporated within the Work.
|
||||
*
|
||||
* 2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
* this License, each Contributor hereby grants to You a perpetual,
|
||||
* worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
* copyright license to reproduce, prepare Derivative Works of,
|
||||
* publicly display, publicly perform, sublicense, and distribute the
|
||||
* Work and such Derivative Works in Source or Object form.
|
||||
*
|
||||
* 3. Grant of Patent License. Subject to the terms and conditions of
|
||||
* this License, each Contributor hereby grants to You a perpetual,
|
||||
* worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
* (except as stated in this section) patent license to make, have made,
|
||||
* use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
* where such license applies only to those patent claims licensable
|
||||
* by such Contributor that are necessarily infringed by their
|
||||
* Contribution(s) alone or by combination of their Contribution(s)
|
||||
* with the Work to which such Contribution(s) was submitted. If You
|
||||
* institute patent litigation against any entity (including a
|
||||
* cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
* or a Contribution incorporated within the Work constitutes direct
|
||||
* or contributory patent infringement, then any patent licenses
|
||||
* granted to You under this License for that Work shall terminate
|
||||
* as of the date such litigation is filed.
|
||||
*
|
||||
* 4. Redistribution. You may reproduce and distribute copies of the
|
||||
* Work or Derivative Works thereof in any medium, with or without
|
||||
* modifications, and in Source or Object form, provided that You
|
||||
* meet the following conditions:
|
||||
*
|
||||
* (a) You must give any other recipients of the Work or
|
||||
* Derivative Works a copy of this License; and
|
||||
*
|
||||
* (b) You must cause any modified files to carry prominent notices
|
||||
* stating that You changed the files; and
|
||||
*
|
||||
* (c) You must retain, in the Source form of any Derivative Works
|
||||
* that You distribute, all copyright, patent, trademark, and
|
||||
* attribution notices from the Source form of the Work,
|
||||
* excluding those notices that do not pertain to any part of
|
||||
* the Derivative Works; and
|
||||
*
|
||||
* (d) If the Work includes a "NOTICE" text file as part of its
|
||||
* distribution, then any Derivative Works that You distribute must
|
||||
* include a readable copy of the attribution notices contained
|
||||
* within such NOTICE file, excluding those notices that do not
|
||||
* pertain to any part of the Derivative Works, in at least one
|
||||
* of the following places: within a NOTICE text file distributed
|
||||
* as part of the Derivative Works; within the Source form or
|
||||
* documentation, if provided along with the Derivative Works; or,
|
||||
* within a display generated by the Derivative Works, if and
|
||||
* wherever such third-party notices normally appear. The contents
|
||||
* of the NOTICE file are for informational purposes only and
|
||||
* do not modify the License. You may add Your own attribution
|
||||
* notices within Derivative Works that You distribute, alongside
|
||||
* or as an addendum to the NOTICE text from the Work, provided
|
||||
* that such additional attribution notices cannot be construed
|
||||
* as modifying the License.
|
||||
*
|
||||
* You may add Your own copyright statement to Your modifications and
|
||||
* may provide additional or different license terms and conditions
|
||||
* for use, reproduction, or distribution of Your modifications, or
|
||||
* for any such Derivative Works as a whole, provided Your use,
|
||||
* reproduction, and distribution of the Work otherwise complies with
|
||||
* the conditions stated in this License.
|
||||
*
|
||||
* 5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
* any Contribution intentionally submitted for inclusion in the Work
|
||||
* by You to the Licensor shall be under the terms and conditions of
|
||||
* this License, without any additional terms or conditions.
|
||||
* Notwithstanding the above, nothing herein shall supersede or modify
|
||||
* the terms of any separate license agreement you may have executed
|
||||
* with Licensor regarding such Contributions.
|
||||
*
|
||||
* 6. Trademarks. This License does not grant permission to use the trade
|
||||
* names, trademarks, service marks, or product names of the Licensor,
|
||||
* except as required for reasonable and customary use in describing the
|
||||
* origin of the Work and reproducing the content of the NOTICE file.
|
||||
*
|
||||
* 7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
* agreed to in writing, Licensor provides the Work (and each
|
||||
* Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied, including, without limitation, any warranties or conditions
|
||||
* of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
* appropriateness of using or redistributing the Work and assume any
|
||||
* risks associated with Your exercise of permissions under this License.
|
||||
*
|
||||
* 8. Limitation of Liability. In no event and under no legal theory,
|
||||
* whether in tort (including negligence), contract, or otherwise,
|
||||
* unless required by applicable law (such as deliberate and grossly
|
||||
* negligent acts) or agreed to in writing, shall any Contributor be
|
||||
* liable to You for damages, including any direct, indirect, special,
|
||||
* incidental, or consequential damages of any character arising as a
|
||||
* result of this License or out of the use or inability to use the
|
||||
* Work (including but not limited to damages for loss of goodwill,
|
||||
* work stoppage, computer failure or malfunction, or any and all
|
||||
* other commercial damages or losses), even if such Contributor
|
||||
* has been advised of the possibility of such damages.
|
||||
*
|
||||
* 9. Accepting Warranty or Additional Liability. While redistributing
|
||||
* the Work or Derivative Works thereof, You may choose to offer,
|
||||
* and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
* or other liability obligations and/or rights consistent with this
|
||||
* License. However, in accepting such obligations, You may act only
|
||||
* on Your own behalf and on Your sole responsibility, not on behalf
|
||||
* of any other Contributor, and only if You agree to indemnify,
|
||||
* defend, and hold each Contributor harmless for any liability
|
||||
* incurred by, or claims asserted against, such Contributor by reason
|
||||
* of your accepting any such warranty or additional liability.
|
||||
*
|
||||
* END OF TERMS AND CONDITIONS
|
||||
*
|
||||
* APPENDIX: How to apply the Apache License to your work.
|
||||
*
|
||||
* To apply the Apache License to your work, attach the following
|
||||
* boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
* replaced with your own identifying information. (Don't include
|
||||
* the brackets!) The text should be enclosed in the appropriate
|
||||
* comment syntax for the file format. We also recommend that a
|
||||
* file or class name and description of purpose be included on the
|
||||
* same "printed page" as the copyright notice for easier
|
||||
* identification within third-party archives.
|
||||
*
|
||||
* Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
8
NOTICE
8
NOTICE
|
|
@ -1,6 +1,6 @@
|
|||
Apache AntUnit
|
||||
Copyright 2005-2018,2021-2022,2026 The Apache Software Foundation
|
||||
Apache AntUnit
|
||||
Copyright 2005-2011 The Apache Software Foundation
|
||||
|
||||
This product includes software developed at
|
||||
The Apache Software Foundation (https://www.apache.org/).
|
||||
This product includes software developed by
|
||||
The Apache Software Foundation (http://www.apache.org/).
|
||||
|
||||
|
|
|
|||
8
README
8
README
|
|
@ -11,16 +11,16 @@ Learn more
|
|||
|
||||
The documentation is included in the docs subdirectory of this
|
||||
distribution. The home of this library is
|
||||
<https://ant.apache.org/antlibs/antunit/index.html>.
|
||||
<http://ant.apache.org/antlibs/antunit/index.html>.
|
||||
|
||||
Building
|
||||
========
|
||||
|
||||
This Ant Library requires Ant 1.8.1 or later to build, some of
|
||||
the test use JUnit 4 (4.12 recommended).
|
||||
This Ant Library requires Ant 1.7.0 or later to build, some of
|
||||
the test use JUnit 3 (3.8.2 recommended).
|
||||
|
||||
It should work with any Java(TM) Runtime (and compile with any Java(TM)
|
||||
Developer Kit) starting with version 5.
|
||||
Developer Kit) starting with version 1.2.
|
||||
|
||||
Using
|
||||
=====
|
||||
|
|
|
|||
23
build.xml
23
build.xml
|
|
@ -8,7 +8,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
@ -22,24 +22,11 @@ under the License.
|
|||
<!-- easy way to override properties -->
|
||||
<property file="build.properties"/>
|
||||
|
||||
<!-- we don't want the build to look for a packaged AntUnit -->
|
||||
<target name="setup-for-antunit-tests" depends="setup,determine-test-types,resolve"
|
||||
unless="skip-antunit">
|
||||
<typedef uri="antlib:org.apache.ant.antunit"
|
||||
resource="org/apache/ant/antunit/antlib.xml">
|
||||
<classpath>
|
||||
<path refid="classpath.test"/>
|
||||
<pathelement location="${build.classes}"/>
|
||||
<pathelement location="${antlib.location}"/>
|
||||
</classpath>
|
||||
</typedef>
|
||||
</target>
|
||||
<!-- don't fork junit; regexp classes not available -->
|
||||
<property name="junit.fork" value="false" />
|
||||
|
||||
<target name="ready-for-bin-dist" depends="create-antlib-sbom,common.ready-for-bin-dist"/>
|
||||
|
||||
<target name="after-src-dist" depends="src-sboms"/>
|
||||
<target name="after-bin-dist" depends="bin-sboms"/>
|
||||
<property name="javac.test-source" value="1.5"/>
|
||||
<property name="javac.test-target" value="1.5"/>
|
||||
|
||||
<import file="common/build.xml"/>
|
||||
<import file="cyclonedx.xml"/>
|
||||
</project>
|
||||
|
|
|
|||
68
changes.xml
68
changes.xml
|
|
@ -7,7 +7,7 @@
|
|||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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,
|
||||
|
|
@ -37,71 +37,7 @@
|
|||
<title>Apache AntUnit</title>
|
||||
</properties>
|
||||
|
||||
<release version="1.5.1" date="unreleased">
|
||||
</release>
|
||||
|
||||
<release version="1.5.0" date="2026-07-19">
|
||||
<action type="add">
|
||||
Allow the AntUnit task to use a different classloader when
|
||||
running the test by means of a nested classpath or a
|
||||
classpathrefid attribute.
|
||||
|
||||
Only works properly with Ant 1.10.13 or later.
|
||||
</action>
|
||||
<action type="add">
|
||||
Add new assertNotEquals, assertPropertyNotSet,
|
||||
assertPropertyNotEquals, assertPropertyDoesntContain and
|
||||
assertReferenceIsNotSet assertions.
|
||||
</action>
|
||||
</release>
|
||||
|
||||
<release version="1.4.1" date="2021-07-07">
|
||||
<action type="fix" issue="65315">
|
||||
We didn't follow our own best practice and hard-coded the
|
||||
AntUnit URI inside the Antlib descriptor instead of using
|
||||
ant:current.
|
||||
</action>
|
||||
</release>
|
||||
<release version="1.4" date="2018-06-25">
|
||||
<action type="update" breaks-bwc="true">
|
||||
The coordinates inside the Ivy file have been changed to match
|
||||
those of the POM.
|
||||
</action>
|
||||
<action type="fix" issue="57341">
|
||||
The br-replace template inside the XSLT stylesheets used by
|
||||
for reports could cause stack overflows or out-of-memory errors
|
||||
when applied to big outputs.
|
||||
</action>
|
||||
<action type="update" breaks-bwc="true">
|
||||
AntUnit now requires at least Ant 1.8.1 at runtime.
|
||||
</action>
|
||||
</release>
|
||||
|
||||
<release version="1.3" date="2014-05-14">
|
||||
<action type="add" issue="53383">
|
||||
New assertion assertRefResourceExists,
|
||||
assertRefResourceDoesntExist, assertRefResourceContains,
|
||||
assertRefResourceDoesntContain, assertNestedResourceExists,
|
||||
assertNestedResourceDoesntExist have been added. These new
|
||||
assertions work for non-filesystem resources unlike their
|
||||
existing cousins of AntUnit 1.2.
|
||||
</action>
|
||||
<action type="add" issue="43582">
|
||||
A new AntUnitListener named "logforwarder" can be attached to
|
||||
forward any log output from the project under test to the
|
||||
project running the AntUnit task immediately.
|
||||
</action>
|
||||
<action type="fix" issue="56470">
|
||||
LogCapturer can now optionally add (platform dependent) line
|
||||
breaks between log messages that it records.
|
||||
The log related assertions and the logcontent resource have a
|
||||
new attribute "mergeLines" that controls the line breaks, it
|
||||
defaults to "true" - i.e. no line breaks - to preserve backwards
|
||||
compatibility.
|
||||
</action>
|
||||
</release>
|
||||
|
||||
<release version="1.2" date="2011-08-16">
|
||||
<release version="1.2" date="not-released">
|
||||
<action type="update" breaks-bwc="true">
|
||||
assertResourceContains now first validates that the given
|
||||
resource actually exists using assertResourceExists - this may
|
||||
|
|
|
|||
1
common
1
common
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 08aa3efdbec177de04e5a9d7f9a5ca787d612a4e
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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,
|
||||
|
|
@ -62,10 +62,6 @@
|
|||
<first>Peter</first>
|
||||
<last>Reilly</last>
|
||||
</name>
|
||||
<name>
|
||||
<first>Ryan</first>
|
||||
<last>Bennitt</last>
|
||||
</name>
|
||||
<name>
|
||||
<first>Stefan</first>
|
||||
<last>Bodewig</last>
|
||||
|
|
|
|||
255
cyclonedx.xml
255
cyclonedx.xml
|
|
@ -1,255 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
https://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.
|
||||
-->
|
||||
<project name="cyclonedx" xmlns:ivy="antlib:org.apache.ivy.ant">
|
||||
|
||||
<target name="define-cyclonedx-components"
|
||||
depends="define-core-ant-components"
|
||||
if="can.use.cyclonedx">
|
||||
<cdx:externalreferenceset
|
||||
id="antlib-ext-refs"
|
||||
xmlns:cdx="antlib:org.apache.ant.cyclonedx">
|
||||
<externalReference
|
||||
type="VCS"
|
||||
url="https://gitbox.apache.org/repos/asf/ant-antlibs-antunit.git"/>
|
||||
<externalReference
|
||||
type="ISSUE_TRACKER"
|
||||
url="https://bz.apache.org/bugzilla/buglist.cgi?component=AntUnit&product=Ant"/>
|
||||
</cdx:externalreferenceset>
|
||||
</target>
|
||||
|
||||
<target name="create-antlib-sbom"
|
||||
depends="define-cyclonedx-components,antlib"
|
||||
if="can.use.cyclonedx">
|
||||
<uptodate property="antlib-sbom-ok"
|
||||
targetfile="${build.lib}/${artifact.stub}.cdx.json">
|
||||
<srcresources>
|
||||
<file file="${jarname}"/>
|
||||
<file file="ivy.xml"/>
|
||||
<file file="cyclonedx.xml"/>
|
||||
</srcresources>
|
||||
</uptodate>
|
||||
<cdx:componentbom
|
||||
bomName="${artifact.stub}.cdx"
|
||||
outputdirectory="${build.lib}"
|
||||
format="all"
|
||||
useComponentSupplier="true"
|
||||
useComponentManufacturer="true"
|
||||
unless:set="antlib-sbom-ok"
|
||||
xmlns:unless="ant:unless"
|
||||
xmlns:cdx="antlib:org.apache.ant.cyclonedx">
|
||||
<component
|
||||
name="${artifact.name}"
|
||||
group="org.apache.ant"
|
||||
version="${artifact.version}"
|
||||
description="Apache AntUnit"
|
||||
publisher="The Apache Software Foundation"
|
||||
supplierIsManufacturer="true">
|
||||
<file file="${jarname}"/>
|
||||
<supplier refid="ant-pmc"/>
|
||||
<license refid="apache-2"/>
|
||||
<externalReferenceSet refid="ant-common-refs"/>
|
||||
<externalReferenceSet refid="antlibs-common-ext-refs"/>
|
||||
<externalReferenceSet refid="antlib-ext-refs"/>
|
||||
<dependency componentRef="ant"/>
|
||||
<dependency componentRef="junit"/>
|
||||
</component>
|
||||
<additionalComponent refid="ant"/>
|
||||
<additionalComponent refid="ant-launcher"/>
|
||||
<additionalComponent
|
||||
id="junit"
|
||||
name="junit"
|
||||
group="junit"
|
||||
version="4.13.2"
|
||||
description="JUnit is a unit testing framework for Java, created by Erich Gamma and Kent Beck."
|
||||
scope="optional"
|
||||
publisher="JUnit">
|
||||
<license licenseId="EPL-1.0">
|
||||
<url url="http://www.eclipse.org/legal/epl-v10.html"/>
|
||||
</license>
|
||||
<externalReference
|
||||
type="WEBSITE"
|
||||
url="http://junit.org"/>
|
||||
<dependency componentRef="hamcrest"/>
|
||||
</additionalComponent>
|
||||
<additionalComponent
|
||||
id="hamcrest"
|
||||
name="hamcrest-core"
|
||||
group="org.hamcrest"
|
||||
version="1.3"
|
||||
description="Core API and libraries of hamcrest matcher framework."
|
||||
scope="optional">
|
||||
<license licenseId="BSD-3-Clause">
|
||||
<url url="https://raw.githubusercontent.com/hamcrest/JavaHamcrest/master/LICENSE"/>
|
||||
</license>
|
||||
<externalReference
|
||||
type="WEBSITE"
|
||||
url="http://hamcrest.org/JavaHamcrest/"/>
|
||||
</additionalComponent>
|
||||
<license refid="apache-2"/>
|
||||
</cdx:componentbom>
|
||||
</target>
|
||||
|
||||
<target name="after-dist"
|
||||
depends="define-cyclonedx-components"
|
||||
if="can.use.cyclonedx">
|
||||
<macrodef name="distributionbom" backtrace="false">
|
||||
<attribute name="version"/>
|
||||
<attribute name="archiveName"/>
|
||||
<attribute name="archiveUrl"/>
|
||||
<attribute name="archiveLocation" default=""/>
|
||||
<attribute name="outputDirectory"/>
|
||||
<attribute name="description"/>
|
||||
<attribute name="publisher"/>
|
||||
<attribute name="componentType" default="file"/>
|
||||
<attribute name="format" default="all"/>
|
||||
<attribute name="useComponentManufacturer" default="true"/>
|
||||
<attribute name="useComponentSupplier" default="true"/>
|
||||
<attribute name="supplierIsManufacturer" default="true"/>
|
||||
<element name="archiveContent"/>
|
||||
<element name="componentChildren" optional="true"/>
|
||||
<element name="additionalBomContent" optional="true"/>
|
||||
<sequential
|
||||
xmlns:cdx="antlib:org.apache.ant.cyclonedx">
|
||||
<cdx:componentbom
|
||||
bomName="@{archiveName}.cdx"
|
||||
outputdirectory="@{outputDirectory}"
|
||||
format="@{format}"
|
||||
useComponentManufacturer="@{useComponentManufacturer}"
|
||||
useComponentSupplier="@{useComponentSupplier}">
|
||||
<component
|
||||
version="@{version}"
|
||||
purl="@{archiveUrl}"
|
||||
name="@{archiveUrl}"
|
||||
description="@{description}"
|
||||
publisher="@{publisher}"
|
||||
type="@{componentType}"
|
||||
supplierIsManufacturer="@{supplierIsManufacturer}">
|
||||
<file file="@{archiveLocation}"
|
||||
unless:blank="@{archiveLocation}" xmlns:unless="ant:unless"/>
|
||||
<componentChildren/>
|
||||
</component>
|
||||
<pureFileComponents>
|
||||
<archiveContent/>
|
||||
</pureFileComponents>
|
||||
<additionalBomContent/>
|
||||
</cdx:componentbom>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
<macrodef name="create-tarball-bom">
|
||||
<attribute name="distdir"/>
|
||||
<attribute name="distbase"/>
|
||||
<attribute name="subdir"/>
|
||||
<attribute name="binsrc"/>
|
||||
<attribute name="binarysource"/>
|
||||
<attribute name="ext"/>
|
||||
<element name="moreComponentChildren" implicit="true" optional="true"/>
|
||||
<sequential>
|
||||
<distributionbom
|
||||
outputdirectory="@{distbase}"
|
||||
version="${artifact.version}"
|
||||
archiveName="${dist.name}-@{binsrc}.@{ext}"
|
||||
archiveUrl="https://archive.apache.org/dist/ant/antlibs/antunit/@{subdir}/${dist.name}-@{binsrc}.@{ext}"
|
||||
archiveLocation="@{distbase}/${dist.name}-@{binsrc}.@{ext}"
|
||||
description="Apache AntUnit @{binarysource}"
|
||||
publisher="The Apache Software Foundation"
|
||||
xmlns:cdx="antlib:org.apache.ant.cyclonedx">
|
||||
<componentChildren>
|
||||
<supplier refid="ant-pmc"/>
|
||||
<license refid="apache-2"/>
|
||||
<externalReferenceSet refid="ant-common-refs"/>
|
||||
<externalReferenceSet refid="antlibs-common-ext-refs"/>
|
||||
<externalReferenceSet refid="antlib-ext-refs"/>
|
||||
<moreComponentChildren/>
|
||||
</componentChildren>
|
||||
<archiveContent>
|
||||
<fileset dir="@{distdir}/..">
|
||||
<include name="${dist.name}/**"/>
|
||||
</fileset>
|
||||
</archiveContent>
|
||||
<additionalBomContent>
|
||||
<license refid="apache-2"/>
|
||||
</additionalBomContent>
|
||||
</distributionbom>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
<macrodef name="create-tarball-boms">
|
||||
<attribute name="distdir"/>
|
||||
<attribute name="distbase"/>
|
||||
<attribute name="subdir"/>
|
||||
<attribute name="binsrc"/>
|
||||
<attribute name="binarysource"/>
|
||||
<element name="componentChildren" implicit="true" optional="true"/>
|
||||
<sequential>
|
||||
<create-tarball-bom
|
||||
distdir="@{distdir}"
|
||||
distbase="@{distbase}"
|
||||
subdir="@{subdir}"
|
||||
binsrc="@{binsrc}"
|
||||
binarysource="@{binarysource}"
|
||||
ext="tar.gz">
|
||||
<componentChildren/>
|
||||
</create-tarball-bom>
|
||||
<create-tarball-bom
|
||||
distdir="@{distdir}"
|
||||
distbase="@{distbase}"
|
||||
subdir="@{subdir}"
|
||||
binsrc="@{binsrc}"
|
||||
binarysource="@{binarysource}"
|
||||
ext="tar.bz2">
|
||||
<componentChildren/>
|
||||
</create-tarball-bom>
|
||||
<create-tarball-bom
|
||||
distdir="@{distdir}"
|
||||
distbase="@{distbase}"
|
||||
subdir="@{subdir}"
|
||||
binsrc="@{binsrc}"
|
||||
binarysource="@{binarysource}"
|
||||
ext="zip">
|
||||
<componentChildren/>
|
||||
</create-tarball-bom>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
|
||||
<target name="src-sboms" depends="after-dist" if="can.use.cyclonedx">
|
||||
<create-tarball-boms
|
||||
distdir="${src.dist.dir}"
|
||||
distbase="${dist.base}"
|
||||
subdir="source"
|
||||
binsrc="src"
|
||||
binarysource="Source Distribution"/>
|
||||
</target>
|
||||
|
||||
<target name="bin-sboms" depends="after-dist" if="can.use.cyclonedx">
|
||||
<create-tarball-boms
|
||||
distdir="${bin.dist.dir}"
|
||||
distbase="${dist.base}"
|
||||
subdir="binaries"
|
||||
binsrc="bin"
|
||||
binarysource="Binary Distribution">
|
||||
<component>
|
||||
<sbomLink>
|
||||
<file file="${bin.dist.dir}/${artifact.stub}.cdx.json"/>
|
||||
</sbomLink>
|
||||
<file file="${bin.dist.dir}/${artifact.stub}.jar"/>
|
||||
</component>
|
||||
</create-tarball-boms>
|
||||
</target>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet type="text/xsl"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<rdf:RDF xml:lang="en"
|
||||
xmlns="http://usefulinc.com/ns/doap#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:asfext="http://projects.apache.org/ns/asfext#">
|
||||
<Project rdf:about="http://ant.apache.org/antlibs/antunit/">
|
||||
<created>2006-09-13</created>
|
||||
<license rdf:resource="http://usefulinc.com/doap/licenses/asl20" />
|
||||
<name>Apache AntUnit</name>
|
||||
<homepage rdf:resource="http://ant.apache.org/antlibs/antunit/" />
|
||||
<asfext:pmc rdf:resource="http://ant.apache.org/" />
|
||||
<shortdesc>Test-Framework for Testing Ant Tasks and Types</shortdesc>
|
||||
<description>The Ant Library provides Ant tasks for testing Ant
|
||||
task, it can also be used to drive functional and integration tests
|
||||
of arbitrary applications with Ant.</description>
|
||||
<bug-database rdf:resource="http://issues.apache.org/bugzilla/buglist.cgi?product=Ant" />
|
||||
<mailing-list rdf:resource="http://ant.apache.org/mail.html" />
|
||||
<download-page rdf:resource="http://ant.apache.org/antlibs/bindownload.cgi" />
|
||||
<programming-language>Java</programming-language>
|
||||
<category rdf:resource="http://projects.apache.org/category/build-management" />
|
||||
<category rdf:resource="http://projects.apache.org/category/testing"/>
|
||||
<release>
|
||||
<Version>
|
||||
<name>Apache AntUnit 1.1</name>
|
||||
<created>2008-09-26</created>
|
||||
<revision>1.1</revision>
|
||||
</Version>
|
||||
</release>
|
||||
<release>
|
||||
<Version>
|
||||
<name>Apache AntUnit 1.0</name>
|
||||
<created>2007-01-08</created>
|
||||
<revision>1.0</revision>
|
||||
</Version>
|
||||
</release>
|
||||
<repository>
|
||||
<SVNRepository>
|
||||
<location rdf:resource="http://svn.apache.org/repos/asf/ant/antlibs/antunit"/>
|
||||
<browse rdf:resource="http://svn.apache.org/viewcvs.cgi/ant/antlibs/antunit"/>
|
||||
</SVNRepository>
|
||||
</repository>
|
||||
</Project>
|
||||
</rdf:RDF>
|
||||
|
|
@ -7,7 +7,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
@ -79,7 +79,7 @@ under the License.
|
|||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* 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
|
||||
|
|
@ -145,14 +145,6 @@ public class LogCapturer {
|
|||
attribute is set to false.</td>
|
||||
<td align="center">No.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">classpathrefid</td>
|
||||
<td valign="top">Specify the classpath to use when running the
|
||||
tests - specified as a reference to an existing path.<br/>
|
||||
<em>since AntUnit 1.5</em>
|
||||
</td>
|
||||
<td align="center">No.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3>Parameters specified as nested elements</h3>
|
||||
|
|
@ -166,23 +158,17 @@ public class LogCapturer {
|
|||
|
||||
<p>Creates a test listener that gets attached to the task.</p>
|
||||
|
||||
<p>Some listeners are part of this antlib:</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="plainlistener.html"><plainlistener/></a>
|
||||
creates reports similar to the "plain" <formatter> of the
|
||||
<junit> task.</li>
|
||||
<li><a href="xmllistener.html"><xmllistener/></a> is similar
|
||||
to the "xml" <formatter>.</li>
|
||||
<li><a href="logforwarder.html"><logforwarder/></a>
|
||||
forwards log output from the project under test to the project
|
||||
executing the antunit task.</li>
|
||||
</ul>
|
||||
<p>Two listeners are part of this antlib <a
|
||||
href="plainlistener.html"><plainlistener/></a> which
|
||||
creates reports similar to the "plain" <formatter> of the
|
||||
<junit> task and <a
|
||||
href="xmllistener.html"><xmllistener/></a> which is similar
|
||||
to the "xml" <formatter>.</p>
|
||||
|
||||
<h4>propertyset</h4>
|
||||
|
||||
<p><a
|
||||
href="https://ant.apache.org/manual/Types/propertyset.html"><propertyset></a>s
|
||||
href="http://ant.apache.org/manual/CoreTypes/propertyset.html"><propertyset></a>s
|
||||
can be used to pass properties to the build files under test.</p>
|
||||
|
||||
<h4>reference</h4>
|
||||
|
|
@ -218,7 +204,7 @@ public class LogCapturer {
|
|||
<a name="referenceset"/><h4>referenceset</h4>
|
||||
|
||||
<p>References can be grouped inside a <referenceset> element for clarity. Additionally, <referenceset>
|
||||
elements may contain exactly one nested <a href="https://ant.apache.org/manual/CoreTypes/mapper.html"><mapper></a>
|
||||
elements may contain exactly one nested <a href="http://ant.apache.org/manual/CoreTypes/mapper.html"><mapper></a>
|
||||
element, which defines how source reference IDs are translated into target reference IDs. For example,
|
||||
|
||||
<pre>
|
||||
|
|
@ -232,12 +218,6 @@ public class LogCapturer {
|
|||
</pre>
|
||||
</p>
|
||||
|
||||
<h4>classpath</h4>
|
||||
|
||||
<p>Nested path-like structure. Specifies the classpath to use
|
||||
when running the tests. Requires Ant 1.10.13 or later to work
|
||||
properly. <em>since AntUnit 1.5</em>.</p>
|
||||
|
||||
<h3>Examples</h3>
|
||||
|
||||
<p>This build file snippet (from src/etc/testcases/antunit/base.xml)</p>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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,
|
||||
|
|
@ -62,7 +62,7 @@
|
|||
<not>
|
||||
<equals arg1="${foo}" arg2="bar"/>
|
||||
</not>
|
||||
</assertTrue>
|
||||
</assertTrue message="foo is bar">
|
||||
</pre>
|
||||
|
||||
<hr/>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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,
|
||||
|
|
@ -89,54 +89,7 @@
|
|||
|
||||
<pre>
|
||||
<assertEquals message="foo is not bar" expected="bar"
|
||||
actual="${foo}" casesensitive="false"/>
|
||||
</pre>
|
||||
|
||||
<h2><a name="assertNotEquals">assertNotEquals</a></h2>
|
||||
|
||||
<p>Asserts that its two arguments are not equal.</p>
|
||||
|
||||
<p><em>Since AntUnit 1.5</em></p>
|
||||
|
||||
<table border="1" cellpadding="2" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top"><b>Attribute</b></td>
|
||||
<td valign="top"><b>Description</b></td>
|
||||
<td align="center" valign="top"><b>Required</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">notExpected</td>
|
||||
<td valign="top">First string to test.</td>
|
||||
<td valign="top" align="center">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">actual</td>
|
||||
<td valign="top">Second string to test.</td>
|
||||
<td valign="top" align="center">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">message</td>
|
||||
<td valign="top">Message for the exception if the condition
|
||||
doesn't hold true. Defaults to "Didn't expect
|
||||
'<em>notExpected</em>' to be '<em>actual</em>'".</td>
|
||||
<td align="center">No.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">casesensitive</td>
|
||||
<td valign="top">Perform a case sensitive comparision.
|
||||
Default is true.</td>
|
||||
<td valign="top" align="center">No</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3>Examples</h3>
|
||||
|
||||
<p>Make the build fail with the message "foo is bar" if the
|
||||
property foo doesn't hold the value bar regardless of case:</p>
|
||||
|
||||
<pre>
|
||||
<assertNotEquals message="foo is bar" notExpected="bar"
|
||||
actual="${foo}" casesensitive="false"/>
|
||||
actual="${foo}" casesensitive="false"/>
|
||||
</pre>
|
||||
|
||||
<h2><a name="assertPropertySet">assertPropertySet</a></h2>
|
||||
|
|
@ -172,42 +125,6 @@
|
|||
<assertPropertySet name="foo"/>
|
||||
</pre>
|
||||
|
||||
<h2><a name="assertPropertyNotSet">assertPropertyNotSet</a></h2>
|
||||
|
||||
<p><em>Since AntUnit 1.5</em></p>
|
||||
|
||||
<p>Asserts that a property hasn't got a value.</p>
|
||||
|
||||
<table border="1" cellpadding="2" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top"><b>Attribute</b></td>
|
||||
<td valign="top"><b>Description</b></td>
|
||||
<td align="center" valign="top"><b>Required</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">name</td>
|
||||
<td valign="top">Name of the property.</td>
|
||||
<td valign="top" align="center">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">message</td>
|
||||
<td valign="top">Message for the exception if the condition
|
||||
doesn't hold true. Defaults to "Didn't expect property
|
||||
'<em>name</em>' to be set but was '<em>actual value</em>'".</td>
|
||||
<td align="center">No.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3>Examples</h3>
|
||||
|
||||
<p>Make the build fail with the message "Didn't expect property
|
||||
'foo' but was 'bar'" if the property foo is defined and has
|
||||
value bar:</p>
|
||||
|
||||
<pre>
|
||||
<assertPropertyNotSet name="foo"/>
|
||||
</pre>
|
||||
|
||||
<h2><a name="assertPropertyEquals">assertPropertyEquals</a></h2>
|
||||
|
||||
<p>Asserts that a given property is set and holds a certain
|
||||
|
|
@ -252,54 +169,7 @@
|
|||
|
||||
<pre>
|
||||
<assertPropertyEquals message="foo is not bar" value="bar"
|
||||
name="foo" casesensitive="false"/>
|
||||
</pre>
|
||||
|
||||
<h2><a name="assertPropertyNotEquals">assertPropertyNotEquals</a></h2>
|
||||
|
||||
<p><em>Since AntUnit 1.5</em></p>
|
||||
|
||||
<p>Asserts that a given property is set but doesn't hold a certain
|
||||
value.</p>
|
||||
|
||||
<table border="1" cellpadding="2" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top"><b>Attribute</b></td>
|
||||
<td valign="top"><b>Description</b></td>
|
||||
<td align="center" valign="top"><b>Required</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">name</td>
|
||||
<td valign="top">Name of the property.</td>
|
||||
<td valign="top" align="center">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">value</td>
|
||||
<td valign="top">Not expected value.</td>
|
||||
<td valign="top" align="center">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">message</td>
|
||||
<td valign="top">Message for the exception if the condition
|
||||
doesn't hold true. Defaults to "Didn't expect property '<em>name</em>' to have value '<em>value</em>'".</td>
|
||||
<td align="center">No.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">casesensitive</td>
|
||||
<td valign="top">Perform a case sensitive comparision.
|
||||
Default is true.</td>
|
||||
<td valign="top" align="center">No</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3>Examples</h3>
|
||||
|
||||
<p>Make the build fail with the message "foo is bar" if the
|
||||
property foo holds the value bar regardless of case:</p>
|
||||
|
||||
<pre>
|
||||
<assertPropertyNotEquals message="foo is bar" value="bar"
|
||||
name="foo" casesensitive="false"/>
|
||||
name="foo" casesensitive="false"/>
|
||||
</pre>
|
||||
|
||||
<h2><a name="assertPropertyContains">assertPropertyContains</a></h2>
|
||||
|
|
@ -349,55 +219,6 @@
|
|||
name="foo" casesensitive="false"/>
|
||||
</pre>
|
||||
|
||||
<h2><a name="assertPropertyDoesntContain">assertPropertyDoesntContain</a></h2>
|
||||
|
||||
<p>Asserts that a given property is set and doesn't hold a certain
|
||||
value as substring.</p>
|
||||
|
||||
<p><em>Since AntUnit 1.5</em></p>
|
||||
|
||||
<table border="1" cellpadding="2" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top"><b>Attribute</b></td>
|
||||
<td valign="top"><b>Description</b></td>
|
||||
<td align="center" valign="top"><b>Required</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">name</td>
|
||||
<td valign="top">Name of the property.</td>
|
||||
<td valign="top" align="center">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">value</td>
|
||||
<td valign="top">Not expected substring value.</td>
|
||||
<td valign="top" align="center">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">message</td>
|
||||
<td valign="top">Message for the exception if the condition
|
||||
doesn't hold true. Defaults to "Didn't expect property
|
||||
'<em>name</em>' to contain value '<em>value</em>' but was
|
||||
'<em>value of property name</em>'".</td>
|
||||
<td align="center">No.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">casesensitive</td>
|
||||
<td valign="top">Perform a case sensitive comparision.
|
||||
Default is true.</td>
|
||||
<td valign="top" align="center">No</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3>Examples</h3>
|
||||
|
||||
<p>Make the build fail with the message "foo contains bar" if the
|
||||
property foo contains the value bar regardless of case:</p>
|
||||
|
||||
<pre>
|
||||
<assertPropertyDoesntContain message="foo contains bar" value="bar"
|
||||
name="foo" casesensitive="false"/>
|
||||
</pre>
|
||||
|
||||
<h2><a name="assertFileExists">assertFileExists</a></h2>
|
||||
|
||||
<p>Asserts that a given file exists.</p>
|
||||
|
|
@ -468,12 +289,9 @@
|
|||
|
||||
<p><em>Since AntUnit 1.2</em></p>
|
||||
|
||||
<p>Asserts that a given resource exists. This was intended as a
|
||||
generalization of <code>assertFileExists</code> but still really
|
||||
only works for file resources.
|
||||
Use <code>assertNestedResourceExists</code>
|
||||
or <code>assertRefResourceExists</code> for non-filesystem
|
||||
resources.</p>
|
||||
<p>Asserts that a given resource exists. This is a
|
||||
generalization of assertFileExists and allows to test for
|
||||
arbitrary resources.</p>
|
||||
|
||||
<table border="1" cellpadding="2" cellspacing="0">
|
||||
<tr>
|
||||
|
|
@ -504,84 +322,13 @@
|
|||
<assertResourceExists resource="${ant.home}/lib/ant.jar"/>
|
||||
</pre>
|
||||
|
||||
<h2><a name="assertRefResourceExists">assertRefResourceExists</a></h2>
|
||||
|
||||
<p><em>Since AntUnit 1.3</em></p>
|
||||
|
||||
<p>Asserts that a resource given by its id exists.</p>
|
||||
|
||||
<table border="1" cellpadding="2" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top"><b>Attribute</b></td>
|
||||
<td valign="top"><b>Description</b></td>
|
||||
<td align="center" valign="top"><b>Required</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">refid</td>
|
||||
<td valign="top">Reference to a resource defined inside the project.</td>
|
||||
<td valign="top" align="center">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">message</td>
|
||||
<td valign="top">Message for the exception if the condition
|
||||
doesn't hold true. Defaults to "Expected
|
||||
resource '<em>refid</em>' to exist".</td>
|
||||
<td align="center">No.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3>Examples</h3>
|
||||
|
||||
<p>Make the build fail if the resource ${ant.home}/lib/ant.jar doesn't
|
||||
exist:</p>
|
||||
|
||||
<pre>
|
||||
<file file="${ant.home}/lib/ant.jar" id="ant.jar"/>
|
||||
<assertRefResourceExists refid="ant.jar"/>
|
||||
</pre>
|
||||
|
||||
<h2><a name="assertNestedResourceExists">assertNestedResourceExists</a></h2>
|
||||
|
||||
<p><em>Since AntUnit 1.3</em></p>
|
||||
|
||||
<p>Asserts that a resource given as nested element exists.</p>
|
||||
|
||||
<table border="1" cellpadding="2" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top"><b>Attribute</b></td>
|
||||
<td valign="top"><b>Description</b></td>
|
||||
<td align="center" valign="top"><b>Required</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">message</td>
|
||||
<td valign="top">Message for the exception if the condition
|
||||
doesn't hold true. Defaults to "Expected resource to exist".</td>
|
||||
<td align="center">No.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3>Examples</h3>
|
||||
|
||||
<p>Make the build fail if the resource ${ant.home}/lib/ant.jar doesn't
|
||||
exist:</p>
|
||||
|
||||
<pre>
|
||||
<assertNestedResourceExists>
|
||||
<file file="${ant.home}/lib/ant.jar"/>
|
||||
</assertNestedResourceExists>
|
||||
</pre>
|
||||
|
||||
<h2><a name="assertResourceDoesntExist">assertResourceDoesntExist</a></h2>
|
||||
|
||||
<p><em>Since AntUnit 1.2</em></p>
|
||||
|
||||
<p>Asserts that a given resource does not exist. This was
|
||||
intended as a generalization
|
||||
of <code>assertFileDoesntExist</code> but still really only
|
||||
works for file resources.
|
||||
Use <code>assertNestedResourceDoesntExist</code>
|
||||
or <code>assertRefResourceDoesntExist</code> for non-filesystem
|
||||
resources.</p>
|
||||
<p>Asserts that a given resource does not exist. This is a
|
||||
generalization of assertFileDoesntExist and allows to test for
|
||||
arbitrary resources.</p>
|
||||
|
||||
<table border="1" cellpadding="2" cellspacing="0">
|
||||
<tr>
|
||||
|
|
@ -612,74 +359,6 @@
|
|||
<assertResourceDoesntExist resource="${ant.home}/lib/ant.jar"/>
|
||||
</pre>
|
||||
|
||||
<h2><a name="assertRefResourceDoesntExist">assertRefResourceDoesntExist</a></h2>
|
||||
|
||||
<p><em>Since AntUnit 1.3</em></p>
|
||||
|
||||
<p>Asserts that a resource given by its id exists.</p>
|
||||
|
||||
<table border="1" cellpadding="2" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top"><b>Attribute</b></td>
|
||||
<td valign="top"><b>Description</b></td>
|
||||
<td align="center" valign="top"><b>Required</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">refid</td>
|
||||
<td valign="top">Reference to a resource defined inside the project.</td>
|
||||
<td valign="top" align="center">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">message</td>
|
||||
<td valign="top">Message for the exception if the condition
|
||||
doesn't hold true. Defaults to "Didn't expect
|
||||
resource '<em>refid</em>' to exist".</td>
|
||||
<td align="center">No.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3>Examples</h3>
|
||||
|
||||
<p>Make the build fail if the resource ${ant.home}/lib/ant.jar
|
||||
exists:</p>
|
||||
|
||||
<pre>
|
||||
<file file="${ant.home}/lib/ant.jar" id="ant.jar"/>
|
||||
<assertRefResourceDoesntExist refid="ant.jar"/>
|
||||
</pre>
|
||||
|
||||
<h2><a name="assertNestedResourceDoesntExist">assertNestedResourceDoesntExist</a></h2>
|
||||
|
||||
<p><em>Since AntUnit 1.3</em></p>
|
||||
|
||||
<p>Asserts that a resource given as nested element exists.</p>
|
||||
|
||||
<table border="1" cellpadding="2" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top"><b>Attribute</b></td>
|
||||
<td valign="top"><b>Description</b></td>
|
||||
<td align="center" valign="top"><b>Required</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">message</td>
|
||||
<td valign="top">Message for the exception if the condition
|
||||
doesn't hold true. Defaults to "Didn't expect
|
||||
resource to exist".</td>
|
||||
<td align="center">No.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3>Examples</h3>
|
||||
|
||||
<p>Make the build fail if the resource ${ant.home}/lib/ant.jar
|
||||
exists:</p>
|
||||
|
||||
<pre>
|
||||
<assertNestedResourceDoesntExist>
|
||||
<file file="${ant.home}/lib/ant.jar"/>
|
||||
</assertNestedResourceDoesntExist>
|
||||
</pre>
|
||||
|
||||
<h2><a name="assertDestIsUptodate">assertDestIsUptodate</a></h2>
|
||||
|
||||
<p>Asserts that a dest file is more recent than the source
|
||||
|
|
@ -786,7 +465,7 @@
|
|||
<td align="center">No.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<h3>Example</h3>
|
||||
|
||||
<p>Make the build fail if the file build.xml and backups/build.xml
|
||||
|
|
@ -824,7 +503,7 @@
|
|||
<td align="center">No.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<h3>Example</h3>
|
||||
|
||||
<p>Make the build fail if the file build.xml and backups/build.xml
|
||||
|
|
@ -867,41 +546,6 @@
|
|||
<assertReferenceSet name="foo"/>
|
||||
</pre>
|
||||
|
||||
<h2><a name="assertReferenceIsNotSet">assertReferenceIsNotSet</a></h2>
|
||||
|
||||
<p>Asserts that a reference hasn't got any value.</p>
|
||||
|
||||
<p><em>Since AntUnit 1.5</em></p>
|
||||
|
||||
<table border="1" cellpadding="2" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top"><b>Attribute</b></td>
|
||||
<td valign="top"><b>Description</b></td>
|
||||
<td align="center" valign="top"><b>Required</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">refid</td>
|
||||
<td valign="top">Id of the reference.</td>
|
||||
<td valign="top" align="center">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">message</td>
|
||||
<td valign="top">Message for the exception if the condition
|
||||
doesn't hold true. Defaults to "Didn't expect reference
|
||||
'<em>id</em>'".</td>
|
||||
<td align="center">No.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3>Examples</h3>
|
||||
|
||||
<p>Make the build fail with the message "Didn't expect reference 'foo'"
|
||||
if the reference foo is defined:</p>
|
||||
|
||||
<pre>
|
||||
<assertReferenceIsNotSet name="foo"/>
|
||||
</pre>
|
||||
|
||||
<h2><a name="assertReferenceIsType">assertReferenceIsType</a></h2>
|
||||
|
||||
<p>Asserts that a reference has a value of a given type.</p>
|
||||
|
|
@ -1082,14 +726,6 @@
|
|||
levels. One of "error", "warning", "info", "verbose", "debug".</td>
|
||||
<td valign="top" align="center">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">mergeLines</td>
|
||||
<td valign="top">Whether to merge messages into a single
|
||||
line or split them into multiple lines. <em>since AntUnit
|
||||
1.3</em></td>
|
||||
<td valign="top" align="center">No, defaults
|
||||
to <code>true</code></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h2><a name="assertLogDoesntContain">assertLogDoesntContain</a></h2>
|
||||
|
|
@ -1116,61 +752,10 @@
|
|||
levels. One of "error", "warning", "info", "verbose", "debug".</td>
|
||||
<td valign="top" align="center">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">mergeLines</td>
|
||||
<td valign="top">Whether to merge messages into a single
|
||||
line or split them into multiple lines. <em>since AntUnit
|
||||
1.3</em></td>
|
||||
<td valign="top" align="center">No, defaults
|
||||
to <code>true</code></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h2><a name="assertResourceContains">assertResourceContains</a></h2>
|
||||
|
||||
<p>Asserts that a resource's content includes a given string.
|
||||
This task anly really works for filesystem resources.
|
||||
Use <code>assertRefResourceContains</code> when using non-file
|
||||
resources.</p>
|
||||
|
||||
<table border="1" cellpadding="2" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top"><b>Attribute</b></td>
|
||||
<td valign="top"><b>Description</b></td>
|
||||
<td align="center" valign="top"><b>Required</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">resource</td>
|
||||
<td valign="top">Location of the resource to load.</td>
|
||||
<td valign="top" align="center">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">value</td>
|
||||
<td valign="top">The text to search for.</td>
|
||||
<td valign="top" align="center">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">casesensitive</td>
|
||||
<td valign="top">
|
||||
Perform a case sensitive match.
|
||||
Default is true.
|
||||
</td>
|
||||
<td align="center">No.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">message</td>
|
||||
<td valign="top">Message for the exception if the condition
|
||||
doesn't hold true. Defaults to "Expected resource
|
||||
'<em>resource</em>' to contain value '<em>value</em>' but
|
||||
was '<em>content of resource</em>'".</td>
|
||||
<td align="center">No.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h2><a name="assertRefResourceContains">assertRefResourceContains</a></h2>
|
||||
|
||||
<p><em>Since AntUnit 1.3</em></p>
|
||||
|
||||
<p>Asserts that a resource's content includes a given string.</p>
|
||||
|
||||
<table border="1" cellpadding="2" cellspacing="0">
|
||||
|
|
@ -1180,8 +765,8 @@
|
|||
<td align="center" valign="top"><b>Required</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">refid</td>
|
||||
<td valign="top">Reference to a resource defined inside the project.</td>
|
||||
<td valign="top">resource</td>
|
||||
<td valign="top">Location of the resource to load.</td>
|
||||
<td valign="top" align="center">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -1201,17 +786,15 @@
|
|||
<td valign="top">message</td>
|
||||
<td valign="top">Message for the exception if the condition
|
||||
doesn't hold true. Defaults to "Expected resource
|
||||
'<em>refeid</em>' to contain value '<em>value</em>'."</td>
|
||||
'<em>resource</em>' to contain value '<em>value</em>' but
|
||||
was '<em>content of resource</em>'".</td>
|
||||
<td align="center">No.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h2><a name="assertResourceDoesntContain">assertResourceDoesntContain</a></h2>
|
||||
|
||||
<p>Asserts that a resource's content doesn't include a given string.
|
||||
This task anly really works for filesystem resources.
|
||||
Use <code>assertRefResourceDoesntContain</code> when using non-file
|
||||
resources.</p>
|
||||
<p>Asserts that a resource's content doesn't include a given string.</p>
|
||||
|
||||
<table border="1" cellpadding="2" cellspacing="0">
|
||||
<tr>
|
||||
|
|
@ -1247,45 +830,6 @@
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
<h2><a name="assertRefResourceDoesntContain">assertRefResourceDoesntContain</a></h2>
|
||||
|
||||
<p><em>Since AntUnit 1.3</em></p>
|
||||
|
||||
<p>Asserts that a resource's content doesn't include a given string.</p>
|
||||
|
||||
<table border="1" cellpadding="2" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top"><b>Attribute</b></td>
|
||||
<td valign="top"><b>Description</b></td>
|
||||
<td align="center" valign="top"><b>Required</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">refid</td>
|
||||
<td valign="top">Reference to a resource defined inside the project.</td>
|
||||
<td valign="top" align="center">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">value</td>
|
||||
<td valign="top">The text to search for.</td>
|
||||
<td valign="top" align="center">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">casesensitive</td>
|
||||
<td valign="top">
|
||||
Perform a case sensitive match.
|
||||
Default is true.
|
||||
</td>
|
||||
<td align="center">No.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">message</td>
|
||||
<td valign="top">Message for the exception if the condition
|
||||
doesn't hold true. Defaults to "Didn't expect resource
|
||||
'<em>refid</em>' to contain value '<em>value</em>'".</td>
|
||||
<td align="center">No.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<hr/>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -1,61 +1,61 @@
|
|||
<!--
|
||||
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
|
||||
|
||||
https://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.
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Language" content="en-us"></meta>
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
<title>XMLListener AntUnit Listener</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h2><a name="xmllistener">Failure AntUnit Listener</a></h2>
|
||||
|
||||
<h3>Description</h3>
|
||||
|
||||
<p>Writes reports similar to the "failure" JUnit formatter.</p><p>This AntUnitListener creates a new buildfile with a target for each failed test target in the AntUnit run. The generated target calls the failed target (with setUp and tearDown if present in the called project). <br></p><p>This is intended for rerunning just failed tests.<br></p>
|
||||
|
||||
|
||||
|
||||
<h3>Parameters</h3>
|
||||
<table border="1" cellpadding="2" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top"><b>Attribute</b></td>
|
||||
<td valign="top"><b>Description</b></td>
|
||||
<td align="center" valign="top"><b>Required</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">file</td>
|
||||
<td valign="top">Where to write the generated buildfile.<br></td>
|
||||
<td align="center">Yes.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3>Examples</h3>
|
||||
|
||||
<pre> <br> <au:antunit>
|
||||
<fileset dir="${tests}" includes="*.xml"/>
|
||||
<au:failurelistener file="${build.dir}/failed-tests/failed.xml"/>
|
||||
</au:antunit> <br>
|
||||
</pre>
|
||||
|
||||
<p>Runs AntUnit on all XML files in the directory
|
||||
<code>${tests}</code> and collecting all failed tests. If there was a failure the file <code>${build.dir}/failed-tests/failed.xml</code> is created and has a <em>textXXX </em>target for each failed test. Additionally it has a default target <em>antunit</em> which runs all these failed tests.<br> </p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Language" content="en-us"></meta>
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
<title>XMLListener AntUnit Listener</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h2><a name="xmllistener">Failure AntUnit Listener</a></h2>
|
||||
|
||||
<h3>Description</h3>
|
||||
|
||||
<p>Writes reports similar to the "failure" JUnit formatter.</p><p>This AntUnitListener creates a new buildfile with a target for each failed test target in the AntUnit run. The generated target calls the failed target (with setUp and tearDown if present in the called project). <br></p><p>This is intended for rerunning just failed tests.<br></p>
|
||||
|
||||
|
||||
|
||||
<h3>Parameters</h3>
|
||||
<table border="1" cellpadding="2" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top"><b>Attribute</b></td>
|
||||
<td valign="top"><b>Description</b></td>
|
||||
<td align="center" valign="top"><b>Required</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">file</td>
|
||||
<td valign="top">Where to write the generated buildfile.<br></td>
|
||||
<td align="center">Yes.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3>Examples</h3>
|
||||
|
||||
<pre> <br> <au:antunit>
|
||||
<fileset dir="${tests}" includes="*.xml"/>
|
||||
<au:failurelistener file="${build.dir}/failed-tests/failed.xml"/>
|
||||
</au:antunit> <br>
|
||||
</pre>
|
||||
|
||||
<p>Runs AntUnit on all XML files in the directory
|
||||
<code>${tests}</code> and collecting all failed tests. If there was a failure the file <code>${build.dir}/failed-tests/failed.xml</code> is created and has a <em>textXXX </em>target for each failed test. Additionally it has a default target <em>antunit</em> which runs all these failed tests.<br> </p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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,
|
||||
|
|
@ -29,13 +29,13 @@
|
|||
|
||||
<h2>Requirements</h2>
|
||||
|
||||
<p>The current version requires Ant 1.8.1 or later.</p>
|
||||
<p>The current version requires Ant 1.7.0 or later.</p>
|
||||
|
||||
<h2>Where is it?</h2>
|
||||
|
||||
<p>The source code for the library lives in the
|
||||
ant-antlibs-antunit git repository - <a
|
||||
href="https://gitbox.apache.org/repos/asf?p=ant-antlibs-antunit.git">https://gitbox.apache.org/repos/asf/ant-antlibs-antunit.git</a>.</p>
|
||||
antlibs subspace of Ant's SVN - <a
|
||||
href="http://svn.apache.org/viewcvs.cgi/ant/antlibs/antunit/trunk/">http://svn.apache.org/viewcvs.cgi/ant/antlibs/antunit/trunk/</a>.</p>
|
||||
|
||||
<h2>Installation</h2>
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
@ -49,14 +49,6 @@ under the License.
|
|||
Defaults to "info".</td>
|
||||
<td align="center">No.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">mergeLines</td>
|
||||
<td valign="top">Whether to merge messages into a single line
|
||||
or split them into multiple lines. <em>since AntUnit
|
||||
1.3</em></td>
|
||||
<td valign="top" align="center">No, defaults
|
||||
to <code>true</code></td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,39 +0,0 @@
|
|||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
https://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.
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Language" content="en-us"></meta>
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
<title>LogForwarder AntUnit Listener</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h2><a name="logforwarder">LogForwarder</a></h2>
|
||||
|
||||
<h3>Description</h3>
|
||||
|
||||
<p>Forwards any log output from the project under test to the
|
||||
project running the AntUnit task immediately. This is different
|
||||
from - for example - the plain listener which buffers the
|
||||
log output and emits it after the test has finished.</p>
|
||||
|
||||
<p>This listener can be used to debug failing tests more easily or
|
||||
monitor tests in real time.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -7,7 +7,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
|
|||
68
ivy.xml
68
ivy.xml
|
|
@ -1,68 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
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
|
||||
|
||||
https://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.
|
||||
|
||||
-->
|
||||
<ivy-module version="2.0">
|
||||
<info organisation="org.apache.ant"
|
||||
module="${artifact.name}"
|
||||
revision="${artifact.version}"
|
||||
publication="${artifact.publication.datetime}">
|
||||
<license name="Apache Software License 2.0"
|
||||
url="https://www.apache.org/licenses/LICENSE-2.0"/>
|
||||
<ivyauthor name="Apache Ant Development Team"
|
||||
url="https://ant.apache.org/"/>
|
||||
<description homepage="https://ant.apache.org/antlibs/antunit/">
|
||||
This library contains tasks that enables Ant task developers to test
|
||||
their tasks with Ant and without JUnit. It contains a few assertion
|
||||
tasks and an antunit task that runs build files instead of test
|
||||
classes and is modelled after the JUnit task.
|
||||
</description>
|
||||
</info>
|
||||
<configurations>
|
||||
<conf name="default" description="full antlib with all dependencies"/>
|
||||
<conf name="provided" description="Ant must be present at runtime"/>
|
||||
<conf name="test" description="dependencies used for JUnit tests of the antlib" transitive="false" visibility="private"/>
|
||||
</configurations>
|
||||
<publications xmlns:e="urn:ant.apache.org:ivy-extras">
|
||||
<artifact name="${artifact.name}" type="pom" ext="pom"/>
|
||||
<artifact name="${artifact.name}" type="pom.asc" ext="pom.asc"/>
|
||||
<artifact name="${artifact.name}" type="jar" ext="jar"/>
|
||||
<artifact name="${artifact.name}" type="jar.asc" ext="jar.asc"/>
|
||||
<artifact name="${artifact.name}" type="source" ext="jar"
|
||||
e:classifier="sources"/>
|
||||
<artifact name="${artifact.name}" type="source.asc" ext="jar.asc"
|
||||
e:classifier="sources"/>
|
||||
<artifact name="${artifact.name}" type="javadoc" ext="jar"
|
||||
e:classifier="javadoc"/>
|
||||
<artifact name="${artifact.name}" type="javadoc.asc" ext="jar.asc"
|
||||
e:classifier="javadoc"/>
|
||||
<artifact name="${artifact.name}" type="ivy" ext="xml"
|
||||
e:classifier="ivy"/>
|
||||
<artifact name="${artifact.name}" type="ivy.asc" ext="xml.asc"
|
||||
e:classifier="ivy"/>
|
||||
<artifact name="${artifact.name}" type="cyclonedx.xml" ext="cdx.xml"/>
|
||||
<artifact name="${artifact.name}" type="cyclonedx.xml.asc" ext="cdx.xml.asc"/>
|
||||
<artifact name="${artifact.name}" type="cyclonedx.json" ext="cdx.json"/>
|
||||
<artifact name="${artifact.name}" type="cyclonedx.json.asc" ext="cdx.json.asc"/>
|
||||
</publications>
|
||||
<dependencies>
|
||||
<dependency org="junit" name="junit" rev="4.13.2" conf="default"/>
|
||||
<dependency org="org.apache.ant" name="ant" rev="1.10.13" conf="provided->default"/>
|
||||
<dependency org="org.apache.ant" name="ant-testutil" rev="1.10.13" conf="test->default"/>
|
||||
</dependencies>
|
||||
</ivy-module>
|
||||
65
prepare.xml
65
prepare.xml
|
|
@ -1,65 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
https://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.
|
||||
-->
|
||||
|
||||
<!--
|
||||
Interim build-snippet.
|
||||
|
||||
The original of this snippet is maintained in the antlib-common project.
|
||||
-->
|
||||
<project default="bootstrap" xmlns:unless="ant:unless" xmlns:if="ant:if">
|
||||
|
||||
<!-- Which released version of AntUnit to use, where to download, where to store. -->
|
||||
<property name="antunit.version" value="1.3"/>
|
||||
<property name="antunit.url" value="https://repo1.maven.org/maven2/org/apache/ant/ant-antunit/${antunit.version}/ant-antunit-${antunit.version}.jar"/>
|
||||
<property name="antunit.file" value="ant-antunit.jar"/>
|
||||
|
||||
<!-- Skip unnecessary tasks. -->
|
||||
<available property="antunit.present" file="${antunit.file}"/>
|
||||
|
||||
<target name="update-prepare-script">
|
||||
<echo>updating prepare.xml</echo>
|
||||
<copy file="common/prepare.xml" tofile="prepare.xml"/>
|
||||
</target>
|
||||
|
||||
<target name="get-antunit" unless="antunit.present">
|
||||
<echo>updating AntUnit</echo>
|
||||
<get src="${antunit.url}" dest="${antunit.file}" usetimestamp="true"/>
|
||||
</target>
|
||||
|
||||
|
||||
<!-- Use a 'bootstrap-phase' so changes of the preparation could be catched in the same CI-cycle. -->
|
||||
<target name="bootstrap"
|
||||
depends="update-prepare-script"
|
||||
description="Bootstraps the preparation script by updating this script from common."
|
||||
>
|
||||
<echo>Bootstrap done. Next step:</echo>
|
||||
<echo> ant -f prepare.xml prepare</echo>
|
||||
</target>
|
||||
|
||||
<target name="prepare"
|
||||
depends="get-antunit"
|
||||
description="Prepare the build by 'preparing' the infrastructure"
|
||||
>
|
||||
<echo>Preparation done. Next steps:</echo>
|
||||
<echo> ant clean distribution</echo>
|
||||
<echo> ant -lib ${antunit.file} -lib build/lib test</echo>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
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
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
<!--
|
||||
This POM has been created manually by the Ant Development Team. Please
|
||||
contact us if you are not satisfied with the data contained in this
|
||||
POM . URL : https://ant.apache.org
|
||||
POM . URL : http://ant.apache.org
|
||||
-->
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
|
@ -25,28 +25,22 @@
|
|||
<artifactId>ant-antunit</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>${artifact.version}</version>
|
||||
<description>
|
||||
This library contains tasks that enables Ant task developers to test
|
||||
their tasks with Ant and without JUnit. It contains a few assertion
|
||||
tasks and an antunit task that runs build files instead of test
|
||||
classes and is modelled after the JUnit task.
|
||||
</description>
|
||||
<licenses>
|
||||
<license>
|
||||
<name>The Apache Software License, Version 2.0</name>
|
||||
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
<organization>
|
||||
<name>The Apache Software Foundation</name>
|
||||
<url>https://www.apache.org/</url>
|
||||
<url>http://www.apache.org/</url>
|
||||
</organization>
|
||||
|
||||
<!--
|
||||
Test doesn't work from maven, you have to fight with tricky classpath
|
||||
issue to solve that See https://markmail.org/thread/6giwzqproxidcwyc
|
||||
And https://markmail.org/thread/5bbknx6hm7liqvi6 (until it is solved, I
|
||||
issue to solve that See http://markmail.org/thread/6giwzqproxidcwyc
|
||||
And http://markmail.org/thread/5bbknx6hm7liqvi6 (until it is solved, I
|
||||
comment test setting)
|
||||
-->
|
||||
<properties>
|
||||
|
|
@ -81,7 +75,7 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.ant</groupId>
|
||||
<artifactId>ant</artifactId>
|
||||
<version>1.10.13</version>
|
||||
<version>1.7.1</version>
|
||||
<scope>compile</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
|
|
@ -92,22 +86,23 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.13.2</version>
|
||||
<artifactId>junit-dep</artifactId>
|
||||
<version>4.4</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.ant</groupId>
|
||||
<artifactId>ant-launcher</artifactId>
|
||||
<version>1.10.13</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.ant</groupId>
|
||||
<artifactId>ant-testutil</artifactId>
|
||||
<version>1.10.13</version>
|
||||
<scope>test</scope>
|
||||
<version>1.7.1</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
<dependency> <groupId>org.apache.ant</groupId>
|
||||
<artifactId>ant-testutil</artifactId> <version>1.7.1</version>
|
||||
<scope>test</scope> </dependency>
|
||||
-->
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
@ -709,7 +709,7 @@ h6 {
|
|||
<table width="100%">
|
||||
<tr>
|
||||
<td align="left"></td>
|
||||
<td align="right">Designed for use with <a href="https://ant.apache.org/antlibs/antunit/">AntUnit</a> and <a href="https://ant.apache.org/">Ant</a>.</td>
|
||||
<td align="right">Designed for use with <a href="http://ant.apache.org/antlibs/antunit/">AntUnit</a> and <a href="http://ant.apache.org/">Ant</a>.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr size="1"/>
|
||||
|
|
@ -888,24 +888,7 @@ h6 {
|
|||
-->
|
||||
<xsl:template name="br-replace">
|
||||
<xsl:param name="word"/>
|
||||
<xsl:param name="splitlimit">32</xsl:param>
|
||||
<xsl:variable name="secondhalflen" select="(string-length($word)+(string-length($word) mod 2)) div 2"/>
|
||||
<xsl:variable name="secondhalfword" select="substring($word, $secondhalflen)"/>
|
||||
<!-- When word is very big, a recursive replace is very heap/stack expensive, so subdivide on line break after middle of string -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="(string-length($word) > $splitlimit) and (contains($secondhalfword, '
'))">
|
||||
<xsl:variable name="secondhalfend" select="substring-after($secondhalfword, '
')"/>
|
||||
<xsl:variable name="firsthalflen" select="string-length($word) - $secondhalflen"/>
|
||||
<xsl:variable name="firsthalfword" select="substring($word, 1, $firsthalflen)"/>
|
||||
<xsl:variable name="firsthalfend" select="substring-before($secondhalfword, '
')"/>
|
||||
<xsl:call-template name="br-replace">
|
||||
<xsl:with-param name="word" select="concat($firsthalfword,$firsthalfend)"/>
|
||||
</xsl:call-template>
|
||||
<br/>
|
||||
<xsl:call-template name="br-replace">
|
||||
<xsl:with-param name="word" select="$secondhalfend"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($word, '
')">
|
||||
<xsl:value-of select="substring-before($word, '
')"/>
|
||||
<br/>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
@ -317,7 +317,7 @@ under the License.
|
|||
<table width="100%">
|
||||
<tr>
|
||||
<td align="left"></td>
|
||||
<td align="right">Designed for use with <a href='https://ant.apache.org/antlibs/antunit/'>AntUnit</a> and <a href='https://ant.apache.org/'>Ant</a>.</td>
|
||||
<td align="right">Designed for use with <a href='http://ant.apache.org/antlibs/antunit/'>AntUnit</a> and <a href='http://ant.apache.org/'>Ant</a>.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr size="1"/>
|
||||
|
|
@ -468,24 +468,7 @@ under the License.
|
|||
-->
|
||||
<xsl:template name="br-replace">
|
||||
<xsl:param name="word"/>
|
||||
<xsl:param name="splitlimit">32</xsl:param>
|
||||
<xsl:variable name="secondhalflen" select="(string-length($word)+(string-length($word) mod 2)) div 2"/>
|
||||
<xsl:variable name="secondhalfword" select="substring($word, $secondhalflen)"/>
|
||||
<!-- When word is very big, a recursive replace is very heap/stack expensive, so subdivide on line break after middle of string -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="(string-length($word) > $splitlimit) and (contains($secondhalfword, '
'))">
|
||||
<xsl:variable name="secondhalfend" select="substring-after($secondhalfword, '
')"/>
|
||||
<xsl:variable name="firsthalflen" select="string-length($word) - $secondhalflen"/>
|
||||
<xsl:variable name="firsthalfword" select="substring($word, 1, $firsthalflen)"/>
|
||||
<xsl:variable name="firsthalfend" select="substring-before($secondhalfword, '
')"/>
|
||||
<xsl:call-template name="br-replace">
|
||||
<xsl:with-param name="word" select="concat($firsthalfword,$firsthalfend)"/>
|
||||
</xsl:call-template>
|
||||
<br/>
|
||||
<xsl:call-template name="br-replace">
|
||||
<xsl:with-param name="word" select="$secondhalfend"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($word, '
')">
|
||||
<xsl:value-of select="substring-before($word, '
')"/>
|
||||
<br/>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
@ -43,7 +43,7 @@ under the License.
|
|||
|
||||
<target name="nonFile">
|
||||
<au:antunit>
|
||||
<url url="https://ant.apache.org/"/>
|
||||
<url url="http://ant.apache.org/"/>
|
||||
</au:antunit>
|
||||
</target>
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1,55 +1,55 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
https://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.
|
||||
-->
|
||||
|
||||
<project name="setup-and-teardown"
|
||||
default="all"
|
||||
xmlns:au="antlib:org.apache.ant.antunit">
|
||||
|
||||
<target name="all">
|
||||
<fail message="These are not standalone tests." />
|
||||
</target>
|
||||
|
||||
<target name="setUp">
|
||||
<fail message="outputfile property is not set." unless="outputfile" />
|
||||
<echo file="${outputfile}" append="true" message="S" />
|
||||
</target>
|
||||
|
||||
<target name="test1">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
</target>
|
||||
|
||||
<target name="test2">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
</target>
|
||||
|
||||
<target name="test3">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
</target>
|
||||
|
||||
<target name="test4">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
</target>
|
||||
|
||||
<target name="tearDown">
|
||||
<echo file="${outputfile}" append="true" message="T" />
|
||||
</target>
|
||||
|
||||
</project>
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
<project name="setup-and-teardown"
|
||||
default="all"
|
||||
xmlns:au="antlib:org.apache.ant.antunit">
|
||||
|
||||
<target name="all">
|
||||
<fail message="These are not standalone tests." />
|
||||
</target>
|
||||
|
||||
<target name="setUp">
|
||||
<fail message="outputfile property is not set." unless="outputfile" />
|
||||
<echo file="${outputfile}" append="true" message="S" />
|
||||
</target>
|
||||
|
||||
<target name="test1">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
</target>
|
||||
|
||||
<target name="test2">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
</target>
|
||||
|
||||
<target name="test3">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
</target>
|
||||
|
||||
<target name="test4">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
</target>
|
||||
|
||||
<target name="tearDown">
|
||||
<echo file="${outputfile}" append="true" message="T" />
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1,43 +1,43 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
https://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.
|
||||
-->
|
||||
|
||||
<project name="failed-test"
|
||||
default="all"
|
||||
xmlns:au="antlib:org.apache.ant.antunit">
|
||||
|
||||
<target name="all">
|
||||
<fail message="These are not standalone tests." />
|
||||
</target>
|
||||
|
||||
<target name="setUp">
|
||||
<echo file="${outputfile}" append="true" message="S" />
|
||||
<fail message="Expected failure" />
|
||||
</target>
|
||||
|
||||
<target name="test1">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
</target>
|
||||
|
||||
<target name="tearDown">
|
||||
<echo file="${outputfile}" append="true" message="T" />
|
||||
</target>
|
||||
|
||||
</project>
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
<project name="failed-test"
|
||||
default="all"
|
||||
xmlns:au="antlib:org.apache.ant.antunit">
|
||||
|
||||
<target name="all">
|
||||
<fail message="These are not standalone tests." />
|
||||
</target>
|
||||
|
||||
<target name="setUp">
|
||||
<echo file="${outputfile}" append="true" message="S" />
|
||||
<fail message="Expected failure" />
|
||||
</target>
|
||||
|
||||
<target name="test1">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
</target>
|
||||
|
||||
<target name="tearDown">
|
||||
<echo file="${outputfile}" append="true" message="T" />
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -1,43 +1,43 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
https://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.
|
||||
-->
|
||||
|
||||
<project name="failed-test"
|
||||
default="all"
|
||||
xmlns:au="antlib:org.apache.ant.antunit">
|
||||
|
||||
<target name="all">
|
||||
<fail message="These are not standalone tests." />
|
||||
</target>
|
||||
|
||||
<target name="setUp">
|
||||
<echo file="${outputfile}" append="true" message="S" />
|
||||
</target>
|
||||
|
||||
<target name="test1">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
</target>
|
||||
|
||||
<target name="tearDown">
|
||||
<echo file="${outputfile}" append="true" message="T" />
|
||||
<fail message="Expected failure" />
|
||||
</target>
|
||||
|
||||
</project>
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
<project name="failed-test"
|
||||
default="all"
|
||||
xmlns:au="antlib:org.apache.ant.antunit">
|
||||
|
||||
<target name="all">
|
||||
<fail message="These are not standalone tests." />
|
||||
</target>
|
||||
|
||||
<target name="setUp">
|
||||
<echo file="${outputfile}" append="true" message="S" />
|
||||
</target>
|
||||
|
||||
<target name="test1">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
</target>
|
||||
|
||||
<target name="tearDown">
|
||||
<echo file="${outputfile}" append="true" message="T" />
|
||||
<fail message="Expected failure" />
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -1,44 +1,44 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
https://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.
|
||||
-->
|
||||
|
||||
<project name="failed-test"
|
||||
default="all"
|
||||
xmlns:au="antlib:org.apache.ant.antunit">
|
||||
|
||||
<target name="all">
|
||||
<fail message="These are not standalone tests." />
|
||||
</target>
|
||||
|
||||
<target name="setUp">
|
||||
<fail message="outputfile property is not set." unless="outputfile" />
|
||||
<echo file="${outputfile}" append="true" message="S" />
|
||||
</target>
|
||||
|
||||
<target name="test1">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
<fail message="Expected failure" />
|
||||
</target>
|
||||
|
||||
<target name="tearDown">
|
||||
<echo file="${outputfile}" append="true" message="T" />
|
||||
</target>
|
||||
|
||||
</project>
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
<project name="failed-test"
|
||||
default="all"
|
||||
xmlns:au="antlib:org.apache.ant.antunit">
|
||||
|
||||
<target name="all">
|
||||
<fail message="These are not standalone tests." />
|
||||
</target>
|
||||
|
||||
<target name="setUp">
|
||||
<fail message="outputfile property is not set." unless="outputfile" />
|
||||
<echo file="${outputfile}" append="true" message="S" />
|
||||
</target>
|
||||
|
||||
<target name="test1">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
<fail message="Expected failure" />
|
||||
</target>
|
||||
|
||||
<target name="tearDown">
|
||||
<echo file="${outputfile}" append="true" message="T" />
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1,50 +1,50 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
https://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.
|
||||
-->
|
||||
|
||||
<project name="no-setup"
|
||||
default="all"
|
||||
xmlns:au="antlib:org.apache.ant.antunit">
|
||||
|
||||
<target name="all">
|
||||
<fail message="These are not standalone tests." />
|
||||
</target>
|
||||
|
||||
<target name="test1">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
</target>
|
||||
|
||||
<target name="test2">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
</target>
|
||||
|
||||
<target name="test3">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
</target>
|
||||
|
||||
<target name="test4">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
</target>
|
||||
|
||||
<target name="tearDown">
|
||||
<echo file="${outputfile}" append="true" message="T" />
|
||||
</target>
|
||||
|
||||
</project>
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
<project name="no-setup"
|
||||
default="all"
|
||||
xmlns:au="antlib:org.apache.ant.antunit">
|
||||
|
||||
<target name="all">
|
||||
<fail message="These are not standalone tests." />
|
||||
</target>
|
||||
|
||||
<target name="test1">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
</target>
|
||||
|
||||
<target name="test2">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
</target>
|
||||
|
||||
<target name="test3">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
</target>
|
||||
|
||||
<target name="test4">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
</target>
|
||||
|
||||
<target name="tearDown">
|
||||
<echo file="${outputfile}" append="true" message="T" />
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1,51 +1,51 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
https://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.
|
||||
-->
|
||||
|
||||
<project name="no-teardown"
|
||||
default="all"
|
||||
xmlns:au="antlib:org.apache.ant.antunit">
|
||||
|
||||
<target name="all">
|
||||
<fail message="These are not standalone tests." />
|
||||
</target>
|
||||
|
||||
<target name="setUp">
|
||||
<fail message="outputfile property is not set." unless="outputfile" />
|
||||
<echo file="${outputfile}" append="true" message="S" />
|
||||
</target>
|
||||
|
||||
<target name="test1">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
</target>
|
||||
|
||||
<target name="test2">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
</target>
|
||||
|
||||
<target name="test3">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
</target>
|
||||
|
||||
<target name="test4">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
</target>
|
||||
|
||||
</project>
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
<project name="no-teardown"
|
||||
default="all"
|
||||
xmlns:au="antlib:org.apache.ant.antunit">
|
||||
|
||||
<target name="all">
|
||||
<fail message="These are not standalone tests." />
|
||||
</target>
|
||||
|
||||
<target name="setUp">
|
||||
<fail message="outputfile property is not set." unless="outputfile" />
|
||||
<echo file="${outputfile}" append="true" message="S" />
|
||||
</target>
|
||||
|
||||
<target name="test1">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
</target>
|
||||
|
||||
<target name="test2">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
</target>
|
||||
|
||||
<target name="test3">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
</target>
|
||||
|
||||
<target name="test4">
|
||||
<echo file="${outputfile}" append="true" message="E" />
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
@ -77,22 +77,6 @@ under the License.
|
|||
<au:assertEquals expected="bar" actual="BAR"/>
|
||||
</target>
|
||||
|
||||
<target name="assertNotEqualsPass1">
|
||||
<au:assertNotEquals notexpected="bar" actual="baz"/>
|
||||
</target>
|
||||
|
||||
<target name="assertNotEqualsPass2">
|
||||
<au:assertNotEquals notexpected="bar" actual="BAR"/>
|
||||
</target>
|
||||
|
||||
<target name="assertNotEqualsFail">
|
||||
<au:assertNotEquals notexpected="bar" actual="bar"/>
|
||||
</target>
|
||||
|
||||
<target name="assertNotEqualsCaseFail">
|
||||
<au:assertNotEquals notexpected="bar" actual="BAR" casesensitive="false"/>
|
||||
</target>
|
||||
|
||||
<target name="assertPropertySetPass">
|
||||
<property name="foo" value="bar"/>
|
||||
<au:assertPropertySet name="foo"/>
|
||||
|
|
@ -102,15 +86,6 @@ under the License.
|
|||
<au:assertPropertySet name="foo"/>
|
||||
</target>
|
||||
|
||||
<target name="assertPropertyNotSetPass">
|
||||
<au:assertPropertyNotSet name="foo"/>
|
||||
</target>
|
||||
|
||||
<target name="assertPropertyNotSetFail">
|
||||
<property name="foo" value="bar"/>
|
||||
<au:assertPropertyNotSet name="foo"/>
|
||||
</target>
|
||||
|
||||
<target name="assertPropertyEqualsPass">
|
||||
<property name="foo" value="bar"/>
|
||||
<au:assertPropertyEquals name="foo" value="bar"/>
|
||||
|
|
@ -135,30 +110,6 @@ under the License.
|
|||
<au:assertPropertyEquals name="foo" value="BAR"/>
|
||||
</target>
|
||||
|
||||
<target name="assertPropertyNotEqualsPass1">
|
||||
<property name="foo" value="bar"/>
|
||||
<au:assertPropertyNotEquals name="foo" value="baz"/>
|
||||
</target>
|
||||
|
||||
<target name="assertPropertyNotEqualsPass2">
|
||||
<property name="foo" value="bar"/>
|
||||
<au:assertPropertyNotEquals name="foo" value="BAR"/>
|
||||
</target>
|
||||
|
||||
<target name="assertPropertyNotEqualsFail1">
|
||||
<au:assertPropertyNotEquals name="foo" value="bar"/>
|
||||
</target>
|
||||
|
||||
<target name="assertPropertyNotEqualsFail2">
|
||||
<property name="foo" value="bar"/>
|
||||
<au:assertPropertyNotEquals name="foo" value="bar"/>
|
||||
</target>
|
||||
|
||||
<target name="assertPropertyNotEqualsCaseFail">
|
||||
<property name="foo" value="bar"/>
|
||||
<au:assertPropertyNotEquals name="foo" value="BAR" casesensitive="false"/>
|
||||
</target>
|
||||
|
||||
<target name="assertPropertyContains">
|
||||
<property name="foo" value="bar"/>
|
||||
<au:assertPropertyContains name="foo" value="ba"/>
|
||||
|
|
@ -169,16 +120,6 @@ under the License.
|
|||
<au:assertPropertyContains name="foo" value="foo"/>
|
||||
</target>
|
||||
|
||||
<target name="assertPropertyDoesntContain">
|
||||
<property name="foo" value="bar"/>
|
||||
<au:assertPropertyDoesntContain name="foo" value="foo"/>
|
||||
</target>
|
||||
|
||||
<target name="assertPropertyDoesntContainFail">
|
||||
<property name="foo" value="bar"/>
|
||||
<au:assertPropertyDoesntContain name="foo" value="ba"/>
|
||||
</target>
|
||||
|
||||
<target name="assertFileExistsPass">
|
||||
<au:assertFileExists file="assert.xml"/>
|
||||
</target>
|
||||
|
|
@ -264,15 +205,6 @@ under the License.
|
|||
<au:assertReferenceSet refid="foo2"/>
|
||||
</target>
|
||||
|
||||
<target name="assertReferenceIsNotSetPass">
|
||||
<au:assertReferenceIsNotSet refid="foo3"/>
|
||||
</target>
|
||||
|
||||
<target name="assertReferenceIsNotSetFail">
|
||||
<path id="foo4"/>
|
||||
<au:assertReferenceIsNotSet refid="foo4"/>
|
||||
</target>
|
||||
|
||||
<target name="assertReferenceIsTypePass">
|
||||
<path id="foo3"/>
|
||||
<au:assertReferenceIsType refid="foo3" type="path"/>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1,39 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
https://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.
|
||||
-->
|
||||
|
||||
<project name="logforwarder-test" default="forward"
|
||||
xmlns:au="antlib:org.apache.ant.antunit">
|
||||
|
||||
<target name="forward">
|
||||
<au:antunit failOnError="false">
|
||||
<file file="${ant.file}" />
|
||||
<au:logforwarder />
|
||||
</au:antunit>
|
||||
</target>
|
||||
|
||||
<target name="testEcho">
|
||||
<echo level="debug">debugmessage</echo>
|
||||
<echo level="verbose">verbosemessage</echo>
|
||||
<echo level="info">infomessage</echo>
|
||||
<echo level="warning">warningmessage</echo>
|
||||
<echo level="error">errormessage</echo>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
|
@ -8,7 +8,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* 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
|
||||
|
|
@ -27,11 +27,10 @@ import java.util.ArrayList;
|
|||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.tools.ant.AntClassLoader;
|
||||
import org.apache.tools.ant.BuildEvent;
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.BuildListener;
|
||||
|
|
@ -42,9 +41,7 @@ import org.apache.tools.ant.ProjectHelper;
|
|||
import org.apache.tools.ant.Task;
|
||||
import org.apache.tools.ant.taskdefs.Ant;
|
||||
import org.apache.tools.ant.types.Mapper;
|
||||
import org.apache.tools.ant.types.Path;
|
||||
import org.apache.tools.ant.types.PropertySet;
|
||||
import org.apache.tools.ant.types.Resource;
|
||||
import org.apache.tools.ant.types.ResourceCollection;
|
||||
import org.apache.tools.ant.types.resources.FileResource;
|
||||
import org.apache.tools.ant.types.resources.Union;
|
||||
|
|
@ -110,24 +107,24 @@ public class AntUnit extends Task {
|
|||
* The object responsible for the execution of the unit test.
|
||||
* scriptRunner is invoked to executes the targets and keep the
|
||||
* reference to the project. scriptRunner is defined only when the
|
||||
* antunit script is running.
|
||||
* antunit script is running.
|
||||
*/
|
||||
private AntUnitScriptRunner scriptRunner;
|
||||
|
||||
/**
|
||||
* listeners.
|
||||
*/
|
||||
private ArrayList<AntUnitListener> listeners = new ArrayList<AntUnitListener>();
|
||||
private ArrayList listeners = new ArrayList();
|
||||
|
||||
/**
|
||||
* propertysets.
|
||||
*/
|
||||
private ArrayList<PropertySet> propertySets = new ArrayList<PropertySet>();
|
||||
private ArrayList propertySets = new ArrayList();
|
||||
|
||||
/**
|
||||
* Holds references to be inherited by the test project
|
||||
*/
|
||||
private ArrayList<ReferenceSet> referenceSets = new ArrayList<ReferenceSet>();
|
||||
private ArrayList referenceSets = new ArrayList();
|
||||
|
||||
/**
|
||||
* has a failure occured?
|
||||
|
|
@ -149,10 +146,6 @@ public class AntUnit extends Task {
|
|||
*/
|
||||
private String errorProperty = null;
|
||||
|
||||
private Path classpath;
|
||||
|
||||
private AntClassLoader subprojectCoreLoader;
|
||||
|
||||
/**
|
||||
* Add build files to run as tests.
|
||||
* @param rc the ResourceCollection to add.
|
||||
|
|
@ -183,7 +176,6 @@ public class AntUnit extends Task {
|
|||
|
||||
/**
|
||||
* Add a set of inherited references.
|
||||
* @return set of inherited references
|
||||
*/
|
||||
public ReferenceSet createReferenceSet() {
|
||||
ReferenceSet set = new ReferenceSet();
|
||||
|
|
@ -193,8 +185,7 @@ public class AntUnit extends Task {
|
|||
}
|
||||
|
||||
/**
|
||||
* Add an inherited reference.
|
||||
* @param reference inherited reference
|
||||
* Add an inherited reference
|
||||
*/
|
||||
public void addReference(Reference reference) {
|
||||
//wrap in a singleton reference set.
|
||||
|
|
@ -217,28 +208,6 @@ public class AntUnit extends Task {
|
|||
this.failOnError = failOnError;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the nested classpath element.
|
||||
* @return {@link Path}
|
||||
*/
|
||||
public Path createClasspath() {
|
||||
if (classpath != null) {
|
||||
throw new BuildException("Can only set classpath once");
|
||||
}
|
||||
return classpath = new Path(getProject());
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the test classpath as a reference to a {@link Path} defined elsewhere.
|
||||
* @param classpathRefid
|
||||
*/
|
||||
public void setClasspathRefid(String classpathRefid) {
|
||||
if (classpathRefid == null || classpathRefid.trim().length() == 0) {
|
||||
throw new BuildException("Null/empty/blank @classpathrefid specified");
|
||||
}
|
||||
createClasspath().setRefid(new org.apache.tools.ant.types.Reference(getProject(), classpathRefid));
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the tests.
|
||||
*/
|
||||
|
|
@ -246,9 +215,6 @@ public class AntUnit extends Task {
|
|||
if (buildFiles == null) {
|
||||
throw new BuildException(ERROR_NO_TESTS);
|
||||
}
|
||||
if (classpath != null && classpath.size() > 0) {
|
||||
subprojectCoreLoader = getProject().createClassLoader(classpath);
|
||||
}
|
||||
doResourceCollection(buildFiles);
|
||||
if (failures > 0 || errors > 0) {
|
||||
if (errorProperty != null) {
|
||||
|
|
@ -273,15 +239,15 @@ public class AntUnit extends Task {
|
|||
if (!rc.isFilesystemOnly()) {
|
||||
throw new BuildException(ERROR_NON_FILES);
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
Iterable<Resource> iterable = (Iterable<Resource>) rc;
|
||||
|
||||
for (Resource resource : iterable) {
|
||||
FileResource r = (FileResource) resource;
|
||||
Iterator i = rc.iterator();
|
||||
while (i.hasNext()) {
|
||||
FileResource r = (FileResource) i.next();
|
||||
if (r.isExists()) {
|
||||
doFile(r.getFile());
|
||||
} else {
|
||||
log("Skipping " + r + " since it doesn't exist", Project.MSG_VERBOSE);
|
||||
log("Skipping " + r + " since it doesn't exist",
|
||||
Project.MSG_VERBOSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -298,19 +264,20 @@ public class AntUnit extends Task {
|
|||
};
|
||||
try {
|
||||
scriptRunner = new AntUnitScriptRunner(prjFactory);
|
||||
List<String> testTargets = scriptRunner.getTestTargets();
|
||||
List testTargets = scriptRunner.getTestTartgets();
|
||||
scriptRunner.runSuite(testTargets, notifier);
|
||||
} finally {
|
||||
scriptRunner=null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Redirect output to new project instance.
|
||||
* @param outputToHandle the output to handle.
|
||||
*/
|
||||
public void handleOutput(String outputToHandle) {
|
||||
if (scriptRunner != null) {
|
||||
if (scriptRunner!=null) {
|
||||
scriptRunner.getCurrentProject().demuxOutput(outputToHandle, false);
|
||||
} else {
|
||||
super.handleOutput(outputToHandle);
|
||||
|
|
@ -325,7 +292,7 @@ public class AntUnit extends Task {
|
|||
*/
|
||||
public int handleInput(byte[] buffer, int offset, int length)
|
||||
throws IOException {
|
||||
if (scriptRunner != null) {
|
||||
if (scriptRunner!=null) {
|
||||
return scriptRunner.getCurrentProject().demuxInput(buffer, offset, length);
|
||||
}
|
||||
return super.handleInput(buffer, offset, length);
|
||||
|
|
@ -336,7 +303,7 @@ public class AntUnit extends Task {
|
|||
* @param toFlush the output String to flush.
|
||||
*/
|
||||
public void handleFlush(String toFlush) {
|
||||
if (scriptRunner != null) {
|
||||
if (scriptRunner!=null) {
|
||||
scriptRunner.getCurrentProject().demuxFlush(toFlush, false);
|
||||
} else {
|
||||
super.handleFlush(toFlush);
|
||||
|
|
@ -348,7 +315,7 @@ public class AntUnit extends Task {
|
|||
* @param errorOutputToHandle the error output to handle.
|
||||
*/
|
||||
public void handleErrorOutput(String errorOutputToHandle) {
|
||||
if (scriptRunner != null) {
|
||||
if (scriptRunner!=null) {
|
||||
scriptRunner.getCurrentProject().demuxOutput(errorOutputToHandle, true);
|
||||
} else {
|
||||
super.handleErrorOutput(errorOutputToHandle);
|
||||
|
|
@ -360,7 +327,7 @@ public class AntUnit extends Task {
|
|||
* @param errorOutputToFlush the error output to flush.
|
||||
*/
|
||||
public void handleErrorFlush(String errorOutputToFlush) {
|
||||
if (scriptRunner != null) {
|
||||
if (scriptRunner!=null) {
|
||||
scriptRunner.getCurrentProject().demuxFlush(errorOutputToFlush, true);
|
||||
} else {
|
||||
super.handleErrorFlush(errorOutputToFlush);
|
||||
|
|
@ -373,23 +340,24 @@ public class AntUnit extends Task {
|
|||
*/
|
||||
private Project createProjectForFile(File f) {
|
||||
Project p = new Project();
|
||||
if (subprojectCoreLoader != null) {
|
||||
p.setCoreLoader(subprojectCoreLoader);
|
||||
}
|
||||
p.setDefaultInputStream(getProject().getDefaultInputStream());
|
||||
p.initProperties();
|
||||
p.setInputHandler(getProject().getInputHandler());
|
||||
getProject().initSubProject(p);
|
||||
//pass through inherited properties
|
||||
for (PropertySet set : propertySets) {
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
Map<String,Object> props = (Map) set.getProperties();
|
||||
for (String key : props.keySet()) {
|
||||
if (MagicNames.PROJECT_BASEDIR.equals(key) || MagicNames.ANT_FILE.equals(key)) {
|
||||
for (Iterator outer = propertySets.iterator(); outer.hasNext(); ) {
|
||||
PropertySet set = (PropertySet) outer.next();
|
||||
Map props = set.getProperties();
|
||||
for (Iterator keys = props.keySet().iterator();
|
||||
keys.hasNext(); ) {
|
||||
String key = keys.next().toString();
|
||||
if (MagicNames.PROJECT_BASEDIR.equals(key)
|
||||
|| MagicNames.ANT_FILE.equals(key)) {
|
||||
continue;
|
||||
}
|
||||
Object value = props.get(key);
|
||||
if (value instanceof String && p.getProperty(key) == null) {
|
||||
if (value != null && value instanceof String
|
||||
&& p.getProperty(key) == null) {
|
||||
p.setNewProperty(key, (String) value);
|
||||
}
|
||||
}
|
||||
|
|
@ -399,7 +367,8 @@ public class AntUnit extends Task {
|
|||
//with significant modification from taskdefs.Ant in Ant core.
|
||||
//unfortunately the only way we can share the code directly
|
||||
//would be to extend Ant (which might not be a bad idea?)
|
||||
for (ReferenceSet set : referenceSets) {
|
||||
for (int i = 0; i < referenceSets.size(); ++i) {
|
||||
ReferenceSet set = (ReferenceSet) referenceSets.get(i);
|
||||
set.copyReferencesInto(p);
|
||||
}
|
||||
|
||||
|
|
@ -419,8 +388,12 @@ public class AntUnit extends Task {
|
|||
* @param p the Project to attach to.
|
||||
*/
|
||||
private void attachListeners(File buildFile, Project p) {
|
||||
for (AntUnitListener al : listeners) {
|
||||
p.addBuildListener(new BuildToAntUnitListener(buildFile.getAbsolutePath(), al));
|
||||
Iterator it = listeners.iterator();
|
||||
while (it.hasNext()) {
|
||||
AntUnitListener al = (AntUnitListener) it.next();
|
||||
p.addBuildListener(new BuildToAntUnitListener(buildFile
|
||||
.getAbsolutePath(),
|
||||
al));
|
||||
al.setCurrentTestProject(p);
|
||||
}
|
||||
}
|
||||
|
|
@ -430,7 +403,9 @@ public class AntUnit extends Task {
|
|||
* @param targetName the name of the target.
|
||||
*/
|
||||
private void fireStartTest(String targetName) {
|
||||
for (AntUnitListener al : listeners) {
|
||||
Iterator it = listeners.iterator();
|
||||
while (it.hasNext()) {
|
||||
AntUnitListener al = (AntUnitListener) it.next();
|
||||
al.startTest(targetName);
|
||||
}
|
||||
}
|
||||
|
|
@ -442,7 +417,9 @@ public class AntUnit extends Task {
|
|||
*/
|
||||
private void fireFail(String targetName, AssertionFailedException ae) {
|
||||
failures++;
|
||||
for (AntUnitListener al : listeners) {
|
||||
Iterator it = listeners.iterator();
|
||||
while (it.hasNext()) {
|
||||
AntUnitListener al = (AntUnitListener) it.next();
|
||||
al.addFailure(targetName, ae);
|
||||
}
|
||||
}
|
||||
|
|
@ -454,7 +431,9 @@ public class AntUnit extends Task {
|
|||
*/
|
||||
private void fireError(String targetName, Throwable t) {
|
||||
errors++;
|
||||
for (AntUnitListener al : listeners) {
|
||||
Iterator it = listeners.iterator();
|
||||
while (it.hasNext()) {
|
||||
AntUnitListener al = (AntUnitListener) it.next();
|
||||
al.addError(targetName, t);
|
||||
}
|
||||
}
|
||||
|
|
@ -464,7 +443,9 @@ public class AntUnit extends Task {
|
|||
* @param targetName the name of the current target.
|
||||
*/
|
||||
private void fireEndTest(String targetName) {
|
||||
for (AntUnitListener al : listeners) {
|
||||
Iterator it = listeners.iterator();
|
||||
while (it.hasNext()) {
|
||||
AntUnitListener al = (AntUnitListener) it.next();
|
||||
al.endTest(targetName);
|
||||
}
|
||||
}
|
||||
|
|
@ -478,7 +459,7 @@ public class AntUnit extends Task {
|
|||
/**
|
||||
* references inherited from parent project by antunit scripts
|
||||
*/
|
||||
private List<Reference> references = new ArrayList<Reference>();
|
||||
private ArrayList references = new ArrayList();
|
||||
/**
|
||||
* maps source reference ID to target reference ID
|
||||
*/
|
||||
|
|
@ -488,24 +469,16 @@ public class AntUnit extends Task {
|
|||
references.add(reference);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a nested mapper element.
|
||||
* @return {@link Mapper}
|
||||
*/
|
||||
public Mapper createMapper() {
|
||||
if (mapper == null) {
|
||||
return mapper = new Mapper(getProject());
|
||||
} else {
|
||||
throw new BuildException("Only one mapper element is allowed"
|
||||
+ " per referenceSet", getLocation());
|
||||
}
|
||||
throw new BuildException("Only one mapper element is allowed per referenceSet",
|
||||
getLocation());
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure a single mapper to translate reference IDs.
|
||||
* @param typeName the mapper type
|
||||
* @param from the from attribute
|
||||
* @param to the to attribute
|
||||
*/
|
||||
/** configure a single mapper to translate reference IDs */
|
||||
public void setMapper(String typeName, String from, String to) {
|
||||
Mapper mapper = createMapper();
|
||||
Mapper.MapperType type = new Mapper.MapperType();
|
||||
|
|
@ -520,19 +493,21 @@ public class AntUnit extends Task {
|
|||
* Copy all identified references into the target project,
|
||||
* applying any name mapping required by a nested mapper
|
||||
* element.
|
||||
* @param newProject the target project to copy references into
|
||||
*/
|
||||
public void copyReferencesInto(Project newProject) {
|
||||
FileNameMapper mapper = this.mapper == null ? null : this.mapper.getImplementation();
|
||||
Set<String> matches = new HashSet<String>();
|
||||
@SuppressWarnings("unchecked")
|
||||
Hashtable<String,Object> src = getProject().getReferences();
|
||||
FileNameMapper mapper = this.mapper == null
|
||||
? null : this.mapper.getImplementation();
|
||||
HashSet matches = new HashSet();
|
||||
Hashtable src = getProject().getReferences();
|
||||
|
||||
for (Iterator it = references.iterator(); it.hasNext(); ) {
|
||||
Reference ref = (Reference) it.next();
|
||||
|
||||
for (Reference ref : references) {
|
||||
matches.clear();
|
||||
ref.addMatchingReferences(src, matches);
|
||||
|
||||
for (String refid : matches) {
|
||||
for (Iterator ids = matches.iterator(); ids.hasNext(); ) {
|
||||
String refid = (String) ids.next();
|
||||
String toRefid = ref.getToRefid();
|
||||
|
||||
//transform the refid with the mapper if necessary
|
||||
|
|
@ -573,12 +548,12 @@ public class AntUnit extends Task {
|
|||
return;
|
||||
}
|
||||
|
||||
Class<?> c = orig.getClass();
|
||||
Class c = orig.getClass();
|
||||
Object copy = orig;
|
||||
try {
|
||||
Method cloneM = c.getMethod("clone");
|
||||
Method cloneM = c.getMethod("clone", new Class[0]);
|
||||
if (cloneM != null) {
|
||||
copy = cloneM.invoke(orig);
|
||||
copy = cloneM.invoke(orig, new Object[0]);
|
||||
log("Adding clone of reference " + oldKey,
|
||||
Project.MSG_DEBUG);
|
||||
}
|
||||
|
|
@ -586,14 +561,15 @@ public class AntUnit extends Task {
|
|||
// not Clonable
|
||||
}
|
||||
|
||||
|
||||
if (copy instanceof ProjectComponent) {
|
||||
((ProjectComponent) copy).setProject(newProject);
|
||||
} else {
|
||||
try {
|
||||
Method setProjectM =
|
||||
c.getMethod("setProject", Project.class);
|
||||
c.getMethod("setProject", new Class[] {Project.class});
|
||||
if (setProjectM != null) {
|
||||
setProjectM.invoke(copy, newProject);
|
||||
setProjectM.invoke(copy, new Object[] {newProject});
|
||||
}
|
||||
} catch (NoSuchMethodException e) {
|
||||
// ignore this if the class being referenced does not have
|
||||
|
|
@ -606,6 +582,8 @@ public class AntUnit extends Task {
|
|||
}
|
||||
newProject.addReference(newKey, copy);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static class Reference extends Ant.Reference {
|
||||
|
|
@ -619,7 +597,7 @@ public class AntUnit extends Task {
|
|||
|
||||
/**
|
||||
* Set a regular expression to match references.
|
||||
* @param regex the regular expression
|
||||
* @param regex
|
||||
*/
|
||||
public void setRegex(String regex) {
|
||||
this.regex = regex;
|
||||
|
|
@ -634,21 +612,22 @@ public class AntUnit extends Task {
|
|||
* @param src table of references to check
|
||||
* @param dest set of reference IDs matching this reference pattern
|
||||
*/
|
||||
public void addMatchingReferences(Hashtable<String, Object> src, Collection<String> dest) {
|
||||
public void addMatchingReferences(Hashtable src, Collection dest) {
|
||||
String id = getRefId();
|
||||
if (id != null) {
|
||||
if (src.containsKey(id)) {
|
||||
dest.add(id);
|
||||
}
|
||||
} else if (matcher != null) {
|
||||
for (String refid : src.keySet()) {
|
||||
for (Iterator it = src.keySet().iterator(); it.hasNext(); ) {
|
||||
String refid = (String)it.next();
|
||||
if (matcher.matches(refid)) {
|
||||
dest.add(refid);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new BuildException(
|
||||
"either the refid or regex attribute is required for reference elements");
|
||||
throw new BuildException("either the refid or regex attribute "
|
||||
+ "is required for reference elements");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -671,8 +650,10 @@ public class AntUnit extends Task {
|
|||
public void buildFinished(BuildEvent event) {
|
||||
a.endTestSuite(event.getProject(), buildFile);
|
||||
}
|
||||
public void targetStarted(BuildEvent event) {}
|
||||
public void targetFinished(BuildEvent event) {}
|
||||
public void targetStarted(BuildEvent event) {
|
||||
}
|
||||
public void targetFinished(BuildEvent event) {
|
||||
}
|
||||
public void taskStarted(BuildEvent event) {}
|
||||
public void taskFinished(BuildEvent event) {}
|
||||
public void messageLogged(BuildEvent event) {}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* 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
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
package org.apache.ant.antunit;
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Provides methods that allow the AntUnitScriptRunner to notify the test progress.
|
||||
* @since 1.2
|
||||
*/
|
||||
|
|
@ -31,26 +31,26 @@ public interface AntUnitExecutionNotifier {
|
|||
* invokes start on all registered test listeners.
|
||||
* @param targetName the name of the target.
|
||||
*/
|
||||
void fireStartTest(String targetName);
|
||||
public void fireStartTest(String targetName);
|
||||
|
||||
/**
|
||||
* invokes addFailure on all registered test listeners.
|
||||
* @param targetName the name of the failed target.
|
||||
* @param ae the associated AssertionFailedException.
|
||||
*/
|
||||
void fireFail(String targetName, AssertionFailedException ae);
|
||||
public void fireFail(String targetName, AssertionFailedException ae);
|
||||
|
||||
/**
|
||||
* invokes addError on all registered test listeners.
|
||||
* @param targetName the name of the failed target.
|
||||
* @param t the associated Throwable.
|
||||
*/
|
||||
void fireError(String targetName, Throwable t);
|
||||
public void fireError(String targetName, Throwable t);
|
||||
|
||||
/**
|
||||
* invokes endTest on all registered test listeners.
|
||||
* @param targetName the name of the current target.
|
||||
*/
|
||||
void fireEndTest(String targetName);
|
||||
public void fireEndTest(String targetName);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* 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
|
||||
|
|
@ -31,7 +31,6 @@ public interface AntUnitListener {
|
|||
* Set a reference to the AntUnit task executing the tests, this
|
||||
* provides access to the containing project, target or Ant's
|
||||
* logging system.
|
||||
* @param t the parent task
|
||||
*/
|
||||
void setParentTask(Task t);
|
||||
/**
|
||||
|
|
@ -41,42 +40,31 @@ public interface AntUnitListener {
|
|||
* <p>This provides access to the logging system or the properties
|
||||
* of the project under test. Note that different test targets
|
||||
* will be executed in different Ant Project instances.</p>
|
||||
* @param p the test project
|
||||
*/
|
||||
void setCurrentTestProject(Project p);
|
||||
/**
|
||||
* Invoked once per build file, before any targets get executed.
|
||||
* @param testProject the project
|
||||
* @param buildFile the build file
|
||||
*/
|
||||
void startTestSuite(Project testProject, String buildFile);
|
||||
/**
|
||||
* Invoked once per build file, after all targets have been executed.
|
||||
* @param testProject the project
|
||||
* @param buildFile the build file
|
||||
*/
|
||||
void endTestSuite(Project testProject, String buildFile);
|
||||
/**
|
||||
* Invoked before a test target gets executed.
|
||||
* @param target name of the target
|
||||
*/
|
||||
void startTest(String target);
|
||||
/**
|
||||
* Invoked after a test target has been executed.
|
||||
* @param target name of the target
|
||||
*/
|
||||
void endTest(String target);
|
||||
/**
|
||||
* Invoked if an assert tasked caused an error during execution.
|
||||
* @param target name of the target
|
||||
* @param ae the failure
|
||||
*/
|
||||
void addFailure(String target, AssertionFailedException ae);
|
||||
/**
|
||||
* Invoked if any error other than a failed assertion occured
|
||||
* during execution.
|
||||
* @param target name of the target
|
||||
* @param ae the error
|
||||
*/
|
||||
void addError(String target, Throwable ae);
|
||||
}
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* 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
|
||||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
package org.apache.ant.antunit;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -27,16 +28,15 @@ import java.util.Vector;
|
|||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.Target;
|
||||
|
||||
/**
|
||||
* Run antunit tests suites. This AntUnitScriptRunner is responsible for the
|
||||
* management of the ant project and the correct invocation the target (taking
|
||||
/**
|
||||
* Run antunit tests suites. This AntUnitScriptRunner is responsible for the
|
||||
* management of the ant project and the correct invocation the target (taking
|
||||
* into account properly the [case]setUp and [case]tearDown targets).
|
||||
* The user can however provide the order of the test targets and or can filter
|
||||
* the list of test targets to execute.
|
||||
* The user must also provide its ProjectFactory and an AntUnitExecutionNotifier.
|
||||
* @since 1.2
|
||||
* @since 1.2
|
||||
*/
|
||||
public class AntUnitScriptRunner {
|
||||
|
||||
|
|
@ -69,13 +69,13 @@ public class AntUnitScriptRunner {
|
|||
* Object used to create projects in order to support test isolation.
|
||||
*/
|
||||
private final ProjectFactory prjFactory;
|
||||
|
||||
|
||||
/**
|
||||
* Indicates if the startSuite method has been invoked. Use to fail fast if the
|
||||
* the caller forget to call the startSuite method
|
||||
*/
|
||||
private boolean isSuiteStarted;
|
||||
|
||||
|
||||
/**
|
||||
* Does that script have a setUp target (defined when scanning the script)
|
||||
*/
|
||||
|
|
@ -99,20 +99,20 @@ public class AntUnitScriptRunner {
|
|||
/**
|
||||
* List of target names
|
||||
*/
|
||||
private final List<String> testTargets = new LinkedList<String>();
|
||||
private final List testTargets;
|
||||
|
||||
/**
|
||||
/**
|
||||
* The project currently used.
|
||||
*/
|
||||
private Project project = null;
|
||||
|
||||
/**
|
||||
* Indicates if a target has already be executed using this project.
|
||||
/**
|
||||
* Indicates if a target has already be executed using this project.
|
||||
* Value is undefined when project is null.
|
||||
*/
|
||||
private boolean projectIsDirty;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create a new AntScriptRunner on the given environment.
|
||||
* @param prjFactory A factory for the ant project that will contains the antunit test to execute.
|
||||
|
|
@ -122,16 +122,17 @@ public class AntUnitScriptRunner {
|
|||
public AntUnitScriptRunner(ProjectFactory prjFactory) throws BuildException {
|
||||
this.prjFactory = prjFactory;
|
||||
Project newProject = getCurrentProject();
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Target> targets = newProject.getTargets();
|
||||
Map targets = newProject.getTargets();
|
||||
hasSetUp = targets.containsKey(SETUP);
|
||||
hasTearDown = targets.containsKey(TEARDOWN);
|
||||
hasSuiteSetUp = targets.containsKey(SUITESETUP);
|
||||
hasSuiteTearDown = targets.containsKey(SUITETEARDOWN);
|
||||
|
||||
for (String name : targets.keySet()) {
|
||||
if (name.startsWith(TEST) && !TEST.equals(name)) {
|
||||
getTestTargets().add(name);
|
||||
testTargets = new LinkedList();
|
||||
Iterator it = targets.keySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
String name = (String) it.next();
|
||||
if (name.startsWith(TEST) && !name.equals(TEST)) {
|
||||
testTargets.add(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -140,7 +141,6 @@ public class AntUnitScriptRunner {
|
|||
* Get the project currently in use. The caller is not allowed to invoke a target or
|
||||
* do anything that would break the isolation of the test targets.
|
||||
* @throws BuildException The project can not be parsed
|
||||
* @return the current project
|
||||
*/
|
||||
public final Project getCurrentProject() throws BuildException {
|
||||
//Method is final because it is called from the constructor
|
||||
|
|
@ -159,30 +159,20 @@ public class AntUnitScriptRunner {
|
|||
project = prjFactory.createProject();
|
||||
}
|
||||
//we already set isDirty to true in order to make sure we didn't reuse
|
||||
//this project next time getCleanProject is called.
|
||||
//this project next time getCleanProject is called.
|
||||
projectIsDirty = true;
|
||||
return project;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return List<String> List of test targets of the script file
|
||||
* @return List<String> List of test targets of the script file
|
||||
*/
|
||||
@Deprecated
|
||||
public List<String> getTestTartgets() {
|
||||
return getTestTargets();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the (names of the) test targets to execute.
|
||||
* @return {@link List} of {@link String}
|
||||
*/
|
||||
public List<String> getTestTargets() {
|
||||
public List getTestTartgets() {
|
||||
return testTargets;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the name of the active script.
|
||||
* @return name of the project
|
||||
*/
|
||||
public String getName() {
|
||||
return getCurrentProject().getName();
|
||||
|
|
@ -190,9 +180,9 @@ public class AntUnitScriptRunner {
|
|||
|
||||
/**
|
||||
* Executes the suiteSetUp target if presents and report any execution error.
|
||||
* <p>A failure is reported to the notifier and by returning false.
|
||||
* Note that if the method return false, you are not allowed to run targets.</p>
|
||||
* @return false in case of execution failure. true in case of success.
|
||||
* A failure is reported to the notifier and by returning false.
|
||||
* Note that if the method return false, you are not allowed to run targets.
|
||||
* @return false in case of execution failure. true in case of success.
|
||||
*/
|
||||
private boolean startSuite(AntUnitExecutionNotifier notifier) {
|
||||
getCurrentProject().fireBuildStarted();
|
||||
|
|
@ -210,7 +200,7 @@ public class AntUnitScriptRunner {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Run the specific test target, possibly between the setUp and tearDown targets if
|
||||
* it exists. Exception or failures are reported to the notifier.
|
||||
* @param name name of the test target to execute.
|
||||
|
|
@ -222,13 +212,13 @@ public class AntUnitScriptRunner {
|
|||
throw new AssertionError();
|
||||
}
|
||||
Project newProject = getCleanProject();
|
||||
Vector<String> v = new Vector<String>();
|
||||
Vector v = new Vector();
|
||||
if (hasSetUp) {
|
||||
v.add(SETUP);
|
||||
}
|
||||
v.add(name);
|
||||
// create and register a logcapturer on the newProject
|
||||
new LogCapturer(newProject);
|
||||
LogCapturer lc = new LogCapturer(newProject);
|
||||
try {
|
||||
notifier.fireStartTest(name);
|
||||
newProject.executeTargets(v);
|
||||
|
|
@ -254,8 +244,8 @@ public class AntUnitScriptRunner {
|
|||
|
||||
/**
|
||||
* Executes the suiteTearDown target if presents and report any execution error.
|
||||
* @param caught Any internal exception triggered (and caught) by the caller indicating that
|
||||
* the execution could not be invoked as expected.
|
||||
* @param caught Any internal exception triggered (and caught) by the caller indicating that
|
||||
* the execution could not be invoked as expected.
|
||||
* @param notifier will receive execution notifications.
|
||||
*/
|
||||
private void endSuite(Throwable caught, AntUnitExecutionNotifier notifier) {
|
||||
|
|
@ -274,14 +264,14 @@ public class AntUnitScriptRunner {
|
|||
|
||||
/**
|
||||
* Try to see whether the BuildException e is an AssertionFailedException
|
||||
* or is caused by an AssertionFailedException. If so, fire a failure for
|
||||
* or is caused by an AssertionFailedException. If so, fire a failure for
|
||||
* given targetName. Otherwise fire an error.
|
||||
*/
|
||||
private void fireFailOrError(String targetName, BuildException e,
|
||||
private void fireFailOrError(String targetName, BuildException e,
|
||||
AntUnitExecutionNotifier notifier) {
|
||||
boolean failed = false;
|
||||
Throwable t = e;
|
||||
while (t instanceof BuildException) {
|
||||
while (t != null && t instanceof BuildException) {
|
||||
if (t instanceof AssertionFailedException) {
|
||||
failed = true;
|
||||
notifier.fireFail(targetName, (AssertionFailedException) t);
|
||||
|
|
@ -299,15 +289,17 @@ public class AntUnitScriptRunner {
|
|||
/**
|
||||
* Executes the suite.
|
||||
* @param suiteTargets An ordered list of test targets. It must be a sublist of getTestTargets
|
||||
* @param notifier is notified on test progress
|
||||
* @param notifier
|
||||
*/
|
||||
public void runSuite(List<String> suiteTargets, AntUnitExecutionNotifier notifier) {
|
||||
public void runSuite(List suiteTargets, AntUnitExecutionNotifier notifier) {
|
||||
Throwable caught = null;
|
||||
try {
|
||||
if (!startSuite(notifier)) {
|
||||
return;
|
||||
}
|
||||
for (String name : suiteTargets) {
|
||||
Iterator iter = suiteTargets.iterator();
|
||||
while (iter.hasNext()) {
|
||||
String name = (String) iter.next();
|
||||
runTarget(name, notifier);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
|
|
@ -316,4 +308,5 @@ public class AntUnitScriptRunner {
|
|||
endSuite(caught, notifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* 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
|
||||
|
|
@ -28,7 +28,7 @@ import org.apache.tools.ant.taskdefs.condition.ConditionBase;
|
|||
* Exits the active build, giving an additional message if the single
|
||||
* nested condition fails or if there is no condition at all.
|
||||
*
|
||||
* <p>This one could as well be implemented as</p>
|
||||
* <p>This one could as well be implemented as
|
||||
*
|
||||
* <pre>
|
||||
* <macrodef name="assertTrue">
|
||||
|
|
@ -44,7 +44,7 @@ import org.apache.tools.ant.taskdefs.condition.ConditionBase;
|
|||
* </macrodef>
|
||||
* </pre>
|
||||
*
|
||||
* <p>but wouldn't be able to throw a specialized exception that way -
|
||||
* but wouldn't be able to throw a specialized exception that way -
|
||||
* and the macrodef would nest the exception in yet another
|
||||
* BuildException.</p>
|
||||
*/
|
||||
|
|
@ -57,7 +57,6 @@ public class AssertTask extends ConditionBase {
|
|||
|
||||
/**
|
||||
* Message to use when the assertion fails.
|
||||
* @param value message to use when the assertion fails
|
||||
*/
|
||||
public void setMessage(String value) {
|
||||
this.message = value;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* 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
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* 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
|
||||
|
|
@ -37,7 +37,6 @@ public class ExpectFailureTask extends Sequential {
|
|||
|
||||
/**
|
||||
* The exception message to expect.
|
||||
* @param m the exception message to expect
|
||||
*/
|
||||
public void setExpectedMessage(String m) {
|
||||
expectedMessage = m;
|
||||
|
|
@ -46,7 +45,6 @@ public class ExpectFailureTask extends Sequential {
|
|||
/**
|
||||
* The message to use in the AssertionFailedException if the nested
|
||||
* tasks fail to raise the "correct" exception.
|
||||
* @param m message to use in the AssertionFailedException
|
||||
*/
|
||||
public void setMessage(String m) {
|
||||
message = m;
|
||||
|
|
@ -83,4 +81,4 @@ public class ExpectFailureTask extends Sequential {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -7,8 +7,8 @@
|
|||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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
|
||||
|
|
@ -20,14 +20,9 @@
|
|||
|
||||
package org.apache.ant.antunit;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.apache.tools.ant.BuildEvent;
|
||||
import org.apache.tools.ant.BuildListener;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Captures log messages generated during an antunit task run and
|
||||
|
|
@ -40,7 +35,11 @@ import org.apache.tools.ant.util.StringUtils;
|
|||
public class LogCapturer implements BuildListener {
|
||||
public static final String REFERENCE_ID = "ant.antunit.log";
|
||||
|
||||
private List<BuildEvent> events = Collections.synchronizedList(new LinkedList<BuildEvent>());
|
||||
private StringBuffer err = new StringBuffer();
|
||||
private StringBuffer warn = new StringBuffer();
|
||||
private StringBuffer info = new StringBuffer();
|
||||
private StringBuffer verbose = new StringBuffer();
|
||||
private StringBuffer debug = new StringBuffer();
|
||||
private Project p;
|
||||
|
||||
public LogCapturer(Project p) {
|
||||
|
|
@ -50,98 +49,38 @@ public class LogCapturer implements BuildListener {
|
|||
}
|
||||
|
||||
/**
|
||||
* All messages with <code>logLevel == Project.MSG_ERR</code>
|
||||
* merging messages into a single line.
|
||||
* @return All messages with <code>logLevel == Project.MSG_ERR</code>
|
||||
* All messages with <code>logLevel == Project.MSG_ERR</code>.
|
||||
*/
|
||||
public String getErrLog() {
|
||||
return getErrLog(true);
|
||||
return err.toString();
|
||||
}
|
||||
/**
|
||||
* All messages with <code>logLevel == Project.MSG_WARN</code> or
|
||||
* more severe merging messages into a single line.
|
||||
* @return All messages with <code>logLevel == Project.MSG_WARN</code> or above
|
||||
* more severe.
|
||||
*/
|
||||
public String getWarnLog() {
|
||||
return getWarnLog(true);
|
||||
return warn.toString();
|
||||
}
|
||||
/**
|
||||
* All messages with <code>logLevel == Project.MSG_INFO</code> or
|
||||
* more severe merging messages into a single line.
|
||||
* @return All messages with <code>logLevel == Project.MSG_INFO</code> or above
|
||||
* more severe.
|
||||
*/
|
||||
public String getInfoLog() {
|
||||
return getInfoLog(true);
|
||||
return info.toString();
|
||||
}
|
||||
/**
|
||||
* All messages with <code>logLevel == Project.MSG_VERBOSE</code> or
|
||||
* more severe merging messages into a single line.
|
||||
* @return All messages with <code>logLevel == Project.MSG_VERBOSE</code> or above
|
||||
* more severe.
|
||||
*/
|
||||
public String getVerboseLog() {
|
||||
return getVerboseLog(true);
|
||||
return verbose.toString();
|
||||
}
|
||||
/**
|
||||
* All messages with <code>logLevel == Project.MSG_DEBUG</code> or
|
||||
* more severe merging messages into a single line.
|
||||
* @return All messages with <code>logLevel == Project.MSG_DEBUG</code> or above
|
||||
* more severe.
|
||||
*/
|
||||
public String getDebugLog() {
|
||||
return getDebugLog(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* All messages with <code>logLevel == Project.MSG_ERR</code>.
|
||||
* @param mergeLines whether to merge messages into a single line
|
||||
* or split them into multiple lines
|
||||
* @return All messages with <code>logLevel == Project.MSG_ERR</code>
|
||||
*/
|
||||
public String getErrLog(boolean mergeLines) {
|
||||
return getLog(Project.MSG_ERR, mergeLines);
|
||||
}
|
||||
/**
|
||||
* All messages with <code>logLevel == Project.MSG_WARN</code> or
|
||||
* more severe.
|
||||
* @param mergeLines whether to merge messages into a single line
|
||||
* or split them into multiple lines
|
||||
* @return All messages with <code>logLevel == Project.MSG_WARN</code> or above
|
||||
* @since AntUnit 1.3
|
||||
*/
|
||||
public String getWarnLog(boolean mergeLines) {
|
||||
return getLog(Project.MSG_WARN, mergeLines);
|
||||
}
|
||||
/**
|
||||
* All messages with <code>logLevel == Project.MSG_INFO</code> or
|
||||
* more severe.
|
||||
* @param mergeLines whether to merge messages into a single line
|
||||
* or split them into multiple lines
|
||||
* @return All messages with <code>logLevel == Project.MSG_INFO</code> or above
|
||||
* @since AntUnit 1.3
|
||||
*/
|
||||
public String getInfoLog(boolean mergeLines) {
|
||||
return getLog(Project.MSG_INFO, mergeLines);
|
||||
}
|
||||
/**
|
||||
* All messages with <code>logLevel == Project.MSG_VERBOSE</code> or
|
||||
* more severe.
|
||||
* @param mergeLines whether to merge messages into a single line
|
||||
* or split them into multiple lines
|
||||
* @return All messages with <code>logLevel == Project.MSG_VERBOSE</code> or above
|
||||
* @since AntUnit 1.3
|
||||
*/
|
||||
public String getVerboseLog(boolean mergeLines) {
|
||||
return getLog(Project.MSG_VERBOSE, mergeLines);
|
||||
}
|
||||
/**
|
||||
* All messages with <code>logLevel == Project.MSG_DEBUG</code> or
|
||||
* more severe.
|
||||
* @param mergeLines whether to merge messages into a single line
|
||||
* or split them into multiple lines
|
||||
* @return All messages with <code>logLevel == Project.MSG_DEBUG</code> or above
|
||||
* @since AntUnit 1.3
|
||||
*/
|
||||
public String getDebugLog(boolean mergeLines) {
|
||||
return getLog(Project.MSG_DEBUG, mergeLines);
|
||||
return debug.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -179,24 +118,20 @@ public class LogCapturer implements BuildListener {
|
|||
* Record the message.
|
||||
*/
|
||||
public void messageLogged(BuildEvent event) {
|
||||
events.add(event);
|
||||
}
|
||||
|
||||
private String getLog(int minPriority, boolean mergeLines) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (BuildEvent buildEvent : new LinkedList<BuildEvent>(events)) {
|
||||
append(sb, buildEvent, minPriority, mergeLines);
|
||||
if (event.getPriority() <= Project.MSG_ERR) {
|
||||
err.append(event.getMessage());
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static void append(StringBuilder sb, BuildEvent event,
|
||||
int minPriority, boolean mergeLines) {
|
||||
if (event.getPriority() <= minPriority) {
|
||||
sb.append(event.getMessage());
|
||||
if (!mergeLines) {
|
||||
sb.append(StringUtils.LINE_SEP);
|
||||
}
|
||||
if (event.getPriority() <= Project.MSG_WARN) {
|
||||
warn.append(event.getMessage());
|
||||
}
|
||||
if (event.getPriority() <= Project.MSG_INFO) {
|
||||
info.append(event.getMessage());
|
||||
}
|
||||
if (event.getPriority() <= Project.MSG_VERBOSE) {
|
||||
verbose.append(event.getMessage());
|
||||
}
|
||||
if (event.getPriority() <= Project.MSG_DEBUG) {
|
||||
debug.append(event.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* 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
|
||||
|
|
@ -37,11 +37,9 @@ public class LogContains extends ProjectComponent implements Condition {
|
|||
|
||||
private String text;
|
||||
private int logLevel = Project.MSG_INFO;
|
||||
private boolean mergeLines = true;
|
||||
|
||||
/**
|
||||
* Test the log shall contain.
|
||||
* @param t text to look for
|
||||
*/
|
||||
public void setText(String t) {
|
||||
text = t;
|
||||
|
|
@ -49,22 +47,11 @@ public class LogContains extends ProjectComponent implements Condition {
|
|||
|
||||
/**
|
||||
* minimal log priority to consult.
|
||||
* @param echoLevel minimal log priority
|
||||
*/
|
||||
public void setLevel(Echo.EchoLevel echoLevel) {
|
||||
logLevel = echoLevel.getLevel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether to merge messages into a single line or split them into
|
||||
* multiple lines.
|
||||
* @since AntUnit 1.3
|
||||
* @param b whether to merge messages into a single line
|
||||
*/
|
||||
public void setMergeLines(boolean b) {
|
||||
mergeLines = b;
|
||||
}
|
||||
|
||||
public boolean eval() {
|
||||
if (text == null) {
|
||||
throw new BuildException("the text attribute is required");
|
||||
|
|
@ -75,19 +62,19 @@ public class LogContains extends ProjectComponent implements Condition {
|
|||
String log;
|
||||
switch (logLevel) {
|
||||
case Project.MSG_ERR:
|
||||
log = c.getErrLog(mergeLines);
|
||||
log = c.getErrLog();
|
||||
break;
|
||||
case Project.MSG_WARN:
|
||||
log = c.getWarnLog(mergeLines);
|
||||
log = c.getWarnLog();
|
||||
break;
|
||||
case Project.MSG_INFO:
|
||||
log = c.getInfoLog(mergeLines);
|
||||
log = c.getInfoLog();
|
||||
break;
|
||||
case Project.MSG_VERBOSE:
|
||||
log = c.getVerboseLog(mergeLines);
|
||||
log = c.getVerboseLog();
|
||||
break;
|
||||
case Project.MSG_DEBUG:
|
||||
log = c.getDebugLog(mergeLines);
|
||||
log = c.getDebugLog();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* 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
|
||||
|
|
@ -34,61 +34,34 @@ import org.apache.tools.ant.types.Resource;
|
|||
public class LogContent extends Resource {
|
||||
|
||||
private LogLevel level;
|
||||
private boolean mergeLines;
|
||||
|
||||
/**
|
||||
* Create a new LogContent resource.
|
||||
*/
|
||||
public LogContent() {
|
||||
this(null, LogLevel.INFO);
|
||||
setLevel(LogLevel.INFO);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new LogContent resource, specifying Project and log level.
|
||||
* <p>This constructor is provided primarily for convenience during
|
||||
* programmatic usage.</p>
|
||||
* @param p the test project
|
||||
* This constructor is provided primarily for convenience during
|
||||
* programmatic usage.
|
||||
* @param level the LogLevel.
|
||||
*/
|
||||
public LogContent(Project p, LogLevel level) {
|
||||
this(p, level, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new LogContent resource, specifying Project and log level.
|
||||
* <p>This constructor is provided primarily for convenience during
|
||||
* programmatic usage.</p>
|
||||
* @param p the test project
|
||||
* @param level the LogLevel.
|
||||
* @param mergeLines whether to merge messages into a single line
|
||||
* or split them into multiple lines
|
||||
* @since AntUnit 1.3
|
||||
*/
|
||||
public LogContent(Project p, LogLevel level, boolean mergeLines) {
|
||||
setProject(p);
|
||||
setLevel(level);
|
||||
setMergeLines(mergeLines);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the desired log level.
|
||||
* @param level a LogLevel enumerated attribute.
|
||||
*/
|
||||
public final void setLevel(LogLevel level) {
|
||||
public void setLevel(LogLevel level) {
|
||||
this.level = level;
|
||||
setName(level.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether to merge messages into a single line or split them into
|
||||
* multiple lines.
|
||||
* @since AntUnit 1.3
|
||||
* @param b whether to merge messages into a single line
|
||||
*/
|
||||
public final void setMergeLines(boolean b) {
|
||||
mergeLines = b;
|
||||
}
|
||||
|
||||
//inherit doc
|
||||
public InputStream getInputStream() throws IOException {
|
||||
if (isReference()) {
|
||||
|
|
@ -128,19 +101,19 @@ public class LogContent extends Resource {
|
|||
String log = null;
|
||||
switch (level.getLevel()) {
|
||||
case Project.MSG_ERR:
|
||||
log = lc.getErrLog(mergeLines);
|
||||
log = lc.getErrLog();
|
||||
break;
|
||||
case Project.MSG_WARN:
|
||||
log = lc.getWarnLog(mergeLines);
|
||||
log = lc.getWarnLog();
|
||||
break;
|
||||
case Project.MSG_INFO:
|
||||
log = lc.getInfoLog(mergeLines);
|
||||
log = lc.getInfoLog();
|
||||
break;
|
||||
case Project.MSG_VERBOSE:
|
||||
log = lc.getVerboseLog(mergeLines);
|
||||
log = lc.getVerboseLog();
|
||||
break;
|
||||
case Project.MSG_DEBUG:
|
||||
log = lc.getDebugLog(mergeLines);
|
||||
log = lc.getDebugLog();
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("how possible?");
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* 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
|
||||
|
|
@ -24,11 +24,11 @@ import org.apache.tools.ant.BuildException;
|
|||
import org.apache.tools.ant.Project;
|
||||
|
||||
/**
|
||||
* Provides project instances for AntUnit execution.
|
||||
* <p>The approach to creates a project depends on the context. When invoked from an
|
||||
* Provides project instances for AntUnit execution.<br/>
|
||||
* The approach to creates a project depends on the context. When invoked from an
|
||||
* ant project, some elements might be intialized from the parent project. When
|
||||
* executed in a junit runner, a brand new project must be initialized.</p>
|
||||
* <p>The AntScriptRunner will usually create multiple project in order to provide test isolation.</p>
|
||||
* executed in a junit runner, a brand new project must be initialized.<br/>
|
||||
* The AntScriptRunner will usually creates multiple project in order to provide test isolation.
|
||||
* @since 1.2
|
||||
*/
|
||||
public interface ProjectFactory {
|
||||
|
|
@ -36,8 +36,7 @@ public interface ProjectFactory {
|
|||
/**
|
||||
* Creates a new project instance and configures it according to the execution context.
|
||||
* @throws BuildException The project can not be created (probably parsed)
|
||||
* @return a new project
|
||||
*/
|
||||
Project createProject() throws BuildException;
|
||||
public Project createProject() throws BuildException;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* 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
|
||||
|
|
@ -21,11 +21,9 @@
|
|||
package org.apache.ant.antunit;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.ProjectComponent;
|
||||
import org.apache.tools.ant.taskdefs.condition.Condition;
|
||||
import org.apache.tools.ant.types.Resource;
|
||||
import org.apache.tools.ant.types.ResourceCollection;
|
||||
|
||||
/**
|
||||
* A condition that tests whether a given resource exists.
|
||||
|
|
@ -34,76 +32,34 @@ import org.apache.tools.ant.types.ResourceCollection;
|
|||
*/
|
||||
public class ResourceExists extends ProjectComponent implements Condition {
|
||||
private Resource resource;
|
||||
private String refid;
|
||||
|
||||
/**
|
||||
* The resource to check as attribute.
|
||||
*
|
||||
* <p>Exactly one resource must be specfied either as attribute or
|
||||
* nested element.</p>
|
||||
* @param r resource to check
|
||||
*/
|
||||
public void setResource(Resource r) {
|
||||
onlyOne();
|
||||
if (resource != null) {
|
||||
throw new BuildException("Only one resource can be tested.");
|
||||
}
|
||||
resource = r;
|
||||
}
|
||||
|
||||
/**
|
||||
* The resource to check as a refid.
|
||||
* @since AntUnit 1.3
|
||||
* @param refid resource to check as a refid
|
||||
*/
|
||||
public void setRefid(String refid) {
|
||||
onlyOne();
|
||||
this.refid = refid;
|
||||
}
|
||||
|
||||
/**
|
||||
* The resource to check as nested element.
|
||||
*
|
||||
* <p>Exactly one resource must be specfied either as attribute or
|
||||
* nested element.</p>
|
||||
* @param r resource to check
|
||||
*/
|
||||
public void add(Resource r) {
|
||||
setResource(r);
|
||||
}
|
||||
|
||||
public boolean eval() {
|
||||
if (resource == null && refid == null) {
|
||||
if (resource == null) {
|
||||
throw new BuildException("You must specify a resource.");
|
||||
}
|
||||
Resource r = resource != null ? resource : expandRefId();
|
||||
log("Checking: " + r, Project.MSG_VERBOSE);
|
||||
return r.isExists();
|
||||
}
|
||||
|
||||
private void onlyOne() {
|
||||
if (resource != null || refid != null) {
|
||||
throw new BuildException("Only one resource can be tested.");
|
||||
}
|
||||
}
|
||||
|
||||
// logic stolen from Ant's ResourceContains condition
|
||||
private Resource expandRefId() {
|
||||
if (getProject() == null) {
|
||||
throw new BuildException("Cannot retrieve refid; project unset");
|
||||
}
|
||||
Object o = getProject().getReference(refid);
|
||||
if (!(o instanceof Resource)) {
|
||||
if (o instanceof ResourceCollection) {
|
||||
ResourceCollection rc = (ResourceCollection) o;
|
||||
if (rc.size() == 1) {
|
||||
o = rc.iterator().next();
|
||||
} else {
|
||||
throw new BuildException("Referred resource collection must"
|
||||
+ " contain exactly one resource.");
|
||||
}
|
||||
} else {
|
||||
throw new BuildException("'" + refid + "' is not a resource but "
|
||||
+ String.valueOf(o));
|
||||
}
|
||||
}
|
||||
return (Resource) o;
|
||||
return resource.isExists();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ 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
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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
|
||||
|
|
@ -17,7 +17,7 @@ KIND, either express or implied. See the License for the
|
|||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<antlib xmlns:au="ant:current">
|
||||
<antlib xmlns:au="antlib:org.apache.ant.antunit">
|
||||
<taskdef name="antunit"
|
||||
classname="org.apache.ant.antunit.AntUnit"/>
|
||||
|
||||
|
|
@ -36,9 +36,6 @@ under the License.
|
|||
<typedef name="failurelistener"
|
||||
classname="org.apache.ant.antunit.listener.FailureAntUnitListener"/>
|
||||
|
||||
<typedef name="logforwarder"
|
||||
classname="org.apache.ant.antunit.listener.LogForwarder"/>
|
||||
|
||||
<typedef name="logcapturer"
|
||||
classname="org.apache.ant.antunit.LogCapturer"/>
|
||||
|
||||
|
|
@ -88,22 +85,6 @@ under the License.
|
|||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<macrodef name="assertNotEquals" backtrace="false">
|
||||
<attribute name="notExpected"/>
|
||||
<attribute name="actual"/>
|
||||
<attribute name="casesensitive" default="true"/>
|
||||
<attribute name="message"
|
||||
default="Didn't expect '@{notExpected}' to be '@{actual}'"/>
|
||||
<sequential>
|
||||
<au:fail message="@{message}">
|
||||
<not>
|
||||
<equals arg1="@{notExpected}" arg2="@{actual}"
|
||||
casesensitive="@{casesensitive}"/>
|
||||
</not>
|
||||
</au:fail>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<macrodef name="assertPropertySet" backtrace="false">
|
||||
<attribute name="name"/>
|
||||
<attribute name="message"
|
||||
|
|
@ -115,19 +96,6 @@ under the License.
|
|||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<macrodef name="assertPropertyNotSet" backtrace="false">
|
||||
<attribute name="name"/>
|
||||
<attribute name="message"
|
||||
default="Didn't expect property '@{name}' to be set but was '${@{name}}'"/>
|
||||
<sequential>
|
||||
<au:fail message="@{message}">
|
||||
<not>
|
||||
<isset property="@{name}"/>
|
||||
</not>
|
||||
</au:fail>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<macrodef name="assertPropertyEquals" backtrace="false">
|
||||
<attribute name="name"/>
|
||||
<attribute name="value"/>
|
||||
|
|
@ -141,19 +109,6 @@ under the License.
|
|||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<macrodef name="assertPropertyNotEquals" backtrace="false">
|
||||
<attribute name="name"/>
|
||||
<attribute name="value"/>
|
||||
<attribute name="casesensitive" default="true"/>
|
||||
<attribute name="message"
|
||||
default="Didn't expect property '@{name}' to have value '@{value}'"/>
|
||||
<sequential>
|
||||
<au:assertPropertySet message="@{message}" name="@{name}"/>
|
||||
<au:assertNotEquals message="@{message}" notexpected="@{value}"
|
||||
actual="${@{name}}" casesensitive="@{casesensitive}"/>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<macrodef name="assertPropertyContains" backtrace="false">
|
||||
<attribute name="name"/>
|
||||
<attribute name="value"/>
|
||||
|
|
@ -168,24 +123,7 @@ under the License.
|
|||
</au:fail>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<macrodef name="assertPropertyDoesntContain" backtrace="false">
|
||||
<attribute name="name"/>
|
||||
<attribute name="value"/>
|
||||
<attribute name="casesensitive" default="true"/>
|
||||
<attribute name="message"
|
||||
default="Didn't expect property '@{name}' to contain value '@{value}' but was '${@{name}}'"/>
|
||||
<sequential>
|
||||
<au:assertPropertySet message="@{message}" name="@{name}"/>
|
||||
<au:fail message="@{message}">
|
||||
<not>
|
||||
<contains string="${@{name}}" substring="@{value}"
|
||||
casesensitive="@{casesensitive}"/>
|
||||
</not>
|
||||
</au:fail>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
|
||||
<macrodef name="assertFileExists" backtrace="false">
|
||||
<attribute name="file"/>
|
||||
<attribute name="message"
|
||||
|
|
@ -235,11 +173,11 @@ under the License.
|
|||
<attribute name="value"/>
|
||||
<attribute name="casesensitive" default="true"/>
|
||||
<attribute name="message"
|
||||
default="Expected resource '@{resource}' to contain value '@{value}' but was '${@{resource}}'"/>
|
||||
default="Expected resource '@{resource}' to contain value '@{value}' but was '${@{resource}}'"/>
|
||||
<sequential>
|
||||
<au:assertResourceExists resource="@{resource}"/>
|
||||
<au:fail message="@{message}">
|
||||
<resourcecontains resource="@{resource}" substring="@{value}"
|
||||
<resourcecontains resource="@{resource}" substring="@{value}"
|
||||
casesensitive="@{casesensitive}"/>
|
||||
</au:fail>
|
||||
</sequential>
|
||||
|
|
@ -250,85 +188,10 @@ under the License.
|
|||
<attribute name="value"/>
|
||||
<attribute name="casesensitive" default="true"/>
|
||||
<attribute name="message"
|
||||
default="Didn't expect resource '@{resource}' to contain value '@{value}' but was '${@{resource}}'"/>
|
||||
default="Didn't expect resource '@{resource}' to contain value '@{value}' but was '${@{resource}}'"/>
|
||||
<sequential>
|
||||
<au:assertFalse message="@{message}">
|
||||
<resourcecontains resource="@{resource}" substring="@{value}"
|
||||
casesensitive="@{casesensitive}"/>
|
||||
</au:assertFalse>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<macrodef name="assertNestedResourceExists" backtrace="false">
|
||||
<attribute name="message" default="Expected resource to exist"/>
|
||||
<element name="nested-resource" implicit="true"/>
|
||||
<sequential>
|
||||
<au:fail message="@{message}">
|
||||
<au:resourceExists>
|
||||
<nested-resource/>
|
||||
</au:resourceExists>
|
||||
</au:fail>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<macrodef name="assertNestedResourceDoesntExist" backtrace="false">
|
||||
<attribute name="message" default="Didn't expect resource to exist"/>
|
||||
<element name="nested-resource" implicit="true"/>
|
||||
<sequential>
|
||||
<au:assertFalse message="@{message}">
|
||||
<au:resourceExists>
|
||||
<nested-resource/>
|
||||
</au:resourceExists>
|
||||
</au:assertFalse>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<macrodef name="assertRefResourceExists" backtrace="false">
|
||||
<attribute name="refid"/>
|
||||
<attribute name="message"
|
||||
default="Expected resource '@{refid}' to exist"/>
|
||||
<sequential>
|
||||
<au:fail message="@{message}">
|
||||
<au:resourceExists refid="@{refid}"/>
|
||||
</au:fail>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<macrodef name="assertRefResourceDoesntExist" backtrace="false">
|
||||
<attribute name="refid"/>
|
||||
<attribute name="message"
|
||||
default="Didn't expect resource '@{refid}' to exist"/>
|
||||
<sequential>
|
||||
<au:assertFalse message="@{message}">
|
||||
<au:resourceExists refid="@{refid}"/>
|
||||
</au:assertFalse>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<macrodef name="assertRefResourceContains">
|
||||
<attribute name="refid"/>
|
||||
<attribute name="value"/>
|
||||
<attribute name="casesensitive" default="true"/>
|
||||
<attribute name="message"
|
||||
default="Expected resource '@{refid}' to contain value '@{value}'"/>
|
||||
<sequential>
|
||||
<au:assertRefResourceExists refid="@{refid}"/>
|
||||
<au:fail message="@{message}">
|
||||
<resourcecontains refid="@{refid}" substring="@{value}"
|
||||
casesensitive="@{casesensitive}"/>
|
||||
</au:fail>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<macrodef name="assertRefResourceDoesntContain">
|
||||
<attribute name="refid"/>
|
||||
<attribute name="value"/>
|
||||
<attribute name="casesensitive" default="true"/>
|
||||
<attribute name="message"
|
||||
default="Didn't expect resource '@{refid}' to contain value '@{value}'"/>
|
||||
<sequential>
|
||||
<au:assertFalse message="@{message}">
|
||||
<resourcecontains refid="@{refid}" substring="@{value}"
|
||||
<resourcecontains resource="@{resource}" substring="@{value}"
|
||||
casesensitive="@{casesensitive}"/>
|
||||
</au:assertFalse>
|
||||
</sequential>
|
||||
|
|
@ -393,19 +256,6 @@ under the License.
|
|||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<macrodef name="assertReferenceIsNotSet" backtrace="false">
|
||||
<attribute name="refid"/>
|
||||
<attribute name="message"
|
||||
default="Didn't expect reference '@{refid}'"/>
|
||||
<sequential>
|
||||
<au:fail message="@{message}">
|
||||
<not>
|
||||
<isreference refid="@{refid}"/>
|
||||
</not>
|
||||
</au:fail>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<macrodef name="assertReferenceIsType" backtrace="false">
|
||||
<attribute name="refid"/>
|
||||
<attribute name="type"/>
|
||||
|
|
@ -422,13 +272,11 @@ under the License.
|
|||
<macrodef name="assertLogContains" backtrace="false">
|
||||
<attribute name="text"/>
|
||||
<attribute name="level" default="info"/>
|
||||
<attribute name="mergeLines" default="true"/>
|
||||
<attribute name="message"
|
||||
default="Expected log to contain '@{text}' at level @{level}"/>
|
||||
<sequential>
|
||||
<au:fail message="@{message}">
|
||||
<au:logcontains text="@{text}" level="@{level}"
|
||||
mergeLines="@{mergeLines}"/>
|
||||
<au:logcontains text="@{text}" level="@{level}"/>
|
||||
</au:fail>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
|
@ -436,13 +284,11 @@ under the License.
|
|||
<macrodef name="assertLogDoesntContain" backtrace="false">
|
||||
<attribute name="text"/>
|
||||
<attribute name="level" default="info"/>
|
||||
<attribute name="mergeLines" default="true"/>
|
||||
<attribute name="message"
|
||||
default="Unexpected log '@{text}' at level @{level}"/>
|
||||
<sequential>
|
||||
<au:assertFalse message="@{message}">
|
||||
<au:logcontains text="@{text}" level="@{level}"
|
||||
mergeLines="@{mergeLines}"/>
|
||||
<au:logcontains text="@{text}" level="@{level}"/>
|
||||
</au:assertFalse>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
|
@ -457,7 +303,7 @@ under the License.
|
|||
default="Expected '@{string}' to match pattern '@{pattern}'"/>
|
||||
<sequential>
|
||||
<au:fail message="@{message}">
|
||||
<matches string="@{string}" pattern="@{pattern}"
|
||||
<matches string="@{string}" pattern="@{pattern}"
|
||||
casesensitive="@{casesensitive}"
|
||||
singleline="@{singleline}"
|
||||
multiline="@{multiline}"/>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* 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
|
||||
|
|
@ -23,6 +23,7 @@ package org.apache.ant.antunit.junit3;
|
|||
import java.io.File;
|
||||
import java.io.PrintStream;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.Test;
|
||||
|
|
@ -51,21 +52,21 @@ public class AntUnitSuite extends TestSuite {
|
|||
|
||||
/**
|
||||
* Create a JUnit TestSuite that when executed will run the given ant
|
||||
* script.
|
||||
* <p>Note that it is the responsibility of the caller to give the correct
|
||||
* script.<br/>
|
||||
* Note that it is the responsibility of the caller to give the correct
|
||||
* File reference. Namely, if the File is a relative file, it will
|
||||
* be resolve relatively to the execution directory (which might be
|
||||
* different different from the project root directory).</p>
|
||||
*
|
||||
* different different from the project root directory).
|
||||
*
|
||||
* @param scriptFile
|
||||
* AntUnit script file
|
||||
* @param rootClass
|
||||
* The test class that creates this suite. This is used to give
|
||||
* a name to the suite so that an IDE can reexecute this suite.
|
||||
*/
|
||||
public AntUnitSuite(File scriptFile, Class<?> rootClass) {
|
||||
public AntUnitSuite(File scriptFile, Class rootClass) {
|
||||
setName(rootClass.getName()); //This name allows eclipse to reexecute the test
|
||||
final AntUnitScriptRunner createdScriptRunner;
|
||||
AntUnitScriptRunner createdScriptRunner = null;
|
||||
try {
|
||||
MyProjectFactory prjFactory = new MyProjectFactory(scriptFile);
|
||||
createdScriptRunner = new AntUnitScriptRunner(prjFactory);
|
||||
|
|
@ -81,8 +82,11 @@ public class AntUnitSuite extends TestSuite {
|
|||
initializationReportingTest = null;
|
||||
stdout = new MultiProjectDemuxOutputStream(antScriptRunner, false);
|
||||
stderr = new MultiProjectDemuxOutputStream(antScriptRunner, true);
|
||||
for (String target : antScriptRunner.getTestTargets()) {
|
||||
addTest(new AntUnitTestCase(this, scriptFile, target));
|
||||
List testTargets = antScriptRunner.getTestTartgets();
|
||||
for (Iterator it = testTargets.iterator(); it.hasNext();) {
|
||||
String target = (String) it.next();
|
||||
AntUnitTestCase tc = new AntUnitTestCase(this, scriptFile, target);
|
||||
addTest(tc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -96,39 +100,37 @@ public class AntUnitSuite extends TestSuite {
|
|||
MyProjectFactory prjFactory = new MyProjectFactory(scriptFile);
|
||||
antScriptRunner = new AntUnitScriptRunner(prjFactory);
|
||||
//the exception is throwed, and it is up to the AntUnitTestCase to handle it.
|
||||
initializationReportingTest = null;
|
||||
initializationReportingTest = null;
|
||||
stdout = new MultiProjectDemuxOutputStream(antScriptRunner, false);
|
||||
stderr = new MultiProjectDemuxOutputStream(antScriptRunner, true);
|
||||
setName(antScriptRunner.getName() + "[" + scriptFile + "]");
|
||||
addTest(singleTc);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* <p>Run the full AntUnit suite.</p>
|
||||
* @Override Run the full AntUnit suite
|
||||
*/
|
||||
public void run(TestResult testResult) {
|
||||
if (initializationReportingTest != null) {
|
||||
if (initializationReportingTest!=null) {
|
||||
initializationReportingTest.run(testResult);
|
||||
} else {
|
||||
List<String> testTargets = antScriptRunner.getTestTargets();
|
||||
List testTartgets = antScriptRunner.getTestTartgets();
|
||||
JUnitNotificationAdapter notifier = new JUnitNotificationAdapter(
|
||||
testResult, tests());
|
||||
runInContainer(testTargets, notifier);
|
||||
runInContainer(testTartgets, notifier);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* <p>Run a single test target of the AntUnit suite. suiteSetUp,
|
||||
* setUp, tearDown and suiteTearDown are executed around it.</p>
|
||||
* @Override Run a single test target of the AntUnit suite. suiteSetUp,
|
||||
* setUp, tearDown and suiteTearDown are executed around it.
|
||||
*/
|
||||
public void runTest(Test test, TestResult result) {
|
||||
if (initializationReportingTest!=null) {
|
||||
initializationReportingTest.run(result);
|
||||
} else {
|
||||
String targetName = ((AntUnitTestCase) test).getTarget();
|
||||
List<String> singleTargetList = Collections.singletonList(targetName);
|
||||
List singleTargetList = Collections.singletonList(targetName);
|
||||
JUnitNotificationAdapter notifier = new JUnitNotificationAdapter(
|
||||
result, tests());
|
||||
runInContainer(singleTargetList, notifier);
|
||||
|
|
@ -137,16 +139,16 @@ public class AntUnitSuite extends TestSuite {
|
|||
|
||||
/**
|
||||
* Execute the test suite in a 'container' similar to the ant 'container'.
|
||||
* <p>When ant executes a project it redirect the input and the output. In this
|
||||
* When ant executes a project it redirect the input and the output. In this
|
||||
* context we will only redirect output (unit test are not supposed to be
|
||||
* interactive).</p>
|
||||
*
|
||||
* interactive).<br/>
|
||||
*
|
||||
* @param targetList
|
||||
* The list of test target to execute
|
||||
* @param notifier
|
||||
* The AntUnit notifier that will receive execution notifications
|
||||
*/
|
||||
public void runInContainer(List<String> targetList, AntUnitExecutionNotifier notifier) {
|
||||
public void runInContainer(List targetList, AntUnitExecutionNotifier notifier) {
|
||||
PrintStream savedErr = System.err;
|
||||
PrintStream savedOut = System.out;
|
||||
try {
|
||||
|
|
@ -172,7 +174,7 @@ public class AntUnitSuite extends TestSuite {
|
|||
this.scriptFile = scriptFile;
|
||||
}
|
||||
|
||||
public Project createProject() {
|
||||
public Project createProject() {
|
||||
ProjectHelper prjHelper = ProjectHelper.getProjectHelper();
|
||||
Project prj = new Project();
|
||||
DefaultLogger logger = new DefaultLogger();
|
||||
|
|
@ -194,6 +196,8 @@ public class AntUnitSuite extends TestSuite {
|
|||
}
|
||||
|
||||
public BuildException getAntInitialisationException() {
|
||||
return hasAntInitError() ? initializationReportingTest.getAntScriptError() : null;
|
||||
return hasAntInitError() ?
|
||||
initializationReportingTest.getAntScriptError() :
|
||||
null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* 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
|
||||
|
|
@ -28,16 +28,15 @@ import junit.framework.TestCase;
|
|||
import junit.framework.TestResult;
|
||||
|
||||
/**
|
||||
* JUnit TestCase that executes a single AntUnit target.
|
||||
* <p>This class is not
|
||||
* supposed to be used directly.</p>
|
||||
* <p>It is public only because junit must access it as a public.</p>
|
||||
* JUnit TestCase that will executes a single AntUnit target. This class is not
|
||||
* supposed to be used directly. <br/>
|
||||
* It is public only because junit must access it as a public.
|
||||
*/
|
||||
public class AntUnitTestCase extends TestCase {
|
||||
// We have to extends TestCase, and not implements Test because otherwise
|
||||
// JUnit4 will derive the Description composing the suite description from
|
||||
// We have to extends TestCase, and not implements Test because otherwise
|
||||
// JUnit4 will derive the Description composing the suite description from
|
||||
// this className only (AntUnitTestCase), and not from the name.
|
||||
// However, during execution it use the right Description (base on the
|
||||
// However, during execution it use the right Description (base on the
|
||||
// toString)
|
||||
|
||||
/**
|
||||
|
|
@ -56,25 +55,24 @@ public class AntUnitTestCase extends TestCase {
|
|||
* class has been created directly by the IDE from its name.
|
||||
* In case of initialisation problem when the test is build from the suite,
|
||||
* the problem is handled at the level of the suite (and this object is never
|
||||
* created)
|
||||
* created)
|
||||
*/
|
||||
private final BuildException initialisationException;
|
||||
|
||||
|
||||
/**
|
||||
* Prepare an AntUnitTestCase that will be executed alone.
|
||||
* <p>This constructor
|
||||
* is typically used by a junit 3 runner that will reexecute a specific
|
||||
* test.</p>
|
||||
* <p>The execution of this test will be embed in a suiteSetUp and
|
||||
* suiteTearDown.</p>
|
||||
* @param name The name of the AntUnitTestCase, normally obtained from a
|
||||
* previous execution.
|
||||
* Prepare an AntUnitTestCase that will be executed alone. This constructor
|
||||
* is typically used by a junit 3 runner that will reexecute a specific
|
||||
* test.</br>
|
||||
* The execution of this test will be embed in a suiteSetUp and
|
||||
* suiteTearDown.
|
||||
* @param name The name of the AntUnitTestCase, normally obtained from a
|
||||
* previous execution.
|
||||
*/
|
||||
public AntUnitTestCase(String name) {
|
||||
super(name);
|
||||
BuildException catchedEx = null;
|
||||
AntUnitSuite createdSuite = null;
|
||||
TestCaseName nameParser = new TestCaseName(name);
|
||||
TestCaseName nameParser = new TestCaseName(name);
|
||||
try {
|
||||
createdSuite = new AntUnitSuite(this, nameParser.getScript());
|
||||
} catch (BuildException e) {
|
||||
|
|
@ -92,10 +90,10 @@ public class AntUnitTestCase extends TestCase {
|
|||
* suite that prepare the antScriptRunner and the JUnitExcutionPlatform. It
|
||||
* is the responsibility of the suite to execute the suiteSetUp and the
|
||||
* suiteTearDown.
|
||||
*
|
||||
* @param target test target
|
||||
* @param suite test suite
|
||||
* @param scriptFile test file
|
||||
*
|
||||
* @param target
|
||||
* @param antScriptRunner
|
||||
* @param executionEnv
|
||||
*/
|
||||
public AntUnitTestCase(AntUnitSuite suite, File scriptFile, String target) {
|
||||
// The name can be reused by eclipse when running a single test
|
||||
|
|
@ -105,18 +103,16 @@ public class AntUnitTestCase extends TestCase {
|
|||
this.initialisationException = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the AntUnit test target name.
|
||||
* @return target name
|
||||
*/
|
||||
/** Get the AntUnit test target name */
|
||||
public String getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Called by a Junit Runner that want to executes specifically
|
||||
* this test target.
|
||||
* <p>This implementation delegates the call to the suite.</p>
|
||||
* This implementation delegates the call to the suite.
|
||||
* @Overwrite
|
||||
*/
|
||||
public void run(TestResult result) {
|
||||
if (initialisationException==null && suite!=null) {
|
||||
|
|
@ -139,7 +135,7 @@ public class AntUnitTestCase extends TestCase {
|
|||
protected void runTest() throws BuildException {
|
||||
throw initialisationException;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle the serialization and the parsing of the name of a TestCase. The
|
||||
* name of the TestCase contains the filename of the script and the target,
|
||||
|
|
|
|||
|
|
@ -1,56 +1,59 @@
|
|||
/*
|
||||
* 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
|
||||
*
|
||||
* https://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.ant.antunit.junit3;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
|
||||
/**
|
||||
* A TestCase that will just report an error when running. This is pretty useful
|
||||
* when an error is detected during initialization.
|
||||
*/
|
||||
public class ErrorTestCase extends TestCase {
|
||||
|
||||
/** The name we use for the error test case ('warning') */
|
||||
public static final String NAME = "warning";
|
||||
|
||||
private final BuildException ex;
|
||||
|
||||
/**
|
||||
* Creates a TestCase that will report the Ant BuildException when running.
|
||||
* @param antScriptError The Ant BuildException that triggered the initialization
|
||||
* failure
|
||||
*/
|
||||
public ErrorTestCase(BuildException antScriptError) {
|
||||
super(NAME);
|
||||
this.ex = antScriptError;
|
||||
}
|
||||
|
||||
protected void runTest() throws BuildException {
|
||||
throw ex;
|
||||
}
|
||||
|
||||
public BuildException getAntScriptError() {
|
||||
return ex;
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* 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.ant.antunit.junit3;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
|
||||
/**
|
||||
* A TestCase that will just report an error when running. This is pretty useful
|
||||
* when an error is detected during initialization.
|
||||
*/
|
||||
public class ErrorTestCase extends TestCase {
|
||||
|
||||
/** The name we use for the error test case ('warning') */
|
||||
public static final String NAME = "warning";
|
||||
|
||||
private final BuildException ex;
|
||||
|
||||
/**
|
||||
* Creates a TestCase that will report the Ant BuildException when running.
|
||||
* @param antScriptError The Ant BuildException that triggered the initialization
|
||||
* failure
|
||||
*/
|
||||
public ErrorTestCase(BuildException antScriptError) {
|
||||
super(NAME);
|
||||
this.ex = antScriptError;
|
||||
}
|
||||
|
||||
/**
|
||||
* @overwrite
|
||||
*/
|
||||
protected void runTest() throws BuildException {
|
||||
throw ex;
|
||||
}
|
||||
|
||||
public BuildException getAntScriptError() {
|
||||
return ex;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* 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
|
||||
|
|
@ -36,9 +36,9 @@ import org.apache.ant.antunit.AssertionFailedException;
|
|||
class JUnitNotificationAdapter implements AntUnitExecutionNotifier {
|
||||
|
||||
private final TestResult junitTestResult;
|
||||
private Map<String, AntUnitTestCase> testByTarget = new HashMap<String, AntUnitTestCase>();
|
||||
private Map testByTarget = new HashMap();
|
||||
|
||||
public JUnitNotificationAdapter(TestResult testResult, Enumeration<Test> tests) {
|
||||
public JUnitNotificationAdapter(TestResult testResult, Enumeration tests) {
|
||||
this.junitTestResult = testResult;
|
||||
while(tests.hasMoreElements()) {
|
||||
AntUnitTestCase test = (AntUnitTestCase) tests.nextElement();
|
||||
|
|
@ -48,22 +48,22 @@ class JUnitNotificationAdapter implements AntUnitExecutionNotifier {
|
|||
|
||||
public void fireStartTest(String targetName) {
|
||||
//TODO : if it is null, eclipse stop the unit test (add a unit test)
|
||||
junitTestResult.startTest(testByTarget.get(targetName));
|
||||
junitTestResult.startTest((Test) testByTarget.get(targetName));
|
||||
}
|
||||
|
||||
|
||||
public void fireEndTest(String targetName) {
|
||||
junitTestResult.endTest(testByTarget.get(targetName));
|
||||
junitTestResult.endTest((Test) testByTarget.get(targetName));
|
||||
}
|
||||
|
||||
public void fireError(String targetName, Throwable t) {
|
||||
junitTestResult.addError(testByTarget.get(targetName), t);
|
||||
junitTestResult.addError((Test) testByTarget.get(targetName), t);
|
||||
}
|
||||
|
||||
public void fireFail(String targetName, AssertionFailedException ae) {
|
||||
//I don't see how to transform the AntUnit assertion exception into
|
||||
//I don't see how to transform the AntUnit assertion exception into
|
||||
//junit assertion exception (we would loose the stack trace).
|
||||
//So failures will be reported as errors
|
||||
junitTestResult.addError(testByTarget.get(targetName), ae);
|
||||
junitTestResult.addError((Test) testByTarget.get(targetName), ae);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* 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
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* 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
|
||||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
package org.apache.ant.antunit.junit4;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
|
@ -32,8 +33,8 @@ import java.util.Iterator;
|
|||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.ant.antunit.AntUnitExecutionNotifier;
|
||||
|
|
@ -57,42 +58,45 @@ import org.junit.runner.notification.RunNotifier;
|
|||
* run junit3 test. However, the test may be faster with this Runner (with the
|
||||
* default junit4 adapter, the suiteSetUp and suiteTearDown will be executed
|
||||
* around every test target). Also, more features are available when this runner
|
||||
* is used (filtering & sorting)
|
||||
* is used (filtering & sorting)
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class AntUnitSuiteRunner extends Runner implements Filterable, Sortable {
|
||||
|
||||
private final AntUnitSuite junit3Suite;
|
||||
private final Map<String, Description> targetDescriptions = new HashMap<String, Description>();
|
||||
private final List<String> targetsOrder = new LinkedList<String>();
|
||||
|
||||
private AntUnitSuiteRunner(AntUnitSuite suite, Class<?> junitTestClass) throws InitializationError {
|
||||
private final Map/*<String, Description>*/ targetDescriptions = new HashMap();
|
||||
private final List/*<String>*/ targetsOrder = new LinkedList();
|
||||
|
||||
private AntUnitSuiteRunner(AntUnitSuite suite, Class junitTestClass) throws InitializationError {
|
||||
junit3Suite = suite;
|
||||
if (suite.hasAntInitError()) {
|
||||
throw new InitializationError(suite.getAntInitialisationException());
|
||||
}
|
||||
for (Enumeration<Test> tests = suite.tests(); tests.hasMoreElements();) {
|
||||
TestCase nextTc = (TestCase) tests.nextElement();
|
||||
//TODO Handle the possibility for the user to define suite of AntUnit scripts
|
||||
AntUnitTestCase tc = (AntUnitTestCase) nextTc;
|
||||
Description tc_desc = Description.createTestDescription(junitTestClass, tc.getName());
|
||||
targetDescriptions.put(tc.getTarget(), tc_desc);
|
||||
targetsOrder.add(tc.getTarget());
|
||||
throw new InitializationError(
|
||||
new Throwable[] { suite.getAntInitialisationException() }
|
||||
);
|
||||
} else {
|
||||
Enumeration tests = suite.tests();
|
||||
while (tests.hasMoreElements()) {
|
||||
TestCase nextTc = (TestCase) tests.nextElement();
|
||||
//TODO Handle the possibility for the user to define suite of AntUnit scripts
|
||||
AntUnitTestCase tc = (AntUnitTestCase) nextTc;
|
||||
Description tc_desc = Description.createTestDescription(junitTestClass, tc.getName());
|
||||
targetDescriptions.put(tc.getTarget(), tc_desc);
|
||||
targetsOrder.add(tc.getTarget());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public AntUnitSuiteRunner(Class<?> testCaseClass) throws InitializationError {
|
||||
public AntUnitSuiteRunner(Class testCaseClass) throws InitializationError {
|
||||
this(getJUnit3AntSuite(testCaseClass), testCaseClass);
|
||||
}
|
||||
|
||||
private static AntUnitSuite getJUnit3AntSuite(Class<?> testCaseClass)
|
||||
private static AntUnitSuite getJUnit3AntSuite(Class testCaseClass)
|
||||
throws InitializationError {
|
||||
try {
|
||||
Method suiteMethod = testCaseClass.getMethod("suite");
|
||||
Method suiteMethod = testCaseClass.getMethod("suite", new Class[0]);
|
||||
if (!Modifier.isStatic(suiteMethod.getModifiers())) {
|
||||
throw new InitializationError("suite method must be static");
|
||||
}
|
||||
Object suite = suiteMethod.invoke(null);
|
||||
Object suite = suiteMethod.invoke(null, new Object[0]);
|
||||
if (suite == null) {
|
||||
throw new InitializationError("suite method can not return null");
|
||||
}
|
||||
|
|
@ -101,66 +105,69 @@ public class AntUnitSuiteRunner extends Runner implements Filterable, Sortable {
|
|||
}
|
||||
return (AntUnitSuite) suite;
|
||||
} catch (NoSuchMethodException e) {
|
||||
throw new InitializationError(e);
|
||||
throw new InitializationError(new Throwable[] { e });
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new InitializationError(e);
|
||||
throw new InitializationError(new Throwable[] { e });
|
||||
} catch (InvocationTargetException e) {
|
||||
throw new InitializationError(e);
|
||||
throw new InitializationError(new Throwable[] { e });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filterable implementation
|
||||
* @Overwrite Filterable implementation
|
||||
*/
|
||||
public void filter(Filter filter) throws NoTestsRemainException {
|
||||
for (Iterator<Map.Entry<String, Description>> iter =
|
||||
targetDescriptions.entrySet().iterator(); iter.hasNext();) {
|
||||
Map.Entry<String, Description> mapEntry = iter.next();
|
||||
if (!filter.shouldRun(mapEntry.getValue())) {
|
||||
for (Iterator iter= targetDescriptions.entrySet().iterator(); iter.hasNext();) {
|
||||
Map.Entry mapEntry = (Entry) iter.next();
|
||||
if (!filter.shouldRun((Description) mapEntry.getValue()))
|
||||
iter.remove();
|
||||
targetsOrder.remove(mapEntry.getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sortable implementation
|
||||
* @Overwrite Sortable implementation
|
||||
*/
|
||||
public void sort(final Sorter sorter) {
|
||||
Collections.sort(targetsOrder, new Comparator<String>() {
|
||||
public int compare(String target1, String target2) {
|
||||
Description d2 = targetDescriptions.get(target2);
|
||||
Description d1 = targetDescriptions.get(target1);
|
||||
Collections.sort(targetsOrder, new Comparator/*<String>*/() {
|
||||
public int compare(Object target1, Object target2) {
|
||||
Description d2 = (Description)targetDescriptions.get(target2);
|
||||
Description d1 = (Description)targetDescriptions.get(target1);
|
||||
return sorter.compare(d1, d2);
|
||||
}
|
||||
});
|
||||
/*for (Runner each : fRunners)
|
||||
sorter.apply(each);
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Runner implementation
|
||||
* @Overwrite Runner implementation
|
||||
*/
|
||||
public Description getDescription() {
|
||||
Description r = Description.createSuiteDescription(junit3Suite.getName());
|
||||
|
||||
Collection<Description> childDesc = targetDescriptions.values();
|
||||
for (Description desc : childDesc) {
|
||||
Description r = Description.createSuiteDescription(
|
||||
junit3Suite.getName(), new Annotation[0]);
|
||||
|
||||
Collection childDesc = targetDescriptions.values();
|
||||
for (Iterator iterator = childDesc.iterator(); iterator.hasNext();) {
|
||||
Description desc = (Description) iterator.next();
|
||||
r.addChild(desc);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runner implementation
|
||||
* @Overwrite Runner implementation
|
||||
*/
|
||||
public void run(final RunNotifier junitNotifier) {
|
||||
List<String> targetList = new LinkedList<String>(targetDescriptions.keySet());
|
||||
|
||||
AntUnitExecutionNotifier antUnitNotifier = new AntUnitExecutionNotifier() {
|
||||
LinkedList targetList = new LinkedList(targetDescriptions.keySet());
|
||||
|
||||
AntUnitExecutionNotifier antUnitNotifier = new AntUnitExecutionNotifier() {
|
||||
public void fireStartTest(String targetName) {
|
||||
junitNotifier.fireTestStarted(getDescription(targetName));
|
||||
}
|
||||
public void fireEndTest(String targetName) {
|
||||
junitNotifier.fireTestFinished(getDescription(targetName));
|
||||
junitNotifier.fireTestFinished(getDescription(targetName));
|
||||
}
|
||||
public void fireError(String targetName, Throwable t) {
|
||||
Failure failure = new Failure(getDescription(targetName), t);
|
||||
|
|
@ -169,12 +176,12 @@ public class AntUnitSuiteRunner extends Runner implements Filterable, Sortable {
|
|||
public void fireFail(String targetName, AssertionFailedException ae) {
|
||||
Failure failure = new Failure(getDescription(targetName), ae);
|
||||
junitNotifier.fireTestFailure(failure);
|
||||
}
|
||||
}
|
||||
private Description getDescription(String targetName) {
|
||||
return targetDescriptions.get(targetName);
|
||||
return (Description) targetDescriptions.get(targetName);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
junit3Suite.runInContainer(targetList, antUnitNotifier);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@
|
|||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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
|
||||
|
|
@ -37,31 +37,27 @@ import org.apache.tools.ant.Task;
|
|||
import org.apache.tools.ant.taskdefs.LogOutputStream;
|
||||
import org.apache.tools.ant.types.EnumeratedAttribute;
|
||||
import org.apache.tools.ant.util.FileUtils;
|
||||
import org.apache.tools.ant.util.KeepAliveOutputStream;
|
||||
import org.apache.tools.ant.util.TeeOutputStream;
|
||||
|
||||
/**
|
||||
* A test listener for <antunit> modeled aftern the Plain JUnit
|
||||
* test listener that is part of Ant.
|
||||
*/
|
||||
public abstract class BaseAntUnitListener implements AntUnitListener {
|
||||
public abstract class BaseAntUnitListener
|
||||
implements AntUnitListener {
|
||||
|
||||
protected BaseAntUnitListener(SendLogTo defaultReportTarget,
|
||||
String extension) {
|
||||
logTo = defaultReportTarget;
|
||||
this.extension = extension;
|
||||
logLevel = BaseAntUnitListener.AntUnitLogLevel.NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formatter for timings.
|
||||
*/
|
||||
protected static final NumberFormat nf = NumberFormat.getInstance();
|
||||
|
||||
/**
|
||||
* Create a new {@link BaseAntUnitListener} instance.
|
||||
* @param defaultReportTarget
|
||||
* @param extension
|
||||
*/
|
||||
protected BaseAntUnitListener(SendLogTo defaultReportTarget, String extension) {
|
||||
logTo = defaultReportTarget;
|
||||
this.extension = extension;
|
||||
logLevel = BaseAntUnitListener.AntUnitLogLevel.NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Directory to write reports to.
|
||||
*/
|
||||
|
|
@ -74,7 +70,6 @@ public abstract class BaseAntUnitListener implements AntUnitListener {
|
|||
|
||||
/**
|
||||
* Directory to write reports to.
|
||||
* @return directory to write reports to
|
||||
*/
|
||||
protected final File getToDir() {
|
||||
return toDir;
|
||||
|
|
@ -82,7 +77,6 @@ public abstract class BaseAntUnitListener implements AntUnitListener {
|
|||
|
||||
/**
|
||||
* Sets the directory to write test reports to.
|
||||
* @param f directory to write reports to
|
||||
*/
|
||||
public void setToDir(File f) {
|
||||
toDir = f;
|
||||
|
|
@ -95,7 +89,6 @@ public abstract class BaseAntUnitListener implements AntUnitListener {
|
|||
|
||||
/**
|
||||
* Where to send the test report.
|
||||
* @param logTo where to send the test report
|
||||
*/
|
||||
protected void setSendLogTo(SendLogTo logTo) {
|
||||
this.logTo = logTo;
|
||||
|
|
@ -122,7 +115,9 @@ public abstract class BaseAntUnitListener implements AntUnitListener {
|
|||
}
|
||||
|
||||
protected final void close(OutputStream out) {
|
||||
FileUtils.close(out);
|
||||
if (out != System.out && out != System.err) {
|
||||
FileUtils.close(out);
|
||||
}
|
||||
}
|
||||
|
||||
public void startTest(String target) {
|
||||
|
|
@ -137,43 +132,36 @@ public abstract class BaseAntUnitListener implements AntUnitListener {
|
|||
}
|
||||
|
||||
protected final OutputStream getOut(String buildFile) {
|
||||
final String dest = logTo.getValue();
|
||||
|
||||
if (logTo.getIndex() < 0) {
|
||||
throw new BuildException(String.format("Invalid @sendlogto value '%s'", dest));
|
||||
}
|
||||
OutputStream l;
|
||||
|
||||
if (SendLogTo.ANT_LOG.equals(dest) || SendLogTo.BOTH.equals(dest)) {
|
||||
OutputStream l, f;
|
||||
l = f = null;
|
||||
if (logTo.getValue().equals(SendLogTo.ANT_LOG)
|
||||
|| logTo.getValue().equals(SendLogTo.BOTH)) {
|
||||
if (parentTask != null) {
|
||||
l = new LogOutputStream(parentTask, Project.MSG_INFO);
|
||||
} else {
|
||||
l = new KeepAliveOutputStream(System.out);
|
||||
l = System.out;
|
||||
}
|
||||
if (SendLogTo.ANT_LOG.equals(dest)) {
|
||||
if (logTo.getValue().equals(SendLogTo.ANT_LOG)) {
|
||||
return l;
|
||||
}
|
||||
} else {
|
||||
l = null;
|
||||
}
|
||||
OutputStream f;
|
||||
if (logTo.getValue().equals(SendLogTo.FILE)
|
||||
|| logTo.getValue().equals(SendLogTo.BOTH)) {
|
||||
|
||||
String fileName = "TEST-" + normalize(buildFile) + "." + extension;
|
||||
File file;
|
||||
if (toDir != null) {
|
||||
file = new File(toDir, fileName);
|
||||
} else if (parentTask == null) {
|
||||
file = new File(fileName);
|
||||
} else {
|
||||
file = parentTask.getProject().resolveFile(fileName);
|
||||
}
|
||||
try {
|
||||
f = new FileOutputStream(file);
|
||||
} catch (IOException e) {
|
||||
throw new BuildException(e);
|
||||
}
|
||||
if (SendLogTo.FILE.equals(dest)) {
|
||||
return f;
|
||||
String fileName = "TEST-" + normalize(buildFile) + "." + extension;
|
||||
File file = toDir == null
|
||||
? (parentTask != null
|
||||
? parentTask.getProject().resolveFile(fileName)
|
||||
: new File(fileName))
|
||||
: new File(toDir, fileName);
|
||||
try {
|
||||
f = new FileOutputStream(file);
|
||||
} catch (IOException e) {
|
||||
throw new BuildException(e);
|
||||
}
|
||||
if (logTo.getValue().equals(SendLogTo.FILE)) {
|
||||
return f;
|
||||
}
|
||||
}
|
||||
return new TeeOutputStream(l, f);
|
||||
}
|
||||
|
|
@ -182,17 +170,20 @@ public abstract class BaseAntUnitListener implements AntUnitListener {
|
|||
* Turns the build file name into something that vaguely looks
|
||||
* like a Java classname. Close enough to be suitable for
|
||||
* junitreport.
|
||||
* @param buildFile the test file name
|
||||
* @return the normalized name
|
||||
*/
|
||||
protected final String normalize(String buildFile) {
|
||||
File base = parentTask != null ? parentTask.getProject().getBaseDir()
|
||||
File base = parentTask != null
|
||||
? parentTask.getProject().getBaseDir()
|
||||
: new File(System.getProperty("user.dir"));
|
||||
buildFile = FileUtils.getFileUtils().removeLeadingPath(base, new File(buildFile));
|
||||
if (buildFile.length() > 0 && buildFile.charAt(0) == File.separatorChar) {
|
||||
buildFile = FileUtils.getFileUtils()
|
||||
.removeLeadingPath(base, new File(buildFile));
|
||||
if (buildFile.length() > 0
|
||||
&& buildFile.charAt(0) == File.separatorChar) {
|
||||
buildFile = buildFile.substring(1);
|
||||
}
|
||||
return buildFile.replace('.', '_').replace(':', '_').replace(File.separatorChar, '.');
|
||||
|
||||
return buildFile.replace('.', '_').replace(':', '_')
|
||||
.replace(File.separatorChar, '.');
|
||||
}
|
||||
|
||||
protected final Location getLocation(Throwable t) {
|
||||
|
|
@ -226,7 +217,6 @@ public abstract class BaseAntUnitListener implements AntUnitListener {
|
|||
/**
|
||||
* Sets the minimum level a log message must be logged at to be
|
||||
* included in the output.
|
||||
* @param l minimum level
|
||||
*/
|
||||
public void setLogLevel(AntUnitLogLevel l) {
|
||||
logLevel = l;
|
||||
|
|
@ -235,10 +225,9 @@ public abstract class BaseAntUnitListener implements AntUnitListener {
|
|||
/**
|
||||
* Gets messages from the project running the test target if their
|
||||
* level is at least of the level specified with {@link
|
||||
* #setLogLevel setLogLevel}.
|
||||
* #setLoglevel setLogLevel}.
|
||||
*
|
||||
* <p>This implementation is empty.</p>
|
||||
* @param event the logged message
|
||||
*/
|
||||
protected void messageLogged(BuildEvent event) {}
|
||||
|
||||
|
|
@ -311,4 +300,4 @@ public abstract class BaseAntUnitListener implements AntUnitListener {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,200 +1,206 @@
|
|||
/*
|
||||
* 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
|
||||
*
|
||||
* https://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.ant.antunit.listener;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.Iterator;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.apache.ant.antunit.AssertionFailedException;
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.util.FileUtils;
|
||||
|
||||
/**
|
||||
* This AntUnitListener creates a new buildfile with a target for each
|
||||
* failed test target in the AntUnit run. The generated target calls
|
||||
* the failed target (with setUp and tearDown if present in the called
|
||||
* project).
|
||||
* This is intended for rerunning just failed tests.
|
||||
*/
|
||||
public class FailureAntUnitListener extends BaseAntUnitListener {
|
||||
|
||||
/** LineSeparator just for beautifying the output. */
|
||||
private static final String BR = System.getProperty("line.separator");
|
||||
|
||||
/** A sorted list (without duplicates) of failed tests. */
|
||||
private static SortedSet<TestInfos> failedTests = new TreeSet<TestInfos>();
|
||||
|
||||
/** Where to write the generated buildfile. */
|
||||
private static File failureBuildfile;
|
||||
|
||||
/** The current running test project. Needed for addError()/addFailure(). */
|
||||
private Project currentTestProject;
|
||||
|
||||
/** The current running build file. Needed for addError()/addFailure(). */
|
||||
private String currentBuildFile;
|
||||
|
||||
|
||||
/** No-arg constructor. */
|
||||
public FailureAntUnitListener() {
|
||||
super(new BaseAntUnitListener.SendLogTo(SendLogTo.ANT_LOG), "txt");
|
||||
}
|
||||
|
||||
public void setFile(File file) {
|
||||
failureBuildfile = file;
|
||||
}
|
||||
|
||||
public void startTestSuite(Project testProject, String buildFile) {
|
||||
super.startTestSuite(testProject, buildFile);
|
||||
currentTestProject = testProject;
|
||||
currentBuildFile = buildFile;
|
||||
}
|
||||
|
||||
public void addError(String target, Throwable ae) {
|
||||
super.addError(target, ae);
|
||||
failedTests.add(new TestInfos(currentTestProject, currentBuildFile, target, ae.getMessage()));
|
||||
}
|
||||
|
||||
public void addFailure(String target, AssertionFailedException ae) {
|
||||
super.addFailure(target, ae);
|
||||
failedTests.add(new TestInfos(currentTestProject, currentBuildFile, target, ae.getMessage()));
|
||||
}
|
||||
|
||||
/** not in use */
|
||||
public void endTest(String target) {
|
||||
}
|
||||
|
||||
public void endTestSuite(Project testProject, String buildFile) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
// <project> and antunit-target for direct run
|
||||
sb.append("<project default=\"antunit\" xmlns:au=\"antlib:org.apache.ant.antunit\">");
|
||||
sb.append(BR);
|
||||
sb.append(BR);
|
||||
sb.append(" <target name=\"antunit\">").append(BR);
|
||||
sb.append(" <au:antunit>").append(BR);
|
||||
sb.append(" <au:plainlistener/>").append(BR);
|
||||
sb.append(" <file file=\"${ant.file}\"/>").append(BR);
|
||||
sb.append(" </au:antunit>").append(BR);
|
||||
sb.append(" </target>").append(BR);
|
||||
sb.append(BR);
|
||||
sb.append(BR);
|
||||
|
||||
// one target for each failed test
|
||||
int testNumber = 0;
|
||||
NumberFormat f = NumberFormat.getIntegerInstance();
|
||||
for (Iterator<TestInfos> it = failedTests.iterator(); it.hasNext();) {
|
||||
sb.append(" <target name=\"test");
|
||||
sb.append(f.format(testNumber++));
|
||||
sb.append("\">").append(BR);
|
||||
TestInfos testInfos = it.next();
|
||||
sb.append(testInfos);
|
||||
sb.append(" </target>").append(BR);
|
||||
sb.append(BR);
|
||||
}
|
||||
|
||||
// close the <project>
|
||||
sb.append("</project>").append(BR);
|
||||
|
||||
// write the whole file
|
||||
try {
|
||||
FileOutputStream fos = new FileOutputStream(failureBuildfile);
|
||||
fos.write(sb.toString().getBytes());
|
||||
FileUtils.close(fos);
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new BuildException(e);
|
||||
} catch (IOException e) {
|
||||
throw new BuildException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for collecting needed information about failed tests.
|
||||
*/
|
||||
public class TestInfos implements Comparable<TestInfos> {
|
||||
/** Does the project has a setUp target? */
|
||||
boolean projectHasSetup = false;
|
||||
|
||||
/** Does the project has a tearDown target? */
|
||||
boolean projectHasTearDown = false;
|
||||
|
||||
/** The called target. */
|
||||
String target;
|
||||
|
||||
/** The buildfile of the project. */
|
||||
String buildfile;
|
||||
|
||||
/** The error message which was shown. */
|
||||
String errorMessage;
|
||||
|
||||
public TestInfos(Project project, String buildfile, String target, String errorMessage) {
|
||||
projectHasSetup = project.getTargets().containsKey("setUp");
|
||||
projectHasTearDown = project.getTargets().containsKey("tearDown");
|
||||
this.buildfile = buildfile;
|
||||
this.target = target;
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an <ant> call according to the stored information.
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
// make the reader of the buildfile happy
|
||||
sb.append(" <!-- ");
|
||||
sb.append(errorMessage);
|
||||
sb.append(" -->").append(BR);
|
||||
// <ant antfile="" inheritAll="false">
|
||||
sb.append(" <ant ");
|
||||
sb.append("antfile=\"");
|
||||
sb.append(buildfile.replace('\\', '/'));
|
||||
sb.append("\" ");
|
||||
sb.append("inheritAll=\"false\">");
|
||||
sb.append(BR);
|
||||
// <target name=""/>
|
||||
if (projectHasSetup) {
|
||||
sb.append(" <target name=\"setUp\"/>").append(BR);
|
||||
}
|
||||
sb.append(" <target name=\"");
|
||||
sb.append(target);
|
||||
sb.append("\"/>");
|
||||
sb.append(BR);
|
||||
if (projectHasTearDown) {
|
||||
sb.append(" <target name=\"tearDown\"/>").append(BR);
|
||||
}
|
||||
// </ant>
|
||||
sb.append(" </ant>").append(BR);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
// Needed, so that a SortedSet could sort this class into the list.
|
||||
public int compareTo(TestInfos other) {
|
||||
return this.toString().compareTo((other).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.ant.antunit.listener;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.Iterator;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.apache.ant.antunit.AssertionFailedException;
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.util.FileUtils;
|
||||
|
||||
/**
|
||||
* This AntUnitListener creates a new buildfile with a target for each
|
||||
* failed test target in the AntUnit run. The generated target calls
|
||||
* the failed target (with setUp and tearDown if present in the called
|
||||
* project).
|
||||
* This is intended for rerunning just failed tests.
|
||||
*/
|
||||
public class FailureAntUnitListener extends BaseAntUnitListener {
|
||||
|
||||
/** LineSeparator just for beautifying the output. */
|
||||
private static final String BR = System.getProperty("line.separator");
|
||||
|
||||
/** A sorted list (without duplicates) of failed tests. */
|
||||
private static SortedSet failedTests = new TreeSet();
|
||||
|
||||
/** Where to write the generated buildfile. */
|
||||
private static File failureBuildfile;
|
||||
|
||||
/** The current running test project. Needed for addError()/addFailure(). */
|
||||
private Project currentTestProject;
|
||||
|
||||
/** The current running build file. Needed for addError()/addFailure(). */
|
||||
private String currentBuildFile;
|
||||
|
||||
|
||||
/** No-arg constructor. */
|
||||
public FailureAntUnitListener() {
|
||||
super(new BaseAntUnitListener.SendLogTo(SendLogTo.ANT_LOG), "txt");
|
||||
}
|
||||
|
||||
public void setFile(File file) {
|
||||
failureBuildfile = file;
|
||||
}
|
||||
|
||||
public void startTestSuite(Project testProject, String buildFile) {
|
||||
super.startTestSuite(testProject, buildFile);
|
||||
currentTestProject = testProject;
|
||||
currentBuildFile = buildFile;
|
||||
}
|
||||
|
||||
public void addError(String target, Throwable ae) {
|
||||
super.addError(target, ae);
|
||||
failedTests.add(new TestInfos(currentTestProject, currentBuildFile, target, ae.getMessage()));
|
||||
}
|
||||
|
||||
public void addFailure(String target, AssertionFailedException ae) {
|
||||
super.addFailure(target, ae);
|
||||
failedTests.add(new TestInfos(currentTestProject, currentBuildFile, target, ae.getMessage()));
|
||||
}
|
||||
|
||||
/** not in use */
|
||||
public void endTest(String target) {
|
||||
}
|
||||
|
||||
public void endTestSuite(Project testProject, String buildFile) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
// <project> and antunit-target for direct run
|
||||
sb.append("<project default=\"antunit\" xmlns:au=\"antlib:org.apache.ant.antunit\">");
|
||||
sb.append(BR);
|
||||
sb.append(BR);
|
||||
sb.append(" <target name=\"antunit\">").append(BR);
|
||||
sb.append(" <au:antunit>").append(BR);
|
||||
sb.append(" <au:plainlistener/>").append(BR);
|
||||
sb.append(" <file file=\"${ant.file}\"/>").append(BR);
|
||||
sb.append(" </au:antunit>").append(BR);
|
||||
sb.append(" </target>").append(BR);
|
||||
sb.append(BR);
|
||||
sb.append(BR);
|
||||
|
||||
// one target for each failed test
|
||||
int testNumber = 0;
|
||||
NumberFormat f = NumberFormat.getIntegerInstance();
|
||||
for (Iterator it = failedTests.iterator(); it.hasNext();) {
|
||||
sb.append(" <target name=\"test");
|
||||
sb.append(f.format(testNumber++));
|
||||
sb.append("\">").append(BR);
|
||||
TestInfos testInfos = (TestInfos) it.next();
|
||||
sb.append(testInfos);
|
||||
sb.append(" </target>").append(BR);
|
||||
sb.append(BR);
|
||||
}
|
||||
|
||||
// close the <project>
|
||||
sb.append("</project>").append(BR);
|
||||
|
||||
// write the whole file
|
||||
try {
|
||||
FileOutputStream fos = new FileOutputStream(failureBuildfile);
|
||||
fos.write(sb.toString().getBytes());
|
||||
FileUtils.close(fos);
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new BuildException(e);
|
||||
} catch (IOException e) {
|
||||
throw new BuildException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Class for collecting needed information about failed tests.
|
||||
*/
|
||||
public class TestInfos implements Comparable {
|
||||
/** Does the project has a setUp target? */
|
||||
boolean projectHasSetup = false;
|
||||
|
||||
/** Does the project has a tearDown target? */
|
||||
boolean projectHasTearDown = false;
|
||||
|
||||
/** The called target. */
|
||||
String target;
|
||||
|
||||
/** The buildfile of the project. */
|
||||
String buildfile;
|
||||
|
||||
/** The error message which was shown. */
|
||||
String errorMessage;
|
||||
|
||||
public TestInfos(Project project, String buildfile, String target, String errorMessage) {
|
||||
projectHasSetup = project.getTargets().containsKey("setUp");
|
||||
projectHasTearDown = project.getTargets().containsKey("tearDown");
|
||||
this.buildfile = buildfile;
|
||||
this.target = target;
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an <ant> call according to the stored information.
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
public String toString() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
// make the reader of the buildfile happy
|
||||
sb.append(" <!-- ");
|
||||
sb.append(errorMessage);
|
||||
sb.append(" -->").append(BR);
|
||||
// <ant antfile="" inheritAll="false">
|
||||
sb.append(" <ant ");
|
||||
sb.append("antfile=\"");
|
||||
sb.append(buildfile.replace('\\', '/'));
|
||||
sb.append("\" ");
|
||||
sb.append("inheritAll=\"false\">");
|
||||
sb.append(BR);
|
||||
// <target name=""/>
|
||||
if (projectHasSetup) {
|
||||
sb.append(" <target name=\"setUp\"/>").append(BR);
|
||||
}
|
||||
sb.append(" <target name=\"");
|
||||
sb.append(target);
|
||||
sb.append("\"/>");
|
||||
sb.append(BR);
|
||||
if (projectHasTearDown) {
|
||||
sb.append(" <target name=\"tearDown\"/>").append(BR);
|
||||
}
|
||||
// </ant>
|
||||
sb.append(" </ant>").append(BR);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
// Needed, so that a SortedSet could sort this class into the list.
|
||||
public int compareTo(Object other) {
|
||||
if (!(other instanceof TestInfos)) {
|
||||
return -1;
|
||||
} else {
|
||||
TestInfos that = (TestInfos)other;
|
||||
return this.toString().compareTo(that.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* https://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.ant.antunit.listener;
|
||||
|
||||
import org.apache.ant.antunit.AntUnitListener;
|
||||
import org.apache.ant.antunit.AssertionFailedException;
|
||||
|
||||
import org.apache.tools.ant.BuildEvent;
|
||||
import org.apache.tools.ant.BuildListener;
|
||||
import org.apache.tools.ant.Task;
|
||||
import org.apache.tools.ant.Project;
|
||||
|
||||
/**
|
||||
* A test listener for <antunit> who's whole purpose is to
|
||||
* forward log output from the project under test to the project
|
||||
* executing the <antunit> task.
|
||||
*/
|
||||
public class LogForwarder implements AntUnitListener {
|
||||
|
||||
private Task parentTask;
|
||||
|
||||
public void setParentTask(Task t) {
|
||||
parentTask = t;
|
||||
}
|
||||
|
||||
public void setCurrentTestProject(Project p) {
|
||||
p.addBuildListener(new BuildListener() {
|
||||
public void buildStarted(BuildEvent event) {}
|
||||
public void buildFinished(BuildEvent event) {}
|
||||
public void targetStarted(BuildEvent event) {}
|
||||
public void targetFinished(BuildEvent event) {}
|
||||
public void taskStarted(BuildEvent event) {}
|
||||
public void taskFinished(BuildEvent event) {}
|
||||
public void messageLogged(BuildEvent event) {
|
||||
parentTask.log(event.getMessage(), event.getPriority());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void startTestSuite(Project testProject, String buildFile) {}
|
||||
public void endTestSuite(Project testProject, String buildFile) {}
|
||||
public void startTest(String target) {}
|
||||
public void endTest(String target) {}
|
||||
public void addFailure(String target, AssertionFailedException ae) {}
|
||||
public void addError(String target, Throwable ae) {}
|
||||
}
|
||||
|
|
@ -7,8 +7,8 @@
|
|||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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
|
||||
|
|
@ -37,7 +37,7 @@ import org.apache.tools.ant.Project;
|
|||
* test listener that is part of Ant.
|
||||
*/
|
||||
public class PlainAntUnitListener extends BaseAntUnitListener {
|
||||
private OutputStream out;
|
||||
private OutputStream out = null;
|
||||
/**
|
||||
* Helper to store intermediate output.
|
||||
*/
|
||||
|
|
@ -69,7 +69,9 @@ public class PlainAntUnitListener extends BaseAntUnitListener {
|
|||
inner = new StringWriter();
|
||||
wri = new PrintWriter(inner);
|
||||
out = getOut(buildFile);
|
||||
StringBuilder sb = new StringBuilder("Build File: ").append(buildFile).append(NEW_LINE);
|
||||
StringBuffer sb = new StringBuffer("Build File: ");
|
||||
sb.append(buildFile);
|
||||
sb.append(NEW_LINE);
|
||||
try {
|
||||
out.write(sb.toString().getBytes());
|
||||
out.flush();
|
||||
|
|
@ -80,7 +82,7 @@ public class PlainAntUnitListener extends BaseAntUnitListener {
|
|||
|
||||
public void endTestSuite(Project testProject, String buildFile) {
|
||||
long runTime = System.currentTimeMillis() - start;
|
||||
StringBuilder sb = new StringBuilder("Tests run: ");
|
||||
StringBuffer sb = new StringBuffer("Tests run: ");
|
||||
sb.append(runCount);
|
||||
sb.append(", Failures: ");
|
||||
sb.append(failureCount);
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@
|
|||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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
|
||||
|
|
@ -96,15 +96,14 @@ public class XMLAntUnitListener extends BaseAntUnitListener {
|
|||
|
||||
Element propertiesElement =
|
||||
DOMUtils.createChildElement(root, XMLConstants.PROPERTIES);
|
||||
@SuppressWarnings("unchecked")
|
||||
Hashtable<String,Object> propertiesMap = testProject.getProperties();
|
||||
for (final Iterator<Map.Entry<String, Object>> iterator = propertiesMap.entrySet().iterator();
|
||||
Hashtable propertiesMap = testProject.getProperties();
|
||||
for (final Iterator iterator = propertiesMap.entrySet().iterator();
|
||||
iterator.hasNext();) {
|
||||
final Map.Entry<String, Object> property = iterator.next();
|
||||
final Map.Entry property = (Map.Entry) iterator.next();
|
||||
Element e = DOMUtils.createChildElement(propertiesElement,
|
||||
XMLConstants.PROPERTY);
|
||||
e.setAttribute(XMLConstants.ATTR_NAME,
|
||||
property.getKey());
|
||||
property.getKey().toString());
|
||||
e.setAttribute(XMLConstants.ATTR_VALUE,
|
||||
property.getValue().toString());
|
||||
}
|
||||
|
|
@ -123,7 +122,7 @@ public class XMLAntUnitListener extends BaseAntUnitListener {
|
|||
log.setLength(0);
|
||||
domWri.write(e, wri, 1, INDENT);
|
||||
}
|
||||
e = DOMUtils.createChildElement(root, XMLConstants.ATTR_TESTS);
|
||||
e = DOMUtils.createChildElement(root, XMLConstants.ATTR_TESTS);
|
||||
DOMUtils.appendText(e, String.valueOf(runCount));
|
||||
domWri.write(e, wri, 1, INDENT);
|
||||
e = DOMUtils.createChildElement(root, XMLConstants.ATTR_FAILURES);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* 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
|
||||
|
|
@ -22,13 +22,13 @@ package org.apache.ant.antunit.listener;
|
|||
|
||||
/**
|
||||
* <p> Interface groups XML constants.
|
||||
* Interface that groups all constants used throughout the <code>XML</code>
|
||||
* documents that are generated by the <code>XMLJUnitResultFormatter</code>
|
||||
* Interface that groups all constants used throughout the <tt>XML</tt>
|
||||
* documents that are generated by the <tt>XMLJUnitResultFormatter</tt>
|
||||
* As of now the DTD is:
|
||||
* <pre>
|
||||
* <----------------- @todo describe DTDs ---------------------->
|
||||
* <code><pre>
|
||||
* <----------------- @todo describe DTDs ---------------------->
|
||||
*
|
||||
* </pre>
|
||||
* </pre></code>
|
||||
* @see XMLAntUnitListener
|
||||
*/
|
||||
public interface XMLConstants {
|
||||
|
|
|
|||
|
|
@ -1,39 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
https://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.
|
||||
-->
|
||||
<project name="antunit-base">
|
||||
|
||||
<property name="antunit.tmpdir" location="${java.io.tmpdir}"/>
|
||||
<property name="input" location="${antunit.tmpdir}/testinput"/>
|
||||
<property name="output" location="${antunit.tmpdir}/testoutput"/>
|
||||
<condition property="build.sysclasspath.only">
|
||||
<equals arg1="${build.sysclasspath}" arg2="only"/>
|
||||
</condition>
|
||||
|
||||
<target name="tearDown">
|
||||
<delete dir="${input}"/>
|
||||
<delete dir="${output}"/>
|
||||
</target>
|
||||
|
||||
<target name="antunit">
|
||||
<antunit xmlns="antlib:org.apache.ant.antunit">
|
||||
<plainlistener />
|
||||
<file file="${ant.file}" xmlns="antlib:org.apache.tools.ant" />
|
||||
</antunit>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
https://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.
|
||||
-->
|
||||
<project xmlns:au="antlib:org.apache.ant.antunit" default="antunit">
|
||||
|
||||
<import file="antunit-base.xml"/>
|
||||
|
||||
<target name="testWithoutMerge">
|
||||
<echo>0</echo>
|
||||
<echo>1</echo>
|
||||
<au:assertLogContains
|
||||
mergeLines="false"
|
||||
text="0${line.separator}1${line.separator}"/>
|
||||
<au:assertLogDoesntContain
|
||||
mergeLines="false"
|
||||
text="01"/>
|
||||
</target>
|
||||
|
||||
<target name="testWithExplicitMerge">
|
||||
<echo>0</echo>
|
||||
<echo>1</echo>
|
||||
<au:assertLogDoesntContain
|
||||
mergeLines="true"
|
||||
text="0${line.separator}1${line.separator}"/>
|
||||
<au:assertLogContains
|
||||
mergeLines="true"
|
||||
text="01"/>
|
||||
</target>
|
||||
|
||||
<target name="testWithImplicitMerge">
|
||||
<echo>0</echo>
|
||||
<echo>1</echo>
|
||||
<au:assertLogDoesntContain
|
||||
text="0${line.separator}1${line.separator}"/>
|
||||
<au:assertLogContains
|
||||
text="01"/>
|
||||
</target>
|
||||
</project>
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
https://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.
|
||||
-->
|
||||
<project xmlns:au="antlib:org.apache.ant.antunit" default="antunit">
|
||||
|
||||
<import file="antunit-base.xml"/>
|
||||
|
||||
<url url="https://ant.apache.org/index.html" id="antsite"/>
|
||||
|
||||
<target name="testURLUsingRef"
|
||||
description="https://issues.apache.org/bugzilla/show_bug.cgi?id=53383">
|
||||
<au:assertRefResourceContains refid="antsite" value="Apache Ant"/>
|
||||
</target>
|
||||
|
||||
<target name="testURLUsingRef-no"
|
||||
description="https://issues.apache.org/bugzilla/show_bug.cgi?id=53383">
|
||||
<au:assertRefResourceDoesntContain refid="antsite" value="Foo"/>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
https://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.
|
||||
-->
|
||||
<project xmlns:au="antlib:org.apache.ant.antunit" default="antunit">
|
||||
|
||||
<import file="antunit-base.xml"/>
|
||||
|
||||
<property name="existing-url" value="https://ant.apache.org/index.html"/>
|
||||
<property name="not-existing-url" value="https://ant.apache.org/foo.html"/>
|
||||
|
||||
<!-- some strange proxy setups hide the 404 results -->
|
||||
<target name="-checkWhetherUrlsThatDontExistAreFound">
|
||||
<condition property="cant.trust.urlcheck">
|
||||
<http url="${not-existing-url}"/>
|
||||
</condition>
|
||||
</target>
|
||||
|
||||
<target name="-logWhetherUrlsThatDontExistAreFound"
|
||||
depends="-checkWhetherUrlsThatDontExistAreFound"
|
||||
if="cant.trust.urlcheck">
|
||||
<echo>Get non-error response for missing URLs</echo>
|
||||
</target>
|
||||
|
||||
<target name="testURL"
|
||||
description="https://issues.apache.org/bugzilla/show_bug.cgi?id=53383">
|
||||
<au:assertNestedResourceExists>
|
||||
<url url="${existing-url}"/>
|
||||
</au:assertNestedResourceExists>
|
||||
</target>
|
||||
|
||||
<target name="testURLUsingRef"
|
||||
description="https://issues.apache.org/bugzilla/show_bug.cgi?id=53383">
|
||||
<url url="${existing-url}" id="antsite"/>
|
||||
<au:assertRefResourceExists refid="antsite"/>
|
||||
</target>
|
||||
|
||||
<target name="testURL-no"
|
||||
depends="-logWhetherUrlsThatDontExistAreFound"
|
||||
unless="cant.trust.urlcheck"
|
||||
description="https://issues.apache.org/bugzilla/show_bug.cgi?id=53383">
|
||||
<au:assertNestedResourceDoesntExist>
|
||||
<url url="${not-existing-url}"/>
|
||||
</au:assertNestedResourceDoesntExist>
|
||||
</target>
|
||||
|
||||
<target name="testURLUsingRef-no"
|
||||
depends="-logWhetherUrlsThatDontExistAreFound"
|
||||
unless="cant.trust.urlcheck"
|
||||
description="https://issues.apache.org/bugzilla/show_bug.cgi?id=53383">
|
||||
<url url="${not-existing-url}" id="antsite-foo"/>
|
||||
<au:assertRefResourceDoesntExist refid="antsite-foo"/>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
https://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.
|
||||
-->
|
||||
<project xmlns:au="antlib:org.apache.ant.antunit" default="antunit">
|
||||
|
||||
<import file="antunit-base.xml"/>
|
||||
|
||||
<target name="test-yes">
|
||||
<au:assertTrue>
|
||||
<au:resourceExists>
|
||||
<file file="resourceexists-test.xml"/>
|
||||
</au:resourceExists>
|
||||
</au:assertTrue>
|
||||
</target>
|
||||
|
||||
<target name="test-refid-file">
|
||||
<file file="resourceexists-test.xml" id="id1"/>
|
||||
<au:assertTrue>
|
||||
<au:resourceExists refid="id1"/>
|
||||
</au:assertTrue>
|
||||
</target>
|
||||
|
||||
<target name="test-refid-fileset">
|
||||
<fileset file="resourceexists-test.xml" id="id2"/>
|
||||
<au:assertTrue>
|
||||
<au:resourceExists refid="id2"/>
|
||||
</au:assertTrue>
|
||||
</target>
|
||||
|
||||
<target name="test-no">
|
||||
<au:assertFalse>
|
||||
<au:resourceExists>
|
||||
<file file="resourceexists-test-not-there.xml"/>
|
||||
</au:resourceExists>
|
||||
</au:assertFalse>
|
||||
</target>
|
||||
|
||||
<target name="testURL">
|
||||
<au:assertTrue>
|
||||
<au:resourceExists>
|
||||
<url url="https://ant.apache.org/index.html"/>
|
||||
</au:resourceExists>
|
||||
</au:assertTrue>
|
||||
</target>
|
||||
|
||||
<target name="testURLAttributeUsingRef">
|
||||
<url url="https://ant.apache.org/index.html" id="antsite"/>
|
||||
<au:assertTrue>
|
||||
<au:resourceExists resource="${ant.refid:antsite}"/>
|
||||
</au:assertTrue>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* 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
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* 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
|
||||
|
|
@ -49,36 +49,15 @@ public class AssertTest extends BuildFileTest {
|
|||
public void testEqualsCasePass() {
|
||||
testPass("assertEqualsCasePass");
|
||||
}
|
||||
public void testNotEqualsPass1() {
|
||||
testPass("assertNotEqualsPass1");
|
||||
}
|
||||
public void testNotEqualsPass2() {
|
||||
testPass("assertNotEqualsPass2");
|
||||
}
|
||||
public void testPropertySetPass() {
|
||||
testPass("assertPropertySetPass");
|
||||
}
|
||||
public void testPropertyNotSetPass() {
|
||||
testPass("assertPropertyNotSetPass");
|
||||
}
|
||||
public void testPropertyEqualsPass() {
|
||||
testPass("assertPropertyEqualsPass");
|
||||
}
|
||||
public void testPropertyEqualsCasePass() {
|
||||
testPass("assertPropertyEqualsCasePass");
|
||||
}
|
||||
public void testPropertyNotEqualsPass1() {
|
||||
testPass("assertPropertyNotEqualsPass1");
|
||||
}
|
||||
public void testPropertyNotEqualsPass2() {
|
||||
testPass("assertPropertyNotEqualsPass2");
|
||||
}
|
||||
public void testPropertyContains() {
|
||||
testPass("assertPropertyContains");
|
||||
}
|
||||
public void testPropertyDoesntContain() {
|
||||
testPass("assertPropertyDoesntContain");
|
||||
}
|
||||
public void testFileExistsPass() {
|
||||
testPass("assertFileExistsPass");
|
||||
}
|
||||
|
|
@ -106,9 +85,6 @@ public class AssertTest extends BuildFileTest {
|
|||
public void testReferenceSetPass() {
|
||||
testPass("assertReferenceSetPass");
|
||||
}
|
||||
public void testReferenceIsNotSetPass() {
|
||||
testPass("assertReferenceIsNotSetPass");
|
||||
}
|
||||
public void testReferenceIsTypePass() {
|
||||
testPass("assertReferenceIsTypePass");
|
||||
}
|
||||
|
|
@ -125,18 +101,9 @@ public class AssertTest extends BuildFileTest {
|
|||
public void testEqualsFail2() {
|
||||
testFail("assertEqualsFail2", "Expected 'bar' but was 'BAR'");
|
||||
}
|
||||
public void testNotEqualsFail() {
|
||||
testFail("assertNotEqualsFail", "Didn't expect 'bar' to be 'bar'");
|
||||
}
|
||||
public void testNotEqualsCaseFail() {
|
||||
testFail("assertNotEqualsCaseFail", "Didn't expect 'bar' to be 'BAR'");
|
||||
}
|
||||
public void testPropertySetFail() {
|
||||
testFail("assertPropertySetFail", "Expected property 'foo'");
|
||||
}
|
||||
public void testPropertyNotSetFail() {
|
||||
testFail("assertPropertyNotSetFail", "Didn't expect property 'foo' to be set but was 'bar'");
|
||||
}
|
||||
public void testPropertyEqualsFail1() {
|
||||
testFail("assertPropertyEqualsFail1", "Expected property 'foo' to have value 'bar' but was '${foo}'");
|
||||
}
|
||||
|
|
@ -146,21 +113,12 @@ public class AssertTest extends BuildFileTest {
|
|||
public void testPropertyEqualsFail3() {
|
||||
testFail("assertPropertyEqualsFail3", "Expected property 'foo' to have value 'BAR' but was 'bar'");
|
||||
}
|
||||
public void testPropertyNotEqualsFail1() {
|
||||
testFail("assertPropertyNotEqualsFail1", "Didn't expect property 'foo' to have value 'bar'");
|
||||
}
|
||||
public void testPropertyNotEqualsFail2() {
|
||||
testFail("assertPropertyNotEqualsFail2", "Didn't expect property 'foo' to have value 'bar'");
|
||||
}
|
||||
public void testPropertyNotEqualsCaseFail() {
|
||||
testFail("assertPropertyNotEqualsCaseFail", "Didn't expect property 'foo' to have value 'BAR'");
|
||||
public void testPropertyContains() {
|
||||
testPass("assertPropertyContains");
|
||||
}
|
||||
public void testPropertyContainsFail() {
|
||||
testFail("assertPropertyContainsFail", "Expected property 'foo' to contain value 'foo' but was 'bar'");
|
||||
}
|
||||
public void testPropertyDoesntContainFail() {
|
||||
testFail("assertPropertyDoesntContainFail", "Didn't expect property 'foo' to contain value 'ba' but was 'bar'");
|
||||
}
|
||||
public void testFileExistsFail() {
|
||||
testFail("assertFileExistsFail",
|
||||
"Expected file 'assert.txt' to exist");
|
||||
|
|
@ -196,9 +154,6 @@ public class AssertTest extends BuildFileTest {
|
|||
public void testReferenceSetFail() {
|
||||
testFail("assertReferenceSetFail", "Expected reference 'foo2'");
|
||||
}
|
||||
public void testReferenceIsNotSetFail() {
|
||||
testFail("assertReferenceIsNotSetFail", "Didn't expect reference 'foo4'");
|
||||
}
|
||||
public void testReferenceIsTypeFailNotSet() {
|
||||
testFail("assertReferenceIsTypeFailNotSet",
|
||||
"Expected reference 'foo4'");
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* 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
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@
|
|||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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
|
||||
|
|
@ -21,7 +21,6 @@ package org.apache.ant.antunit;
|
|||
|
||||
import org.apache.tools.ant.BuildEvent;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.util.StringUtils;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
|
|
@ -42,8 +41,8 @@ public class LogCapturerTest extends TestCase {
|
|||
Project p = new Project();
|
||||
LogCapturer c = new LogCapturer(p);
|
||||
|
||||
String[] messages = new String[] { "err", "warn", "info", "verbose", "debug" };
|
||||
|
||||
String[] messages = new String[] {"err", "warn", "info", "verbose",
|
||||
"debug"};
|
||||
for (int i = 0; i < messages.length; i++) {
|
||||
BuildEvent be = new BuildEvent(p);
|
||||
be.setMessage(messages[i], i);
|
||||
|
|
@ -56,32 +55,6 @@ public class LogCapturerTest extends TestCase {
|
|||
assertMessages(c.getDebugLog(), messages, Project.MSG_DEBUG);
|
||||
}
|
||||
|
||||
public void testWithoutMerge() {
|
||||
Project p = new Project();
|
||||
LogCapturer c = new LogCapturer(p);
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
BuildEvent be = new BuildEvent(p);
|
||||
be.setMessage(String.valueOf(i), 0);
|
||||
c.messageLogged(be);
|
||||
}
|
||||
Assert.assertEquals(c.getErrLog(false),
|
||||
"0" + StringUtils.LINE_SEP + "1" + StringUtils.LINE_SEP);
|
||||
}
|
||||
|
||||
public void testWithMerge() {
|
||||
Project p = new Project();
|
||||
LogCapturer c = new LogCapturer(p);
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
BuildEvent be = new BuildEvent(p);
|
||||
be.setMessage(String.valueOf(i), 0);
|
||||
c.messageLogged(be);
|
||||
}
|
||||
Assert.assertEquals(c.getErrLog(), "01");
|
||||
Assert.assertEquals(c.getErrLog(true), "01");
|
||||
}
|
||||
|
||||
private static void assertMessages(String actual, String[] messages,
|
||||
int upTo) {
|
||||
for (int i = 0; i <= upTo && i < messages.length; i++) {
|
||||
|
|
@ -93,4 +66,4 @@ public class LogCapturerTest extends TestCase {
|
|||
actual.indexOf(messages[i]) == -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -7,8 +7,8 @@
|
|||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* 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
|
||||
|
|
@ -26,7 +26,6 @@ import org.apache.tools.ant.Project;
|
|||
import org.apache.tools.ant.types.LogLevel;
|
||||
import org.apache.tools.ant.types.resources.StringResource;
|
||||
import org.apache.tools.ant.util.ResourceUtils;
|
||||
import org.apache.tools.ant.util.StringUtils;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
|
|
@ -52,70 +51,23 @@ public class LogContentTest extends TestCase {
|
|||
Project p = new Project();
|
||||
LogCapturer c = new LogCapturer(p);
|
||||
|
||||
String[] msgs = new String[] { "err", "warn", "info", "verbose", "debug" };
|
||||
|
||||
String[] msgs = new String[] {"err", "warn", "info", "verbose",
|
||||
"debug"};
|
||||
for (int i = 0; i < msgs.length; i++) {
|
||||
BuildEvent be = new BuildEvent(p);
|
||||
be.setMessage(msgs[i], i);
|
||||
c.messageLogged(be);
|
||||
}
|
||||
assertMessages(new LogContent(p, LogLevel.ERR), msgs, Project.MSG_ERR);
|
||||
assertMessages(new LogContent(p, LogLevel.WARN), msgs, Project.MSG_WARN);
|
||||
assertMessages(new LogContent(p, LogLevel.INFO), msgs, Project.MSG_INFO);
|
||||
assertMessages(new LogContent(p, LogLevel.VERBOSE), msgs, Project.MSG_VERBOSE);
|
||||
assertMessages(new LogContent(p, LogLevel.DEBUG), msgs, Project.MSG_DEBUG);
|
||||
}
|
||||
|
||||
public void testWithoutMerge() throws IOException {
|
||||
Project p = new Project();
|
||||
LogCapturer c = new LogCapturer(p);
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
BuildEvent be = new BuildEvent(p);
|
||||
be.setMessage(String.valueOf(i), 0);
|
||||
c.messageLogged(be);
|
||||
}
|
||||
|
||||
LogContent content = new LogContent(p, LogLevel.ERR, false);
|
||||
StringResource s = new StringResource();
|
||||
ResourceUtils.copyResource(content, s);
|
||||
|
||||
Assert.assertEquals(s.getValue(), "0" + StringUtils.LINE_SEP + "1" + StringUtils.LINE_SEP);
|
||||
}
|
||||
|
||||
public void testWithExplicitMerge() throws IOException {
|
||||
Project p = new Project();
|
||||
LogCapturer c = new LogCapturer(p);
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
BuildEvent be = new BuildEvent(p);
|
||||
be.setMessage(String.valueOf(i), 0);
|
||||
c.messageLogged(be);
|
||||
}
|
||||
|
||||
LogContent content = new LogContent(p, LogLevel.ERR, true);
|
||||
StringResource s = new StringResource();
|
||||
ResourceUtils.copyResource(content, s);
|
||||
|
||||
Assert.assertEquals(s.getValue(), "01");
|
||||
}
|
||||
|
||||
public void testWithImplicitMerge() throws IOException {
|
||||
Project p = new Project();
|
||||
LogCapturer c = new LogCapturer(p);
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
BuildEvent be = new BuildEvent(p);
|
||||
be.setMessage(String.valueOf(i), 0);
|
||||
c.messageLogged(be);
|
||||
}
|
||||
|
||||
LogContent content = new LogContent();
|
||||
content.setProject(p);
|
||||
StringResource s = new StringResource();
|
||||
ResourceUtils.copyResource(content, s);
|
||||
|
||||
Assert.assertEquals(s.getValue(), "01");
|
||||
assertMessages(new LogContent(p, LogLevel.ERR), msgs,
|
||||
Project.MSG_ERR);
|
||||
assertMessages(new LogContent(p, LogLevel.WARN), msgs,
|
||||
Project.MSG_WARN);
|
||||
assertMessages(new LogContent(p, LogLevel.INFO), msgs,
|
||||
Project.MSG_INFO);
|
||||
assertMessages(new LogContent(p, LogLevel.VERBOSE), msgs,
|
||||
Project.MSG_VERBOSE);
|
||||
assertMessages(new LogContent(p, LogLevel.DEBUG), msgs,
|
||||
Project.MSG_DEBUG);
|
||||
}
|
||||
|
||||
private static void assertMessages(LogContent content, String[] messages,
|
||||
|
|
@ -125,11 +77,11 @@ public class LogContentTest extends TestCase {
|
|||
String actual = s.getValue();
|
||||
for (int i = 0; i <= upTo && i < messages.length; i++) {
|
||||
Assert.assertTrue("checking for " + messages[i] + " in " + actual,
|
||||
actual.indexOf(messages[i]) > -1);
|
||||
actual.indexOf(messages[i]) > -1);
|
||||
}
|
||||
for (int i = upTo + 1; i < messages.length; i++) {
|
||||
Assert.assertTrue("checking for " + messages[i] + " in " + actual,
|
||||
actual.indexOf(messages[i]) == -1);
|
||||
actual.indexOf(messages[i]) == -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue