adding minimal unit testing framework (type ./gridworks test to run)
git-svn-id: http://google-refine.googlecode.com/svn/trunk@253 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
0a7882bf6c
commit
358586ac8f
@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src/main/java"/>
|
<classpathentry kind="src" path="src/main/java"/>
|
||||||
|
<classpathentry kind="src" path="tests/src"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry kind="lib" path="lib/servlet-api-2.5.jar" sourcepath="lib-src/servlet-api-2.5-sources.jar"/>
|
<classpathentry kind="lib" path="lib/servlet-api-2.5.jar" sourcepath="lib-src/servlet-api-2.5-sources.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jetty-6.1.22.jar" sourcepath="lib-src/jetty-6.1.22-sources.jar"/>
|
<classpathentry kind="lib" path="lib/jetty-6.1.22.jar" sourcepath="lib-src/jetty-6.1.22-sources.jar"/>
|
||||||
@ -17,5 +18,6 @@
|
|||||||
<classpathentry kind="lib" path="lib/poi-3.6.jar"/>
|
<classpathentry kind="lib" path="lib/poi-3.6.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/poi-ooxml-3.6.jar"/>
|
<classpathentry kind="lib" path="lib/poi-ooxml-3.6.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/apache-tools-tar.jar"/>
|
<classpathentry kind="lib" path="lib/apache-tools-tar.jar"/>
|
||||||
|
<classpathentry kind="lib" path="tests/lib/junit-4.8.1.jar" sourcepath="tests/lib-src/junit-4.8.1-sources.jar"/>
|
||||||
<classpathentry kind="output" path="build/classes"/>
|
<classpathentry kind="output" path="build/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
17
build.xml
17
build.xml
@ -24,8 +24,10 @@
|
|||||||
<property name="graphics.dir" value="${basedir}/src/graphics" />
|
<property name="graphics.dir" value="${basedir}/src/graphics" />
|
||||||
<property name="lib.dir" value="${basedir}/lib" />
|
<property name="lib.dir" value="${basedir}/lib" />
|
||||||
<property name="tools.dir" value="${basedir}/thirdparty" />
|
<property name="tools.dir" value="${basedir}/thirdparty" />
|
||||||
|
<property name="tests.dir" value="${basedir}/tests" />
|
||||||
|
|
||||||
<property name="classes.dir" value="${build.dir}/classes" />
|
<property name="classes.dir" value="${build.dir}/classes" />
|
||||||
|
<property name="tests_classes.dir" value="${tests.dir}/classes" />
|
||||||
<property name="bundle.dir" value="${build.dir}/bundle" />
|
<property name="bundle.dir" value="${build.dir}/bundle" />
|
||||||
<property name="exe.dir" value="${build.dir}/exe" />
|
<property name="exe.dir" value="${build.dir}/exe" />
|
||||||
|
|
||||||
@ -35,6 +37,13 @@
|
|||||||
</fileset>
|
</fileset>
|
||||||
</path>
|
</path>
|
||||||
|
|
||||||
|
<path id="tests.class.path">
|
||||||
|
<path refid="class.path"/>
|
||||||
|
<fileset dir="${tests.dir}/lib">
|
||||||
|
<include name="**/*.jar" />
|
||||||
|
</fileset>
|
||||||
|
</path>
|
||||||
|
|
||||||
<target name="build">
|
<target name="build">
|
||||||
<mkdir dir="${classes.dir}" />
|
<mkdir dir="${classes.dir}" />
|
||||||
<javac srcdir="${src.dir}" destdir="${classes.dir}" debug="true" includeAntRuntime="no">
|
<javac srcdir="${src.dir}" destdir="${classes.dir}" debug="true" includeAntRuntime="no">
|
||||||
@ -42,6 +51,13 @@
|
|||||||
</javac>
|
</javac>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
<target name="build_tests" depends="build">
|
||||||
|
<mkdir dir="${tests_classes.dir}" />
|
||||||
|
<javac srcdir="${tests.dir}/src" destdir="${tests_classes.dir}" debug="true" includeAntRuntime="no">
|
||||||
|
<classpath refid="tests.class.path" />
|
||||||
|
</javac>
|
||||||
|
</target>
|
||||||
|
|
||||||
<target name="jar" depends="build">
|
<target name="jar" depends="build">
|
||||||
<jar destfile="${build.dir}/gridworks.jar" basedir="${classes.dir}"/>
|
<jar destfile="${build.dir}/gridworks.jar" basedir="${classes.dir}"/>
|
||||||
</target>
|
</target>
|
||||||
@ -137,6 +153,7 @@
|
|||||||
<target name="clean">
|
<target name="clean">
|
||||||
<delete file="${build.dir}/gridworks.jar" />
|
<delete file="${build.dir}/gridworks.jar" />
|
||||||
<delete dir="${classes.dir}" />
|
<delete dir="${classes.dir}" />
|
||||||
|
<delete dir="${tests_classes.dir}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="distclean">
|
<target name="distclean">
|
||||||
|
35
gridworks
35
gridworks
@ -45,6 +45,8 @@ and <action> is one of
|
|||||||
build ..................... Build Gridworks
|
build ..................... Build Gridworks
|
||||||
run ....................... Run Gridworks
|
run ....................... Run Gridworks
|
||||||
|
|
||||||
|
test ...................... Test Gridworks
|
||||||
|
|
||||||
make_dmg <version> ........ Make MacOSX DMG distribution
|
make_dmg <version> ........ Make MacOSX DMG distribution
|
||||||
make_exe <version> ........ Make Windows EXE distribution
|
make_exe <version> ........ Make Windows EXE distribution
|
||||||
|
|
||||||
@ -205,6 +207,30 @@ make_dmg() {
|
|||||||
rm -f "$GRIDWORKS_BUILD_DIR/temp_gridworks.dmg"
|
rm -f "$GRIDWORKS_BUILD_DIR/temp_gridworks.dmg"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test() {
|
||||||
|
if [ ! -d $GRIDWORKS_TEST_DIR/classes ] ; then
|
||||||
|
ant build_tests
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
CLASSPATH="$GRIDWORKS_BUILD_DIR/classes:$GRIDWORKS_TEST_DIR/classes:$GRIDWORKS_TEST_DIR/lib/*:$GRIDWORKS_LIB_DIR/*"
|
||||||
|
|
||||||
|
if [ "$1" == "" ] ; then
|
||||||
|
cd $GRIDWORKS_TEST_DIR/classes
|
||||||
|
TESTS=`find . -name '*.class' | sed s@/@.@g | sed s@.class@@ | sed s@..@@`
|
||||||
|
cd ../..
|
||||||
|
else
|
||||||
|
TESTS=$1
|
||||||
|
fi
|
||||||
|
|
||||||
|
RUN_CMD="$JAVA -cp $CLASSPATH $OPTS org.junit.runner.JUnitCore $TESTS"
|
||||||
|
|
||||||
|
echo "$RUN_CMD"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
exec $RUN_CMD
|
||||||
|
}
|
||||||
|
|
||||||
run() {
|
run() {
|
||||||
if [ ! -d $GRIDWORKS_BUILD_DIR/classes ] ; then
|
if [ ! -d $GRIDWORKS_BUILD_DIR/classes ] ; then
|
||||||
ant build
|
ant build
|
||||||
@ -279,7 +305,7 @@ ACTION=$1; shift
|
|||||||
# ----- Verify and Set Required Environment Variables -------------------------
|
# ----- Verify and Set Required Environment Variables -------------------------
|
||||||
|
|
||||||
if [ "$JAVA_OPTIONS" == "" ] ; then
|
if [ "$JAVA_OPTIONS" == "" ] ; then
|
||||||
JAVA_OPTIONS="-Xms256M -Xmx1024M -XX:+UseLargePages -XX:+UseParallelGC"
|
JAVA_OPTIONS="-Xms256M -Xmx1024M -XX:+UseParallelGC"
|
||||||
fi
|
fi
|
||||||
add_option "$JAVA_OPTIONS"
|
add_option "$JAVA_OPTIONS"
|
||||||
|
|
||||||
@ -298,6 +324,10 @@ if [ "$GRIDWORKS_WEBAPP" == "" ] ; then
|
|||||||
fi
|
fi
|
||||||
add_option "-Dgridworks.webapp=$GRIDWORKS_WEBAPP"
|
add_option "-Dgridworks.webapp=$GRIDWORKS_WEBAPP"
|
||||||
|
|
||||||
|
if [ "$GRIDWORKS_TEST_DIR" == "" ] ; then
|
||||||
|
GRIDWORKS_TEST_DIR="tests"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$GRIDWORKS_BUILD_DIR" == "" ] ; then
|
if [ "$GRIDWORKS_BUILD_DIR" == "" ] ; then
|
||||||
GRIDWORKS_BUILD_DIR="build"
|
GRIDWORKS_BUILD_DIR="build"
|
||||||
fi
|
fi
|
||||||
@ -326,6 +356,9 @@ case "$ACTION" in
|
|||||||
distclean)
|
distclean)
|
||||||
ant distclean;;
|
ant distclean;;
|
||||||
|
|
||||||
|
test)
|
||||||
|
test $1;;
|
||||||
|
|
||||||
run)
|
run)
|
||||||
run;;
|
run;;
|
||||||
|
|
||||||
|
BIN
tests/lib-src/junit-4.8.1-sources.jar
Normal file
BIN
tests/lib-src/junit-4.8.1-sources.jar
Normal file
Binary file not shown.
@ -0,0 +1,9 @@
|
|||||||
|
package com.metaweb.gridworks.tests;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class GridworksTests {
|
||||||
|
|
||||||
|
@Test public void test() {
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user