Revision: 17925
http://sourceforge.net/p/gate/code/17925
Author: markagreenwood
Date: 2014-05-07 19:35:16 +0000 (Wed, 07 May 2014)
Log Message:
-----------
some tidying of the test classes to remove stuff that is no longer used so I
can figure out where to add new tests
Modified Paths:
--------------
gate/trunk/src/test/gate/TestGate.java
Removed Paths:
-------------
gate/trunk/src/test/gate/creole/TestSplitterTagger.java
gate/trunk/src/test/gate/jape/functest/TestJape2.java
gate/trunk/src/test/gate/jape/functest/TestTransducer.java
Modified: gate/trunk/src/test/gate/TestGate.java
===================================================================
--- gate/trunk/src/test/gate/TestGate.java 2014-05-07 09:45:23 UTC (rev
17924)
+++ gate/trunk/src/test/gate/TestGate.java 2014-05-07 19:35:16 UTC (rev
17925)
@@ -35,6 +35,7 @@
import gate.creole.test.DynamicRegistrationTest;
import gate.email.TestEmail;
import gate.html.TestHtml;
+import gate.jape.functest.TestConstraints;
import gate.jape.functest.TestJape;
import gate.persist.TestPersist;
import gate.sgml.TestSgml;
@@ -168,11 +169,11 @@
suite.addTest(TestFiles.suite());
suite.addTest(TestJavac.suite());
suite.addTest(TestJape.suite());
+
+ //TODO fix these tests so that they work properly
+ //suite.addTest(TestConstraints.suite());
+
suite.addTest(TestTemplate.suite());
- /* The TCL tests rely on the application being started from the
- * gate directory. This is not possible from the nightly build script.
- */
-// suite.addTest(TestJacl.suite());
suite.addTest(TestDocument.suite());
suite.addTest(TestDocumentStaxUtils.suite());
suite.addTest(TestTikaFormats.suite());
@@ -180,7 +181,6 @@
suite.addTest(TestCorpus.suite());
suite.addTest(TestSerialCorpus.suite());
suite.addTest(TestDiffer.suite());
- //suite.addTest(TestIaa.suite()); Moved this to the IAA plugin
suite.addTest(TestAnnotationMerging.suite());
suite.addTest(TestClassificationMeasures.suite());
//no longer needed as replaced by testPR
Deleted: gate/trunk/src/test/gate/creole/TestSplitterTagger.java
===================================================================
--- gate/trunk/src/test/gate/creole/TestSplitterTagger.java 2014-05-07
09:45:23 UTC (rev 17924)
+++ gate/trunk/src/test/gate/creole/TestSplitterTagger.java 2014-05-07
19:35:16 UTC (rev 17925)
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 1995-2012, The University of Sheffield. See the file
- * COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
- *
- * This file is part of GATE (see http://gate.ac.uk/), and is free
- * software, licenced under the GNU Library General Public License,
- * Version 2, June 1991 (in the distribution as file licence.html,
- * and also available at http://gate.ac.uk/gate/licence.html).
- *
- * Valentin Tablan 17/05/01
- *
- * $Id$
- */
-package gate.creole;
-
-import java.net.URL;
-import java.util.Iterator;
-
-import junit.framework.*;
-
-import gate.*;
-import gate.corpora.TestDocument;
-import gate.creole.splitter.SentenceSplitter;
-import gate.creole.tokeniser.DefaultTokeniser;
-import gate.util.GateException;
-
-/**
- * Test code for the SentenceSplitter and the POS tagger.
- */
-public class TestSplitterTagger extends TestCase{
-
-/** Construction */
- public TestSplitterTagger(String name) { super(name); }
-
- /** Fixture set up */
- @Override
- public void setUp() throws GateException {
- } // setUp
-
- /** Put things back as they should be after running tests
- * (reinitialise the CREOLE register).
- */
- @Override
- public void tearDown() throws Exception {
- } // tearDown
-
- /** Test suite routine for the test runner */
- public static Test suite() {
- return new TestSuite(TestSplitterTagger.class);
- } // suite
-
-
-
- public void testSplitterTagger() throws Exception{
- //get a document
- Document doc = Factory.newDocument(
- new URL(TestDocument.getTestServerName() + "tests/doc0.html")
- );
-
- //tokenise the document
- //create a tokeniser
- FeatureMap params = Factory.newFeatureMap();
- DefaultTokeniser tokeniser = (DefaultTokeniser) Factory.createResource(
- "gate.creole.tokeniser.DefaultTokeniser", params);
- //runtime stuff
- tokeniser.setDocument(doc);
- tokeniser.setAnnotationSetName("testAS");
- tokeniser.execute();
-
-
- //create a splitter
- params = Factory.newFeatureMap();
- SentenceSplitter splitter = (SentenceSplitter) Factory.createResource(
- "gate.creole.splitter.SentenceSplitter", params);
-
- //runtime stuff
- splitter.setDocument(doc);
- splitter.setOutputASName("testAS");
- splitter.setInputASName("testAS");
- splitter.execute();
- assertTrue(!doc.getAnnotations("testAS").
- get(ANNIEConstants.SENTENCE_ANNOTATION_TYPE).isEmpty());
-
- //now check the tagger
- //create a tagger
- params = Factory.newFeatureMap();
- POSTagger tagger = (POSTagger) Factory.createResource(
- "gate.creole.POSTagger", params);
-
- //runtime stuff
- tagger.setDocument(doc);
- tagger.setInputASName("testAS");
- tagger.execute();
- Iterator<Annotation> tokIter =doc.getAnnotations("testAS").
- get(ANNIEConstants.TOKEN_ANNOTATION_TYPE).iterator();
- while(tokIter.hasNext()){
- Annotation token = tokIter.next();
- String kind = (String)token.getFeatures().
- get(ANNIEConstants.TOKEN_KIND_FEATURE_NAME);
- if(kind.equals(ANNIEConstants.TOKEN_KIND_FEATURE_NAME))
- assertNotNull(token.getFeatures().
- get(ANNIEConstants.TOKEN_CATEGORY_FEATURE_NAME));
- }
- }
-}
\ No newline at end of file
Deleted: gate/trunk/src/test/gate/jape/functest/TestJape2.java
===================================================================
--- gate/trunk/src/test/gate/jape/functest/TestJape2.java 2014-05-07
09:45:23 UTC (rev 17924)
+++ gate/trunk/src/test/gate/jape/functest/TestJape2.java 2014-05-07
19:35:16 UTC (rev 17925)
@@ -1,352 +0,0 @@
-/*
- * TestJape2.java (Java Annotation Patterns Engine)
- *
- * Copyright (c) 1995-2012, The University of Sheffield. See the file
- * COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
- *
- * This file is part of GATE (see http://gate.ac.uk/), and is free
- * software, licenced under the GNU Library General Public License,
- * Version 2, June 1991 (in the distribution as file licence.html,
- * and also available at http://gate.ac.uk/gate/licence.html).
- *
- * Hamish Cunningham, 23/02/2000
- *
- * $Id$
- *
- * Description: Test class for JAPE.
- */
-
-package gate.jape.functest;
-
-import gate.Corpus;
-import gate.Factory;
-import gate.creole.ResourceInstantiationException;
-import gate.util.Err;
-import gate.util.Out;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Second test harness for JAPE.
- * Uses the Sheffield Tokeniser and Gazetteer, and must be run
- * from the gate directory.
- * @author Hamish Cunningham
- */
-public class TestJape2 {
-
- /** How much noise to make. */
- static private boolean verbose = false;
-
-
- /** Take a list of text files and a collection name, and
- * call tokeniser/gazetteer/jape on them, creating the
- * collection.
- */
- static public void main(String[] args) {
-
- // turn debug output on/off
- //Debug.setDebug(true);
- //Debug.setDebug(AnnotationSet.class, true);
- //Debug.setDebug(BasicPatternElement.class, true);
- //Debug.setDebug(ComplexPatternElement.class, true);
- //Debug.setDebug(ConstraintGroup.class, true);
- //Debug.setDebug(SinglePhaseTransducer.class, true);
-
- // variables to parse the command line options into
- String collName = null;
- String japeName = null;
- List<String> fileNames = null;
-
- // process options
- for(int i=0; i<args.length; i++) {
- if(args[i].equals("-c") && ++i < args.length) // -c = coll name
- collName = args[i];
- else if(args[i].equals("-j") && ++i < args.length) // -j: .jape name
- japeName = args[i];
- else if(args[i].equals("-v")) // -v = verbose
- verbose = true;
- else { // a list of files
- fileNames = new ArrayList<String>();
- do {
- fileNames.add(args[i++]);
- } while(i < args.length);
- }
- } // for each arg
-
- // did they give valid options?
- message("checking options");
- if(collName == null || japeName == null || fileNames == null)
- usage("you must supply collection, transducer and file names");
-
- // create a collection and run the tokeniser
- message("creating coll, tokenising and gazetteering");
- @SuppressWarnings("unused")
- Corpus coll = null;
- try {
- coll = tokAndGaz(collName, fileNames);
- } catch(ResourceInstantiationException e) {
- usage("couldn't open collection: " + e);
- }
-/*
- // run the parser test
- message("parsing the .jape file (or deserialising the .ser file)");
- Batch batch = null;
- try { batch = new Batch(japeName);
- } catch(JapeException e) {
- usage("can't create transducer " + e.getMessage());
- }
-*/
- /*Transducer transducer = parseJape(japeName);
- //Out.println(transducer);
- if(transducer == null)
- System.exit(1);*/
-
- // test the transducers from the parser
-/*
- message("running the transducer");
- try { batch.transduce(coll); } catch(JapeException e) {
- usage("couldn't run transducer " + e.getMessage());
- }
- //runTransducer(transducer, coll);
- //Out.println(transducer);
-
- message("done\n\r");
- //System.exit(0);
-*/
- } // main
-
-
- /**
- * Create a collection and put tokenised and gazetteered docs in it.
- */
- static public Corpus tokAndGaz(String collName, List<String> fileNames)
- throws ResourceInstantiationException {
-
- // create or overwrite the collection
- Corpus collection = null;
- File collDir = new File(collName);
- collection = Factory.newCorpus(
- collDir.getAbsolutePath()
- );
-
- // add all the documents
- for(Iterator<String> i = fileNames.iterator(); i.hasNext(); ) {
- String fname = i.next();
-
- File f = new File(fname);
- //Document doc = null;
-
- try {
- //AnnotationSet annots = new AnnotationSetImpl(doc);
- collection.add(
- Factory.newDocument(f.getAbsolutePath())
- );
- } catch(ResourceInstantiationException e) {
- e.printStackTrace();
- }
-
- /*
- // Tokenise the document
- Tokeniser tokeniser = new Tokeniser(doc, Tokeniser.HMM);
- try { tokeniser.hmmTokenSequence(); }
- catch(sheffield.creole.tokeniser.ParseException ex) {
- ex.printStackTrace();
- return null;
- } catch (CreoleException ex) {
- ex.printStackTrace();
- return null;
- }
-
- // Gazetteer the document
- gate.creole.Annotator gazetteer = new GazetteerAnnotator();
- gazetteer.annotate(doc, null);
- */
- } // for each doc name
-
- // return the annotated collection
- return collection;
-
- } //tokAndGaz
-
-
- /**
- * Must be run from the gate directory.
- * Parse the .jape file.
- */
- /*
- static public Transducer parseJape(String japeName) {
- Transducer transducer = null;
-
- if(japeName.endsWith(".ser")) { // it's compiled already
- message("deserialising " + japeName);
- File f = new File(japeName);
- if(! f.exists())
- Out.println(japeName + " not found");
-
- try {
- FileInputStream fis = new FileInputStream(f.getPath());
- ObjectInputStream ois = new ObjectInputStream(fis);
- transducer = (Transducer) ois.readObject();
- ois.close();
- } catch (Exception ex) {
- Err.println(
- "Can't read from " + f.getName() + ": " + ex.toString()
- );
- }
- } else { // parse it
- message("parsing " + japeName);
- try {
- ParseCpsl cpslParser = new ParseCpsl(japeName);
- transducer = cpslParser.MultiPhaseTransducer();
- } catch(IOException e) {
- e.printStackTrace();
- } catch(gate.jape.parser.ParseException ee) {
- Err.println("Error parsing transducer: " + ee.getMessage());
- }
- }
-
- return transducer;
- } // parseJape
-
-
- static public void runTransducer(
- Transducer transducer, Corpus coll
- ) {
-
- try {
- Document doc = coll.firstDocument();
- do {
- message("doing document " + doc.getId());
- transducer.transduce(doc);
- // Out.println(transducer.toString());
- } while( (doc = coll.nextDocument()) != null );
- } catch(JdmException e) {
- e.printStackTrace();
- } catch(JapeException e) {
- e.printStackTrace();
- }
- } // runTransducer
- */
-
- /** You got something wrong, dumbo. */
- public static void usage(String errorMessage) {
- String usageMessage =
- "usage: java gate.jape.TestJape2.main [-v] " +
- "-j JapePatternFile -c CollectionName FileName(s)";
-
- Err.println(errorMessage);
- Err.println(usageMessage);
- //System.exit(1);
-
- } // usage
-
-
- /** Hello? Anybody there?? */
- public static void message(String mess) {
- if(verbose) Out.println("TestJape2: " + mess);
- } // message
-
-} // class TestJape2
-
-
-// $Log$
-// Revision 1.13 2005/01/11 13:51:36 ian
-// Updating copyrights to 1998-2005 in preparation for v3.0
-//
-// Revision 1.12 2004/07/21 17:10:08 akshay
-// Changed copyright from 1998-2001 to 1998-2004
-//
-// Revision 1.11 2004/03/25 13:01:14 valyt
-// Imports optimisation throughout the Java sources
-// (to get rid of annoying warnings in Eclipse)
-//
-// Revision 1.10 2001/09/13 12:09:50 kalina
-// Removed completely the use of jgl.objectspace.Array and such.
-// Instead all sources now use the new Collections, typically ArrayList.
-// I ran the tests and I ran some documents and compared with keys.
-// JAPE seems to work well (that's where it all was). If there are problems
-// maybe look at those new structures first.
-//
-// Revision 1.9 2001/02/08 13:46:06 valyt
-// Added full Unicode support for the gazetteer and Jape
-// converted the gazetteer files to UTF-8
-//
-// Revision 1.8 2001/01/30 14:18:02 hamish
-// fixed some hard-coded paths
-//
-// Revision 1.7 2000/11/08 16:35:04 hamish
-// formatting
-//
-// Revision 1.6 2000/10/26 10:45:31 oana
-// Modified in the code style
-//
-// Revision 1.5 2000/10/23 21:50:42 hamish
-// cleaned up exception handling in gate.creole and added
-// ResourceInstantiationException;
-//
-// changed Factory.newDocument(URL u) to use the new instantiation
-// facilities;
-//
-// added COMMENT to resource metadata / ResourceData;
-//
-// changed Document and DocumentImpl to follow beans style, and moved
-// constructor logic to init(); changed all the Factory newDocument methods to
-// use the new resource creation stuff;
-//
-// added builtin document and corpus metadata to creole/creole.xml (copied from
-// gate.ac.uk/tests/creole.xml);
-//
-// changed Corpus to the new style too;
-//
-// removed CreoleRegister.init()
-//
-// Revision 1.4 2000/10/18 13:26:48 hamish
-// Factory.createResource now working, with a utility method that uses
reflection (via java.beans.Introspector) to set properties on a resource from
the
-// parameter list fed to createResource.
-// resources may now have both an interface and a class; they are indexed
by interface type; the class is used to instantiate them
-// moved createResource from CR to Factory
-// removed Transients; use Factory instead
-//
-// Revision 1.3 2000/10/16 16:44:34 oana
-// Changed the comment of DEBUG variable
-//
-// Revision 1.2 2000/10/10 15:36:37 oana
-// Changed System.out in Out and System.err in Err;
-// Added the DEBUG variable seted on false;
-// Added in the header the licence;
-//
-// Revision 1.1 2000/02/23 13:46:12 hamish
-// added
-//
-// Revision 1.1.1.1 1999/02/03 16:23:03 hamish
-// added gate2
-//
-// Revision 1.9 1998/10/29 12:13:55 hamish
-// reorganised to use Batch
-//
-// Revision 1.8 1998/10/01 16:06:41 hamish
-// new appelt transduction style, replacing buggy version
-//
-// Revision 1.7 1998/09/26 09:19:21 hamish
-// added cloning of PE macros
-//
-// Revision 1.6 1998/09/23 12:48:03 hamish
-// negation added; noncontiguous BPEs disallowed
-//
-// Revision 1.5 1998/09/17 12:53:09 hamish
-// fixed for new tok; new construction pattern
-//
-// Revision 1.4 1998/09/17 10:24:05 hamish
-// added options support, and Appelt-style rule application
-//
-// Revision 1.3 1998/08/19 20:21:46 hamish
-// new RHS assignment expression stuff added
-//
-// Revision 1.2 1998/08/18 14:37:45 hamish
-// added some messages
-//
-// Revision 1.1 1998/08/18 12:43:11 hamish
-// fixed SPT bug, not advancing newPosition
Deleted: gate/trunk/src/test/gate/jape/functest/TestTransducer.java
===================================================================
--- gate/trunk/src/test/gate/jape/functest/TestTransducer.java 2014-05-07
09:45:23 UTC (rev 17924)
+++ gate/trunk/src/test/gate/jape/functest/TestTransducer.java 2014-05-07
19:35:16 UTC (rev 17925)
@@ -1,44 +0,0 @@
-package gate.jape.functest;
-
-import java.util.Calendar;
-import org.apache.log4j.Logger;
-import junit.extensions.TestSetup;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-/**
- * Executes all tests on given JAPE Transducer.
- * <p/>
- * See {@link BaseJapeTests#transducerType}
- *
- */
-public class TestTransducer extends TestCase {
- private static final Logger logger =
Logger.getLogger(TestTransducer.class);
- private static Calendar executionTime;
-
- public static Test suite() {
- TestSuite tests = new TestSuite("All JAPE tests");
- tests.addTest(TestJape.suite());
- tests.addTest(TestConstraints.suite());
-
- Test suite = new TestSetup(tests) {
- @Override
- protected void setUp() {
- executionTime = Calendar.getInstance();
- }
-
- @Override
- protected void tearDown() {
- long executedIn = Calendar.getInstance().getTimeInMillis() -
executionTime.getTimeInMillis();
- logger.info("Test suite executed in: " + executedIn/1000 + "
second(s).");
- }
- };
-
- return suite;
- }
-
- public static void main(String... args) {
- junit.textui.TestRunner.run(TestTransducer.suite());
- }
-}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
• 3 signs your SCM is hindering your productivity
• Requirements for releasing software faster
• Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs