Automate unit tests
This commit is contained in:
parent
f90027684c
commit
24f769849b
3 changed files with 42 additions and 19 deletions
|
@ -25,34 +25,34 @@
|
|||
</path>
|
||||
|
||||
<target name="-dirs">
|
||||
<mkdir dir="${bin.absolute.dir}"/>
|
||||
<mkdir dir="${bin.absolute.dir}"/>
|
||||
</target>
|
||||
|
||||
<target name="-copy-resources">
|
||||
<mkdir dir="${icons.absolute.dir}"/>
|
||||
<mkdir dir="${icons.absolute.dir}"/>
|
||||
<copy todir="${icons.absolute.dir}">
|
||||
<fileset dir="../OsmAnd/res/drawable-mdpi/">
|
||||
<include name="h_*.png"/>
|
||||
<include name="g_*.png"/>
|
||||
</fileset>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="-version" if="build.version">
|
||||
<replace file="src/net/osmand/MapCreatorVersion.java" token="String APP_DESCRIPTION" value="String APP_DESCRIPTION="${build.version}";//"/>
|
||||
<replace file="src/net/osmand/MapCreatorVersion.java" token="String APP_DESCRIPTION" value="String APP_DESCRIPTION="${build.version}";//"/>
|
||||
</target>
|
||||
|
||||
<target name="clean">
|
||||
<delete dir="${bin.absolute.dir}"/>
|
||||
<delete dir="${bin.absolute.dir}"/>
|
||||
</target>
|
||||
|
||||
<target name="compile" depends="-copy-resources,-dirs,-version">
|
||||
<copy todir="${bin.absolute.dir}">
|
||||
<fileset dir="${src.absolute.dir}">
|
||||
<exclude name="**/*.java" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<javac srcdir="${src.absolute.dir}"
|
||||
<copy todir="${bin.absolute.dir}">
|
||||
<fileset dir="${src.absolute.dir}">
|
||||
<exclude name="**/*.java" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<javac srcdir="${src.absolute.dir}"
|
||||
destdir="${bin.absolute.dir}"
|
||||
encoding="${java.encoding}"
|
||||
classpathref="build.path"
|
||||
|
@ -61,6 +61,23 @@
|
|||
/>
|
||||
</target>
|
||||
|
||||
<path id="test.classpath">
|
||||
<pathelement location="${bin.absolute.dir}" />
|
||||
<fileset dir="${lib.absolute.dir}">
|
||||
<include name="*.jar" />
|
||||
</fileset>
|
||||
</path>
|
||||
|
||||
<target name="routetest" depends="compile">
|
||||
<junit >
|
||||
<sysproperty key="basedir" value="${basedir}"/>
|
||||
<sysproperty key="obfdir" value="${obfdir}"/>
|
||||
<classpath refid="test.classpath"/>
|
||||
<formatter type="xml" />
|
||||
<test name="net.osmand.router.test.JUnitRouteTest" todir="${basedir}/test-results" />
|
||||
</junit>
|
||||
</target>
|
||||
|
||||
<target name="jar" depends="-copy-resources, -dirs">
|
||||
<manifestclasspath property="lib.list" jarfile="OsmAndMapCreator.jar">
|
||||
<classpath refid="build.path"/>
|
||||
|
@ -90,7 +107,7 @@
|
|||
<delete file="MANIFEST.MF" />
|
||||
</target>
|
||||
|
||||
<target name="build" depends="jar">
|
||||
<target name="build" depends="jar, routetest">
|
||||
<delete dir="build"/>
|
||||
<copy todir="build">
|
||||
<fileset dir=".">
|
||||
|
@ -121,10 +138,10 @@
|
|||
<taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask" classpathref="ant.lib.path"/>
|
||||
|
||||
<target name="cpd" description="Search for cut-and-pasted code">
|
||||
<property name="cpd.report.xml" location="cpd.xml"/>
|
||||
<cpd minimumTokenCount="100" format="xml" outputFile="${cpd.report.xml}"
|
||||
<property name="cpd.report.xml" location="cpd.xml"/>
|
||||
<cpd minimumTokenCount="100" format="xml" outputFile="${cpd.report.xml}"
|
||||
ignoreLiterals="true" ignoreIdentifiers="true">
|
||||
<fileset dir="${src.absolute.dir}" includes="**/*.java"/>
|
||||
</cpd>
|
||||
<fileset dir="${src.absolute.dir}" includes="**/*.java"/>
|
||||
</cpd>
|
||||
</target>
|
||||
</project>
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.util.List;
|
|||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import net.osmand.Algoritms;
|
||||
import net.osmand.binary.BinaryMapIndexReader;
|
||||
import net.osmand.router.BinaryRoutePlanner;
|
||||
import net.osmand.router.RoutingConfiguration;
|
||||
|
@ -27,9 +28,13 @@ public class JUnitRouteTest {
|
|||
return;
|
||||
}
|
||||
BinaryRoutePlanner.PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST = false;
|
||||
String obfdir = System.getenv("obfdir");
|
||||
if(Algoritms.isEmpty(obfdir)){
|
||||
obfdir = DataExtractionSettings.getSettings().getBinaryFilesDir();
|
||||
}
|
||||
|
||||
List<File> files = new ArrayList<File>();
|
||||
for (File f : new File(DataExtractionSettings.getSettings().getBinaryFilesDir()).listFiles()) {
|
||||
for (File f : new File(obfdir).listFiles()) {
|
||||
if (f.getName().endsWith(".obf")) {
|
||||
files.add(f);
|
||||
}
|
||||
|
|
1
DataExtractionOSM/test-results/.gitignore
vendored
Normal file
1
DataExtractionOSM/test-results/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
*.xml
|
Loading…
Reference in a new issue