Revision: 19219
http://sourceforge.net/p/gate/code/19219
Author: markagreenwood
Date: 2016-04-09 17:16:18 +0000 (Sat, 09 Apr 2016)
Log Message:
-----------
moved the Tools tests into Tools
Modified Paths:
--------------
gate/branches/sawdust2/plugins/Tools/.classpath
gate/branches/sawdust2/plugins/Tools/src/test/java/gate/creole/gazetteer/TestFlexibleGazetteer.java
gate/branches/sawdust2/plugins/Tools/src/test/java/gate/creole/morph/TestMorph.java
gate/branches/sawdust2/src/main/gate/Plugin.java
gate/branches/sawdust2/src/test/gate/TestGate.java
Added Paths:
-----------
gate/branches/sawdust2/plugins/Tools/src/main/resources/resources/
gate/branches/sawdust2/plugins/Tools/src/test/java/gate/
gate/branches/sawdust2/plugins/Tools/src/test/java/gate/creole/
gate/branches/sawdust2/plugins/Tools/src/test/java/gate/creole/gazetteer/
gate/branches/sawdust2/plugins/Tools/src/test/java/gate/creole/morph/
gate/branches/sawdust2/plugins/Tools/src/test/resources/tests/
gate/branches/sawdust2/plugins/Tools/src/test/resources/tests/morph/
Removed Paths:
-------------
gate/branches/sawdust2/plugins/Tools/resources/
gate/branches/sawdust2/plugins/Tools/src/test/java/gate/creole/gazetteer/TestGazetteer.java
gate/branches/sawdust2/src/test/gate/creole/gazetteer/
gate/branches/sawdust2/src/test/gate/creole/morph/
gate/branches/sawdust2/src/test/gate/resources/gate.ac.uk/tests/morph/
Modified: gate/branches/sawdust2/plugins/Tools/.classpath
===================================================================
--- gate/branches/sawdust2/plugins/Tools/.classpath 2016-04-09 17:15:09 UTC
(rev 19218)
+++ gate/branches/sawdust2/plugins/Tools/.classpath 2016-04-09 17:16:18 UTC
(rev 19219)
@@ -6,8 +6,6 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
- <classpathentry combineaccessrules="false" exported="true" kind="src"
path="/GATE"/>
- <classpathentry combineaccessrules="false" kind="src"
path="/GATE-plugin-ANNIE"/>
<classpathentry excluding="**" kind="src" output="target/classes"
path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
Modified:
gate/branches/sawdust2/plugins/Tools/src/test/java/gate/creole/gazetteer/TestFlexibleGazetteer.java
===================================================================
---
gate/branches/sawdust2/src/test/gate/creole/gazetteer/TestFlexibleGazetteer.java
2016-04-08 18:22:42 UTC (rev 19211)
+++
gate/branches/sawdust2/plugins/Tools/src/test/java/gate/creole/gazetteer/TestFlexibleGazetteer.java
2016-04-09 17:16:18 UTC (rev 19219)
@@ -20,43 +20,15 @@
import gate.Document;
import gate.Factory;
import gate.FeatureMap;
-import gate.Gate;
-import gate.GateConstants;
-import gate.corpora.TestDocument;
-import gate.util.GateRuntimeException;
+import gate.test.GATEPluginTestCase;
-import java.io.File;
-import java.net.URL;
import java.util.ArrayList;
import java.util.List;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+public class TestFlexibleGazetteer extends GATEPluginTestCase {
-public class TestFlexibleGazetteer extends TestCase {
-
private static final boolean DEBUG=false;
- public TestFlexibleGazetteer(String name) {
- super(name);
- }
-
- /** Fixture set up - does nothing */
- @Override
- public void setUp() throws Exception {
- //make sure the right plugin is loaded
- File pluginsHome = new File(System.getProperty(
- GateConstants.GATE_HOME_PROPERTY_NAME),
- "plugins");
- try{
- Gate.getCreoleRegister().registerDirectories(
- new File(pluginsHome, "Tools").toURI().toURL());
- }catch(Exception e){
- throw new GateRuntimeException(e);
- }
- }
-
/** Fixture tear down - does nothing */
@Override
public void tearDown() throws Exception {
@@ -66,9 +38,7 @@
public void testFlexibleGazetteer() throws Exception {
//get a document - take it from the gate server.
// tests/doc0.html is a simple html document.
- Document doc = Factory.newDocument(
- new URL(TestDocument.getTestServerName() + "tests/doc0.html")
- );
+ Document doc =
Factory.newDocument(this.getClass().getResource("/tests/doc0.html"));
// Get a tokeniser - just use all the default settings.
gate.creole.tokeniser.DefaultTokeniser tokeniser=
@@ -143,23 +113,5 @@
Factory.deleteResource(flexGaz);
}
- /** Test suite routine for the test runner */
- public static Test suite() {
- return new TestSuite(TestFlexibleGazetteer.class);
- } // suite
- // The main class allows this class to be tested on its own, without the
- // need to call it from another class.
- public static void main(String[] args) {
- try{
- Gate.init();
- TestFlexibleGazetteer testGaz = new TestFlexibleGazetteer("");
- testGaz.setUp();
- testGaz.testFlexibleGazetteer();
- testGaz.tearDown();
- } catch(Exception e) {
- e.printStackTrace();
- }
- } // main
-
} // TestFlexibleGazetteer
Deleted:
gate/branches/sawdust2/plugins/Tools/src/test/java/gate/creole/gazetteer/TestGazetteer.java
===================================================================
--- gate/branches/sawdust2/src/test/gate/creole/gazetteer/TestGazetteer.java
2016-04-08 18:22:42 UTC (rev 19211)
+++
gate/branches/sawdust2/plugins/Tools/src/test/java/gate/creole/gazetteer/TestGazetteer.java
2016-04-09 17:16:18 UTC (rev 19219)
@@ -1,156 +0,0 @@
-/*
- * TestGazetteer.java
- *
- * 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, 25/10/2000
- *
- * $Id$
- */
-
-package gate.creole.gazetteer;
-
-import gate.AnnotationSet;
-import gate.Document;
-import gate.Factory;
-import gate.FeatureMap;
-import gate.Gate;
-import gate.corpora.TestDocument;
-
-import java.io.File;
-import java.net.URL;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-public class TestGazetteer extends TestCase {
-
- public TestGazetteer(String name) {
- super(name);
- }
-
- /** Fixture set up */
- @Override
- public void setUp() throws Exception {
- }
-
- @Override
- public void tearDown() throws Exception {
- } // tearDown
-
- /** Test the default tokeniser */
- public void testDefaultGazetteer() throws Exception {
- //get a document
- Document doc = Factory.newDocument(
- new URL(TestDocument.getTestServerName() + "tests/doc0.html")
- );
-
- //create a default gazetteer
- DefaultGazetteer gaz = (DefaultGazetteer) Factory.createResource(
- "gate.creole.gazetteer.DefaultGazetteer");
-
- //runtime stuff
- gaz.setDocument(doc);
- gaz.setAnnotationSetName("GazetteerAS");
- //test with default parameters
- gaz.execute();
- AnnotationSet resultAS = doc.getAnnotations("GazetteerAS");
- assertEquals("Wrong number of annotations produced",63, resultAS.size());
- resultAS.clear();
-
- //test with partial words
- gaz.setWholeWordsOnly(false);
- gaz.execute();
- assertEquals("Wrong number of annotations produced", 400, resultAS.size());
- gaz.setWholeWordsOnly(true);
- resultAS.clear();
-
- //test with prefix matching
- gaz.setLongestMatchOnly(false);
- gaz.execute();
- assertEquals("Wrong number of annotations produced", 78, resultAS.size());
- gaz.setLongestMatchOnly(true);
- resultAS.clear();
- Factory.deleteResource(gaz);
-
- //test with case insensitive
- FeatureMap fm = Factory.newFeatureMap();
- fm.put(DefaultGazetteer.DEF_GAZ_CASE_SENSITIVE_PARAMETER_NAME, false);
- gaz = (DefaultGazetteer) Factory.createResource(
- "gate.creole.gazetteer.DefaultGazetteer", fm);
- gaz.setDocument(doc);
- gaz.setAnnotationSetName("GazetteerAS");
- gaz.execute();
- assertEquals("Wrong number of annotations generated", 104,
resultAS.size());
- gaz.setCaseSensitive(true);
- resultAS.clear();
- Factory.deleteResource(gaz);
- Factory.deleteResource(doc);
- }
-
- /**
- * Tests additions and deletions from the gazetteer in both case
- * sensitive and case insensitive modes
- */
- public void testDynamicMethods() throws Exception {
-
-
- for (int i = 0 ; i < 2 ; ++i) {
-
- FeatureMap params = Factory.newFeatureMap();
- params.put(DefaultGazetteer.DEF_GAZ_CASE_SENSITIVE_PARAMETER_NAME, i !=
0);
-
- DefaultGazetteer gaz = (DefaultGazetteer) Factory.createResource(
- "gate.creole.gazetteer.DefaultGazetteer",params);
-
- Document doc = Factory.newDocument("RandomWord gazetteer tester");
- gaz.setDocument(doc);
-
- gaz.execute();
- assertEquals("Wrong number of lookup annotations in dynamic test 1/3",
0, doc.getAnnotations().get("Lookup").size());
- doc.getAnnotations().clear();
-
- Lookup lookup = new Lookup("random.lst","random","word","en");
- gaz.add("RandomWord", lookup);
-
- gaz.execute();
- assertEquals("Wrong number of lookup annotations in dynamic test 2/3",
1, doc.getAnnotations().get("Lookup").size());
- doc.getAnnotations().clear();
-
- gaz.removeLookup("RandomWord", lookup);
- gaz.execute();
- assertEquals("Wrong number of lookup annotations in dynamic test 3/3",
0, doc.getAnnotations().get("Lookup").size());
-
- Factory.deleteResource(gaz);
-
- }
-
- }
-
- /** Test suite routine for the test runner */
- public static Test suite() {
- return new TestSuite(TestGazetteer.class);
- } // suite
-
- public static void main(String[] args) {
- try{
- Gate.init();
- Gate.getCreoleRegister().registerDirectories((new
File(Gate.getPluginsHome(),"ANNIE")).toURI().toURL());
- TestGazetteer testGaz = new TestGazetteer("");
- testGaz.setUp();
- testGaz.testDefaultGazetteer();
- testGaz.testDynamicMethods();
- testGaz.tearDown();
- } catch(Exception e) {
- e.printStackTrace();
- }
- } // main
-
-} // TestGazetteer
Modified:
gate/branches/sawdust2/plugins/Tools/src/test/java/gate/creole/morph/TestMorph.java
===================================================================
--- gate/branches/sawdust2/src/test/gate/creole/morph/TestMorph.java
2016-04-08 18:22:42 UTC (rev 19211)
+++
gate/branches/sawdust2/plugins/Tools/src/test/java/gate/creole/morph/TestMorph.java
2016-04-09 17:16:18 UTC (rev 19219)
@@ -2,10 +2,12 @@
import java.io.File;
import java.util.*;
+
import junit.framework.*;
import gate.*;
import gate.creole.*;
import gate.creole.tokeniser.DefaultTokeniser;
+import gate.test.GATEPluginTestCase;
import gate.util.Files;
import gate.util.OffsetComparator;
@@ -27,7 +29,7 @@
* @version 1.0
*/
-public class TestMorph extends TestCase {
+public class TestMorph extends GATEPluginTestCase {
private Morph morpher;
@@ -38,32 +40,21 @@
private DefaultTokeniser tokeniser;
- public TestMorph(String dummy) {
- super(dummy);
- }
-
/**
* This method sets up the parameters for the files to be testes It
* initialises the Tokenizer and sets up the other parameters for the
morph
* program
*/
@Override
- protected void setUp() {
+ public void setUp() throws Exception {
+ super.setUp();
try {
- // make sure the right plugin is loaded
- File pluginsHome = new File(System
-
.getProperty(GateConstants.GATE_HOME_PROPERTY_NAME),
- "plugins");
- Gate.getCreoleRegister().registerDirectories(new
File(pluginsHome, "Tools").toURI().toURL());
+
// creating documents
- verbDocumentToTest = Factory.newDocument(Files
-
.getGateResource("/gate.ac.uk/tests/morph/verbTest.dat"));
- verbDocumentWithAnswers = Factory.newDocument(Files
-
.getGateResource("/gate.ac.uk/tests/morph/verbAnswer.dat"));
- nounDocumentToTest = Factory.newDocument(Files
-
.getGateResource("/gate.ac.uk/tests/morph/nounTest.dat"));
- nounDocumentWithAnswers = Factory.newDocument(Files
-
.getGateResource("/gate.ac.uk/tests/morph/nounAnswer.dat"));
+ verbDocumentToTest =
Factory.newDocument(this.getClass().getResource("/tests/morph/verbTest.dat"));
+ verbDocumentWithAnswers =
Factory.newDocument(this.getClass().getResource("/tests/morph/verbAnswer.dat"));
+ nounDocumentToTest =
Factory.newDocument(this.getClass().getResource("/tests/morph/nounTest.dat"));
+ nounDocumentWithAnswers =
Factory.newDocument(this.getClass().getResource("/tests/morph/nounAnswer.dat"));
morpher = (Morph)
Factory.createResource("gate.creole.morph.Morph");
morpher.setAffixFeatureName("affix");
morpher.setRootFeatureName("root");
Modified: gate/branches/sawdust2/src/main/gate/Plugin.java
===================================================================
--- gate/branches/sawdust2/src/main/gate/Plugin.java 2016-04-09 17:15:09 UTC
(rev 19218)
+++ gate/branches/sawdust2/src/main/gate/Plugin.java 2016-04-09 17:16:18 UTC
(rev 19219)
@@ -524,7 +524,7 @@
* visited class (if such exists) to fill in the name and comment in the
* corresponding ResourceInfo.
*/
- private static class ResourceInfoVisitor extends EmptyVisitor {
+ protected static class ResourceInfoVisitor extends EmptyVisitor {
private ResourceInfo resInfo;
private boolean foundCreoleResource = false;
Modified: gate/branches/sawdust2/src/test/gate/TestGate.java
===================================================================
--- gate/branches/sawdust2/src/test/gate/TestGate.java 2016-04-09 17:15:09 UTC
(rev 19218)
+++ gate/branches/sawdust2/src/test/gate/TestGate.java 2016-04-09 17:16:18 UTC
(rev 19219)
@@ -30,13 +30,10 @@
import gate.creole.TestXSchema;
import gate.creole.annic.test.TestAnnic;
import gate.creole.gazetteer.TestFlexibleGazetteer;
-import gate.creole.gazetteer.TestGazetteer;
import gate.creole.morph.TestMorph;
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;
import gate.util.Err;
@@ -62,8 +59,6 @@
import junit.framework.Test;
import junit.framework.TestSuite;
-import com.ontotext.gate.gazetteer.TestHashGazetteer;
-
/** Top-level entry point for GATE test suite;
* "main" will run the JUnit test runner interface.
* <P>
@@ -169,10 +164,13 @@
suite.addTest(TestCreole.suite());
suite.addTest(TestFiles.suite());
suite.addTest(TestJavac.suite());
- suite.addTest(TestJape.suite());
+ //Moved into the ANNIE plugin
+ //suite.addTest(TestJape.suite());
+
+ //Moved into the ANNIE plugin
//TODO fix these tests so that they work properly
- suite.addTest(TestConstraints.suite());
+ //suite.addTest(TestConstraints.suite());
suite.addTest(TestTemplate.suite());
suite.addTest(TestDocument.suite());
@@ -184,17 +182,25 @@
suite.addTest(TestDiffer.suite());
suite.addTest(TestAnnotationMerging.suite());
suite.addTest(TestClassificationMeasures.suite());
- suite.addTest(TestGazetteer.suite());
+
+ //Moved into the ANNIE plugin
+ //suite.addTest(TestGazetteer.suite());
suite.addTest(TestFeatureMap.suite());
suite.addTest(TestTools.suite());
suite.addTest(TestCreoleAnnotationHandler.suite());
suite.addTest(TestPR.suite());
- suite.addTest(TestMorph.suite());
+
+ //Moved nito the Tools plugin
+ //suite.addTest(TestMorph.suite());
//test ontotext gazetteer
- suite.addTest(TestHashGazetteer.suite());
+ //Moved into the ANNIE plugin
+ //suite.addTest(TestHashGazetteer.suite());
+
suite.addTest(TestRepositioningInfo.suite());
- suite.addTest(TestFlexibleGazetteer.suite());
+
+ //Moved nito the Tools plugin
+ //suite.addTest(TestFlexibleGazetteer.suite());
// Dynamic creole registration
suite.addTest(DynamicRegistrationTest.suite());
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial! http://pubads.g.doubleclick.net/
gampad/clk?id=1444514301&iu=/ca-pub-7940484522588532
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs