File: build-test.xml

package info (click to toggle)
libjackson-json-java 1.5.3%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 5,392 kB
  • ctags: 7,846
  • sloc: java: 46,768; xml: 938; makefile: 21
file content (183 lines) | stat: -rw-r--r-- 7,942 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<?xml version="1.0" standalone='yes'?>
<!-- This Ant build file fragment contains targets needed
     to run unit tests
  -->

<project name="Jackson Unit tests" basedir=".">
    <!-- Source directories -->
    <property name="dir.src.test" location="${dir.src}/test" />
    <!-- some support for perf testing -->
    <property name="dir.build.classes.perf" location="${dir.build}/classes/perf" />
    <!-- Unit Tests -->
    <property name="dir.test" location="${basedir}/test" />
    <property name="dir.test.classes" location="${dir.test}/classes" />
    <property name="dir.test.results" location="${dir.test}/results" />
    <property name="dir.test.xmlresults" location="${dir.test.results}/xml" />

    <path id="test-libs">
       <fileset dir="${dir.lib}">
            <!-- for actual unit testing, junit -->
            <include name="junit/*.jar" />
       </fileset>
    </path>
    <!-- Libs only needed for tests that check optional interoperability
         extensions
      -->
    <path id="test-libs-ext">
       <fileset dir="${dir.lib}">
            <!-- For 1.5, need JAXB API jar too (and related) -->
            <include name="jaxb/*.jar" />
            <!-- and some other misc libs for interoperability tests -->
            <include name="ext/**/*.jar" />
       </fileset>
    </path>

    <target name="test.prepare">
        <!-- make test output directories -->
        <mkdir dir="${dir.test}" />
        <mkdir dir="${dir.test.classes}" />
        <mkdir dir="${dir.test.results}" />
        <mkdir dir="${dir.test.xmlresults}" />
    </target>

    <!--*********************************************************************-->
    <!-- Tasks from here down are in support of junit tests.                 -->
    <!--*********************************************************************-->
    <target name="all-tests" depends="test" />

    <!-- Compiling and running test cases
      -->

    <target name="test.compile" depends="test.prepare, compile.mapper, compile.xc, compile.jaxrs">  
        <javac srcdir="${dir.src.test}" destdir="${dir.test.classes}"
            source="1.5" target="1.5"
            debug="true"
        >
            <exclude name="org/codehaus/jackson/map/interop/*.java" />
            <include name="**/*.java" />
            <classpath>
                <pathelement path="${dir.build.classes.core}"/>  
                <pathelement path="${dir.build.classes.mapper}"/>  
                <pathelement path="${dir.build.classes.jaxrs}"/>  
                <pathelement path="${dir.build.classes.xc}"/>  
                <path refid="test-libs"/>
                <fileset dir="${dir.lib}/jaxrs">
                    <include name="*.jar" />
                </fileset>
            </classpath>
        </javac>
        <javac srcdir="${dir.src.test}" destdir="${dir.test.classes}"
            source="1.5" target="1.5"
            debug="true"
        >
            <include name="org/codehaus/jackson/map/interop/*.java" />
            <classpath>
                <pathelement path="${dir.build.classes.core}"/>
                <pathelement path="${dir.build.classes.mapper}"/>  
                <path refid="test-libs"/>
                <path refid="test-libs-ext"/>
            </classpath>
        </javac>
  </target>


    <target name="test" depends="test.run">
        <junitreport todir="${dir.test.results}">
            <fileset dir="${dir.test.xmlresults}">
                <include name="TEST-*.xml" />
            </fileset>
            <report todir="${dir.test.results}" />
        </junitreport>
    </target>

    <target name="test.run" depends="test.compile">
       <!-- showoutput 'yes' to allow outputting debug msgs... -->
        <junit fork="no" printsummary="yes" haltonfailure="no"
         showoutput="yes">
            <batchtest fork="no" todir="${dir.test.xmlresults}">
                <fileset dir="${dir.test.classes}">
                    <!-- Need to exclude inner classes... -->
                    <exclude name="**/*$*.class"/>
                    <!-- and also interop tests, run later on -->
                    <exclude name="org/codehaus/jackson/jaxrs/*.class"/>
                    <exclude name="org/codehaus/jackson/map/interop/Test*.class"/>
                    <include name="**/Test*.class"/>
                </fileset>
            </batchtest>
            <formatter type="xml" />
            <classpath>
                <pathelement path="${dir.build.classes.core}" />
                <pathelement path="${dir.build.classes.mapper}" />
                <pathelement path="${dir.build.classes.xc}" />
                <pathelement location="${dir.test.classes}" /> 
                <path refid="test-libs"/>
            </classpath>     
        </junit>

        <!-- for interop tests, yes, we need to fork (classloading issues) -->
        <junit fork="yes" printsummary="yes" haltonfailure="no" showoutput="yes">
            <batchtest fork="no" todir="${dir.test.xmlresults}">
                <fileset dir="${dir.test.classes}">
                    <exclude name="**/*$*.class"/>
                    <!-- 25-Nov-2009, tatu: Argh. Looks like classloading
                        is problematic for this test; works when run
                        separately as single test... but not in sequence
                      -->
                    <exclude name="org/codehaus/jackson/map/interop/TestHibernate.class"/>
                    <include name="org/codehaus/jackson/map/interop/Test*.class"/>
                </fileset>
            </batchtest>
            <formatter type="xml" />
            <classpath>
                <pathelement path="${dir.build.classes.core}" />
                <pathelement path="${dir.build.classes.mapper}" />
                <pathelement location="${dir.test.classes}" /> 
                <path refid="test-libs"/>
                <path refid="test-libs-ext"/>
            </classpath>
        </junit>
        <!-- And finally, minimal testing for jax-rs too -->
        <junit fork="yes" printsummary="yes" haltonfailure="no" showoutput="yes">
            <batchtest fork="no" todir="${dir.test.xmlresults}">
                <fileset dir="${dir.test.classes}">
                    <exclude name="**/*$*.class"/>
                    <include name="org/codehaus/jackson/jaxrs/*.class"/>
                </fileset>
            </batchtest>
            <formatter type="xml" />
            <classpath>
                <pathelement path="${dir.build.classes.core}" />
                <pathelement path="${dir.build.classes.mapper}" />
                <pathelement path="${dir.build.classes.jaxrs}" />
                <pathelement location="${dir.test.classes}" /> 
                <path refid="test-libs"/>
                <fileset dir="${dir.lib}/jaxrs">
                    <include name="*.jar" />
                </fileset>
            </classpath>
        </junit>
    </target>

    <!-- Running a single Unit Test -->
    <target name="test.single" depends="test.compile">
         <fail unless="test" message="Must define -Dtest" />
       <!-- showoutput 'yes' to allow outputting debug msgs... -->
        <junit fork="no" maxmemory="128M" showoutput="yes" printsummary="yes">
          <formatter type="plain" usefile="no" />
          <test name="${test}" />
          <classpath>
                <pathelement path="${dir.build.classes.core}" />
                <pathelement path="${dir.build.classes.mapper}" />
                <pathelement path="${dir.build.classes.xc}" />
                <pathelement path="${dir.build.classes.jaxrs}" />
                <pathelement location="${dir.test.classes}" /> 
                <path refid="test-libs"/>
                <path refid="test-libs-ext"/>
                <fileset dir="${dir.lib}/jaxrs">
                    <include name="*.jar" />
                </fileset>
          </classpath>     
        </junit>
    </target>

</project>