diff --git a/build.xml b/build.xml index 0f2c0b409112c29923febf8ba86d694d657dc50f..8cbe8279291ec0f90ac983a7ef5868b9222157b4 100644 --- a/build.xml +++ b/build.xml @@ -2,7 +2,7 @@ <!-- $Id$ --> <project name="align" default="compile" basedir="."> - + <!-- tested --> <target name="usage" depends="init"> <echo message="ant _target_ _options_"/> @@ -50,6 +50,9 @@ </fileset> </path> + <taskdef name="testng" classpathref="classpath" + classname="org.testng.TestNGAntTask" /> + </target> <!-- tested --> @@ -68,7 +71,8 @@ <delete> <fileset dir="classes" includes="**/*.class"/> </delete> - <antcall target="compile"/> + <antcall target="cleanjar"/> + <antcall target="jar"/> <ant dir="plugins/neon" target="compileall" /> </target> @@ -139,6 +143,15 @@ </jar> </target> + <!-- tested --> + <target name="cleanjar" depends="init"> + <echo message="Erasing..."/> + <delete file="lib/align.jar"/> + <delete file="lib/alignsvc.jar"/> + <delete file="lib/alignwn.jar"/> + <delete file="lib/procalign.jar"/> + </target> + <!-- tested --> <target name="aserv" depends="init"> <echo message="Setting property..."/> @@ -155,33 +168,32 @@ </jar> </target> - <!-- not tested --> + <!-- tested --> <target name="test" depends="init"> <echo message="Testing..."/> - <!-- <javac srcdir="test/fr/fluxmedia/transmorpher/graph/rules" - debug="on" destdir="classes"> - <classpath refid="classpath"/> - </javac> --> - <javac srcdir="test/fr/fluxmedia/" debug="on" destdir="classes"> + <javac srcdir="test/src" destdir="test/classes" debug="on"> <classpath refid="classpath"/> </javac> - <antcall target="jar"/> - <junit printsummary="yes" fork="yes" haltonfailure="no"> - <batchtest todir="test/reports/xml/"> - <fileset dir="classes/"> - <include name="**/*Test.class"/> - <exclude name="**/Test.class"/> - </fileset> - <formatter type="xml"/> - </batchtest> - <classpath refid="classpath"/> - </junit> - <junitreport todir="test/reports"> - <fileset dir="test/reports/xml/"> - <include name="TEST-*.xml"/> - </fileset> - <report todir="test/reports/html/"/> - </junitreport> + <testng + sourcedir="test/src" + outputDir="test/html" + haltOnFailure="true" verbose="1"> + <classpath> + <path refid="classpath"/> + <pathelement location="test/classes"/> + </classpath> + <!--xmlfileset dir="${test14.dir}" includes="testng.xml"/--> + <classfileset dir="test" includes="classes/**/*.class"/> + </testng> + </target> + + <!-- tested --> + <target name="cleantest" depends="init"> + <echo message="Cleaning tests..."/> + <delete> + <fileset dir="test/classes" includes="**/*.class"/> + <fileset dir="test/html" includes="**/*.html"/> + </delete> </target> <!-- tested --> @@ -234,6 +246,8 @@ <!--antcall target="commit"/--> <antcall target="compileall"/> <antcall target="jar"/> + <antcall target="test"/> + <antcall targer="cleantests"/> <antcall target="javadoc"/> <ant dir="plugins/neon" target="jar"> <property name="version" value="${version}"/> diff --git a/lib/testng.jar b/lib/testng.jar new file mode 100644 index 0000000000000000000000000000000000000000..31ef718e79ce84c9a1906e4b4593efa3c4e8733b Binary files /dev/null and b/lib/testng.jar differ diff --git a/test/src/BasicAlignmentTest.java b/test/src/BasicAlignmentTest.java new file mode 100644 index 0000000000000000000000000000000000000000..79da5e746eda3bb4a24c0b3de2742fa928311080 --- /dev/null +++ b/test/src/BasicAlignmentTest.java @@ -0,0 +1,46 @@ +/* + * $Id$ + * + * Copyright (C) INRIA Rhône-Alpes, 2008 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +//package test.com.acme.dona.dep; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertNull; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Configuration; +import org.testng.annotations.Test; +//import org.testng.annotations.*; + +import fr.inrialpes.exmo.align.impl.OWLAPIAlignment; + +public class BasicAlignmentTest { + private OWLAPIAlignment alignment = null; + + @BeforeClass(groups = { "fast" }) + private void init(){ + alignment = new OWLAPIAlignment(); + } + + @Test(groups = { "fast" }) + public void aFastTest() { + assertNotNull( alignment, "Alignment was null" ); + } + +} diff --git a/test/src/OWLAPIAlignmentTest.java b/test/src/OWLAPIAlignmentTest.java new file mode 100644 index 0000000000000000000000000000000000000000..40880c72f649a73387ded41b5721139a40d25ab3 --- /dev/null +++ b/test/src/OWLAPIAlignmentTest.java @@ -0,0 +1,66 @@ +/* + * $Id$ + * + * Copyright (C) INRIA Rhône-Alpes, 2008 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +//package test.com.acme.dona.dep; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertNull; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Configuration; +import org.testng.annotations.Test; +//import org.testng.annotations.*; + +import fr.inrialpes.exmo.align.impl.OWLAPIAlignment; +import fr.inrialpes.exmo.align.impl.URIAlignment; +import fr.inrialpes.exmo.align.onto.OntologyCache; +import fr.inrialpes.exmo.align.parser.AlignmentParser; + +public class OWLAPIAlignmentTest { + + private OWLAPIAlignment alignment = null; + + @BeforeClass(groups = { "fast" }) + private void init(){ + alignment = new OWLAPIAlignment(); + } + + @Test(groups = { "fast" }) + public void aFastTest() { + //System.out.println("Fast test"); + assertNotNull( alignment, "Alignment was null" ); + } + + @Test(groups = { "full" }) + public void loadingAndConvertingTest() throws Exception { + //System.out.println("Fast test"); + assertNotNull( alignment, "Alignment was null" ); + AlignmentParser aparser = new AlignmentParser( 0 ); + assertNotNull( aparser, "AlignmentParser was null" ); + URIAlignment result = (URIAlignment)aparser.parse( "file:examples/rdf/newsample.rdf" ); + assertNotNull( result, "URIAlignment(result) was null" ); + alignment = OWLAPIAlignment.toOWLAPIAlignment( result, (OntologyCache)null ); + assertNotNull( alignment, "toOWLAPIAlignment(result) was null" ); + assertEquals( alignment.getLevel(), "0" ); + assertEquals( alignment.getType(), "**" ); + assertEquals( alignment.nbCells(), 2 ); + } + +} diff --git a/test/src/READMETest.java b/test/src/READMETest.java new file mode 100644 index 0000000000000000000000000000000000000000..796f3084f5f17e592f2bc717d2cec2b8714e2a87 --- /dev/null +++ b/test/src/READMETest.java @@ -0,0 +1,145 @@ +/* + * $Id$ + * + * Copyright (C) INRIA Rhône-Alpes, 2008 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +//package test.com.acme.dona.dep; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertNull; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Configuration; +import org.testng.annotations.Test; +//import org.testng.annotations.*; + +import org.semanticweb.owl.align.AlignmentProcess; +import org.semanticweb.owl.align.Parameters; +import fr.inrialpes.exmo.align.impl.method.StringDistAlignment; +import fr.inrialpes.exmo.align.impl.BasicParameters; +import fr.inrialpes.exmo.align.impl.URIAlignment; +import fr.inrialpes.exmo.align.onto.OntologyCache; +import fr.inrialpes.exmo.align.parser.AlignmentParser; + + +public class READMETest { + + private AlignmentProcess alignment = null; + + @Test(groups = { "full", "routine" }) + public void routineTest1() { + /* + $ java -jar lib/procalign.jar --help + */ + } + + @Test(groups = { "full", "routine" }) + public void routineTest2() { + alignment = new StringDistAlignment(); + assertEquals( alignment.nbCells(), 0 ); + assertNotNull( alignment, "ObjectAlignment should not be null" ); + //alignment.init( , ); + //alignment.align( (Alignment)null, ); + assertEquals( alignment.nbCells(), 0 ); + /* +$ java -jar lib/procalign.jar file://$CWD/examples/rdf/onto1.owl file://$CWD/examples/rdf/onto2.owl + + */ + } + + @Test(groups = { "full", "routine" }) + public void routineTest3() { + /* +$ java -jar lib/procalign.jar file://$CWD/examples/rdf/onto1.owl file://$CWD/examples/rdf/onto2.owl -i fr.inrialpes.exmo.align.impl.method.StringDistAlignment -DstringFunction=levenshteinDistance -r fr.inrialpes.exmo.align.impl.renderer.OWLAxiomsRendererVisitor + + */ + } + + @Test(groups = { "full", "routine" }) + public void routineTest4() { + /* +$ java -jar lib/procalign.jar file://$CWD/examples/rdf/onto1.owl file://$CWD/examples/rdf/onto2.owl -i fr.inrialpes.exmo.align.impl.method.StringDistAlignment -DstringFunction=levenshteinDistance -t 0.4 -o examples/rdf/sample.rdf + + */ + } + + @Test(groups = { "full", "routine" }) + public void routineTest5() { + /* +$ java -cp lib/procalign.jar fr.inrialpes.exmo.align.util.ParserPrinter examples/rdf/newsample.rdf + + */ + } + + @Test(groups = { "full", "routine" }) + public void routineTest6() { + /* +$ java -jar lib/procalign.jar file://$CWD/examples/rdf/onto1.owl file://$CWD/examples/rdf/onto2.owl -a examples/rdf/sample.rdf + + */ + } + + @Test(groups = { "full", "routine" }) + public void routineTest7() { + /* +$ java -jar lib/Procalign.jar file://$CWD/examples/rdf/edu.umbc.ebiquity.publication.owl file://$CWD/examples/rdf/edu.mit.visus.bibtex.owl + + */ + } + + @Test(groups = { "full", "routine" }) + public void routineTest8() { + /* +$ java -jar lib/Procalign.jar file://$CWD/examples/rdf/edu.umbc.ebiquity.publication.owl file://$CWD/examples/rdf/edu.mit.visus.bibtex.owl -i fr.inrialpes.exmo.align.impl.method.StringDistAlignment -DstringFunction=levenshteinDistance -o examples/rdf/bibref.rdf + + */ + } + + @Test(groups = { "full", "routine" }) + public void routineTest9() { + /* +$ java -jar lib/Procalign.jar file://$CWD/examples/rdf/edu.umbc.ebiquity.publication.owl file://$CWD/examples/rdf/edu.mit.visus.bibtex.owl -i fr.inrialpes.exmo.align.impl.method.StringDistAlignment -DstringFunction=subStringDistance -t .4 -o examples/rdf/bibref2.rdf + + */ + } + + @Test(groups = { "full", "routine" }) + public void routineEvalTest() { + /* +$ java -cp lib/procalign.jar fr.inrialpes.exmo.align.util.EvalAlign -i fr.inrialpes.exmo.align.impl.eval.PRecEvaluator file://$CWD/examples/rdf/bibref2.rdf file://$CWD/examples/rdf/bibref.rdf + + */ + } + + @Test(groups = { "full", "routine" }) + public void routineMatrixTest() { + /* +$ java -jar lib/Procalign.jar file://$CWD/examples/rdf/edu.umbc.ebiquity.publication.owl file://$CWD/examples/rdf/edu.mit.visus.bibtex.owl -i fr.inrialpes.exmo.align.impl.method.StringDistAlignment -DstringFunction=levenshteinDistance -DprintMatrix=1 -o /dev/null > examples/rdf/matrix.tex +*/ + } + + @Test(groups = { "full", "routine" }) + public void routineJWNLTest() { + /* For JWNL Readme + +$ setenv WNDIR ../WordNet-2.0/dict +$ java -jar lib/alignwn.jar -Dwndict=$WNDIR file://$CWD/examples/rdf/edu.umbc.ebiquity.publication.owl file://$CWD/examples/rdf/edu.mit.visus.bibtex.owl -i fr.inrialpes.exmo.align.ling.JWNLAlignment -o examples/rdf/JWNL.rdf + + */ + } +}