Revision: 19636 http://sourceforge.net/p/gate/code/19636 Author: markagreenwood Date: 2016-10-05 13:52:15 +0000 (Wed, 05 Oct 2016) Log Message: ----------- removing old code and cleaning up leaves us with just the annic tests to think about
Modified Paths: -------------- gate/branches/sawdust2/gate-core/src/test/java/gate/config/TestConfig.java Removed Paths: ------------- gate/branches/sawdust2/gate-core/src/test/disabled/gate/creole/TestControllers.java gate/branches/sawdust2/gate-core/src/test/disabled/gate/util/ gate/branches/sawdust2/gate-core/src/test/disabled/gate/xml/ Deleted: gate/branches/sawdust2/gate-core/src/test/disabled/gate/creole/TestControllers.java =================================================================== --- gate/branches/sawdust2/gate-core/src/test/disabled/gate/creole/TestControllers.java 2016-10-05 09:52:33 UTC (rev 19635) +++ gate/branches/sawdust2/gate-core/src/test/disabled/gate/creole/TestControllers.java 2016-10-05 13:52:15 UTC (rev 19636) @@ -1,159 +0,0 @@ -/* - * TestControllers.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). - * - * Hamish Cunningham, 16/Mar/00 - * - * $Id$ - */ - -package gate.creole; - -import java.net.URL; - -import gate.Annotation; -import gate.AnnotationSet; -import gate.Controller; -import gate.CreoleRegister; -import gate.Document; -import gate.Factory; -import gate.FeatureMap; -import gate.Gate; -import gate.ProcessingResource; -import gate.corpora.TestDocument; -import gate.util.GateException; -import gate.util.Out; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -/** Tests for controller classes - */ -public class TestControllers extends TestCase -{ - /** Debug flag */ - private static final boolean DEBUG = false; - - /** The CREOLE register */ - CreoleRegister reg; - - /** Construction */ - public TestControllers(String name) { super(name); } - - /** Fixture set up */ - @Override - public void setUp() throws GateException { - // Initialise the GATE library and get the creole register - Gate.init(); - reg = Gate.getCreoleRegister(); - - } // setUp - - /** Put things back as they should be after running tests - * (reinitialise the CREOLE register). - */ - @Override - public void tearDown() throws Exception { - reg.clear(); - Gate.init(); - } // tearDown - - /** Serial controller test 1 */ - public void testSerial1() throws Exception { - // a controller - SerialController c1 = new SerialController(); - assertNotNull("c1 controller is null", c1); - - // set a name for this controller - c1.setName("SerialController_"+Gate.genSym()); - - //get a document - FeatureMap params = Factory.newFeatureMap(); - params.put(Document.DOCUMENT_URL_PARAMETER_NAME, new URL(TestDocument.getTestServerName()+"tests/doc0.html")); - params.put(Document.DOCUMENT_MARKUP_AWARE_PARAMETER_NAME, "false"); - Document doc = (Document)Factory.createResource("gate.corpora.DocumentImpl", - params); - - if(DEBUG) { - ResourceData docRd = reg.get("gate.corpora.DocumentImpl"); - assertNotNull("Couldn't find document res data", docRd); - Out.prln(docRd.getParameterList().getInitimeParameters()); - } - - //create a default tokeniser - params = Factory.newFeatureMap(); - params.put("document", doc); - ProcessingResource tokeniser = (ProcessingResource) Factory.createResource( - "gate.creole.tokeniser.DefaultTokeniser", params - ); - - //create a default gazetteer - params = Factory.newFeatureMap(); - params.put("document", doc); - ProcessingResource gaz = (ProcessingResource) Factory.createResource( - "gate.creole.gazetteer.DefaultGazetteer", params - ); - - // get the controller to encapsulate the tok and gaz - c1.add(tokeniser); - c1.add(gaz); - c1.execute(); - - // check the resulting annotations - if(DEBUG) { - Out.prln(doc.getAnnotations()); - Out.prln(doc.getContent()); - } - AnnotationSet annots = doc.getAnnotations(); - assertTrue("no annotations from doc!", !annots.isEmpty()); - Annotation a = annots.get(new Integer(580)); - assertNotNull("couldn't get annot with id 580", a); -//sorry, this is no way to write a test! -// assert( // check offset - two values depending on whether saved with \r\n -// "wrong value: " + a.getStartNode().getOffset(), -// (a.getStartNode().getOffset().equals(new Long(1360)) || -// a.getStartNode().getOffset().equals(new Long(1367))) -// ); -// assert( // check offset - two values depending on whether saved with \r\n -// "wrong value: " + a.getEndNode().getOffset(), -// a.getEndNode().getOffset().equals(new Long(1361)) || -// a.getEndNode().getOffset().equals(new Long(1442)) -// ); - } // testSerial1() - - /** Serial controller test 2 */ - public void testSerial2() throws Exception { - // a controller - Controller c1 = new SerialController(); - assertNotNull("c1 controller is null", c1); -/* - // a couple of PRs - ResourceData pr1rd = (ResourceData) reg.get("testpkg.TestPR1"); - ResourceData pr2rd = (ResourceData) reg.get("testpkg.TestPR2"); - assert("couldn't find PR1/PR2 res data", pr1rd != null && pr2rd != null); - assert("wrong name on PR1", pr1rd.getName().equals("Sheffield Test PR 1")); - ProcessingResource pr1 = (ProcessingResource) - Factory.createResource("testpkg.TestPR1", Factory.newFeatureMap()); - ProcessingResource pr2 = (ProcessingResource) - Factory.createResource("testpkg.TestPR2", Factory.newFeatureMap()); - - // add the PRs to the controller and run it - c1.add(pr1); - c1.add(pr2); - c1.run(); -*/ - } // testSerial2() - - /** Test suite routine for the test runner */ - public static Test suite() { - return new TestSuite(TestControllers.class); - } // suite - -} // class TestControllers Modified: gate/branches/sawdust2/gate-core/src/test/java/gate/config/TestConfig.java =================================================================== --- gate/branches/sawdust2/gate-core/src/test/java/gate/config/TestConfig.java 2016-10-05 09:52:33 UTC (rev 19635) +++ gate/branches/sawdust2/gate-core/src/test/java/gate/config/TestConfig.java 2016-10-05 13:52:15 UTC (rev 19636) @@ -21,6 +21,8 @@ import java.io.InputStream; import java.net.URL; +import org.junit.Test; + import gate.CreoleRegister; import gate.Gate; import gate.GateConstants; @@ -135,6 +137,7 @@ */ /** Test config updating */ + @Test public void testConfigUpdating() throws Exception { //TODO try and fix this in some way @@ -202,11 +205,12 @@ } // testConfigUpdating /** Test session state file naming */ + @Test public void testSessionStateFileNaming() throws Exception { //TODO fix this //again we can't test these thinfs if there is no file to test - if (Gate.getUserSessionFile() == null) return; + if (Gate.getUserConfigFile() == null) return; String fileSep = Strings.getFileSep(); if(DEBUG) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ GATE-cvs mailing list GATE-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gate-cvs