Revision: 15934
          http://gate.svn.sourceforge.net/gate/?rev=15934&view=rev
Author:   ian_roberts
Date:     2012-07-13 12:37:22 +0000 (Fri, 13 Jul 2012)
Log Message:
-----------
Converted tests to JUnit 4 and added an @AfterClass to delete the temporary
directory they create.

Modified Paths:
--------------
    gate/trunk/plugins/Ontology/build.xml
    
gate/trunk/plugins/Ontology/src/gate/creole/ontology/impl/test/Test4Develop.java
    
gate/trunk/plugins/Ontology/src/gate/creole/ontology/impl/test/Test_OWLIMOntology.java
    
gate/trunk/plugins/Ontology/src/gate/creole/ontology/impl/test/Test_OntoTest1.java
    
gate/trunk/plugins/Ontology/src/gate/creole/ontology/impl/test/Test_OntoWine.java
    
gate/trunk/plugins/Ontology/src/gate/creole/ontology/impl/test/Test_TripleStore.java
    
gate/trunk/plugins/Ontology/src/gate/creole/ontology/impl/test/Test_TupleQuery.java
    
gate/trunk/plugins/Ontology/src/gate/creole/ontology/impl/test/Test_W3Tests.java

Modified: gate/trunk/plugins/Ontology/build.xml
===================================================================
--- gate/trunk/plugins/Ontology/build.xml       2012-07-13 11:34:08 UTC (rev 
15933)
+++ gate/trunk/plugins/Ontology/build.xml       2012-07-13 12:37:22 UTC (rev 
15934)
@@ -108,7 +108,7 @@
       </classpath>
                         <!-- run headless -->
       <sysproperty key="java.awt.headless" value="true" />
-      <formatter type="plain" />
+      <formatter type="xml" />
 
       <test name="gate.creole.ontology.impl.test.Test_OntoTest1" />
     </junit>
@@ -122,7 +122,7 @@
       </classpath>
                         <!-- run headless -->
       <sysproperty key="java.awt.headless" value="true" />
-      <formatter type="plain" />
+      <formatter type="xml" />
 
       <test name="gate.creole.ontology.impl.test.Test_TupleQuery" />
     </junit>
@@ -137,7 +137,7 @@
       </classpath>
                         <!-- run headless -->
       <sysproperty key="java.awt.headless" value="true" />
-      <formatter type="plain" />
+      <formatter type="xml" />
 
       <test name="gate.creole.ontology.impl.test.Test_TripleStore" />
     </junit>
@@ -153,7 +153,7 @@
       </classpath>
                         <!-- run headless -->
       <sysproperty key="java.awt.headless" value="true" />
-      <formatter type="plain" />
+      <formatter type="xml" />
 
       <test name="gate.creole.ontology.impl.test.Test_OntoWine" />
     </junit>
@@ -168,7 +168,7 @@
       </classpath>
                         <!-- run headless -->
       <sysproperty key="java.awt.headless" value="true" />
-      <formatter type="plain" />
+      <formatter type="xml" />
 
       <test name="gate.creole.ontology.impl.test.Test_OWLIMOntology" />
     </junit>
@@ -183,7 +183,7 @@
       </classpath>
                         <!-- run headless -->
       <sysproperty key="java.awt.headless" value="true" />
-      <formatter type="plain" />
+      <formatter type="xml" />
 
       <test name="gate.creole.ontology.impl.test.Test_W3Tests" />
     </junit>
@@ -198,7 +198,7 @@
                         <!-- run headless -->
       <sysproperty key="java.awt.headless" value="true" />
       <syspropertyset refid="log4j.properties" />
-      <formatter type="plain" />
+      <formatter type="xml" />
 
       <test name="gate.creole.ontology.impl.test.Test4Develop" />
     </junit>

Modified: 
gate/trunk/plugins/Ontology/src/gate/creole/ontology/impl/test/Test4Develop.java
===================================================================
--- 
gate/trunk/plugins/Ontology/src/gate/creole/ontology/impl/test/Test4Develop.java
    2012-07-13 11:34:08 UTC (rev 15933)
+++ 
gate/trunk/plugins/Ontology/src/gate/creole/ontology/impl/test/Test4Develop.java
    2012-07-13 12:37:22 UTC (rev 15934)
@@ -26,33 +26,25 @@
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
 
 /**
  * Simple test class that load an ontology available online and accesses
  * its content via the ontology API
  */
-public class Test4Develop extends TestCase {
-  public static void main(String[] args) {
-    junit.textui.TestRunner.run(Test4Develop.class);
-  }
-
-  // TODO: benchmark with long start = System.nanoTime();
-
-  public Test4Develop(String arg0) {
-    super(arg0);
-  }
-
+public class Test4Develop {
   File testingDir = null;
   File owlimConfig = null;
   File configDir = null;
   File tmpDir = null;
 
   // establish file paths etc.
-  protected void setUp() throws Exception {
-    super.setUp();
+  @Before
+  public void setUp() throws Exception {
     System.out.println("Starting up");
     Gate.init();
     File pluginHome = 
@@ -84,16 +76,10 @@
     System.out.println("Start up complete");
   }
 
-  protected void tearDown() throws Exception {
-    super.tearDown();
-    System.out.println("Tearing down");
-
-    System.out.println("Tear down complete");
-  }
-
   // easiest way to run this test:
   // 1) mkdir /tmp/repo
   // 2) repeat: "rm -rf /tmp/repo/* ; ant test4develop"
+  @Test
   public void testCreateSesameOntology() throws Exception {
     /*
     System.out.println("++++ RUNNING testCreateSesameOntology");
@@ -115,6 +101,7 @@
      * */
   }
 
+  @Test
   public void testOWLIMOntology() throws Exception {
     System.out.println("++++ RUNNING testOWLIMOntology");
     FeatureMap fm = Factory.newFeatureMap();
@@ -490,11 +477,6 @@
      return td;
   }
 
-
-  /** Test suite routine for the test runner */
-  public static Test suite() {
-    return new TestSuite(Test4Develop.class);
-  } // suite
 }
 
 

Modified: 
gate/trunk/plugins/Ontology/src/gate/creole/ontology/impl/test/Test_OWLIMOntology.java
===================================================================
--- 
gate/trunk/plugins/Ontology/src/gate/creole/ontology/impl/test/Test_OWLIMOntology.java
      2012-07-13 11:34:08 UTC (rev 15933)
+++ 
gate/trunk/plugins/Ontology/src/gate/creole/ontology/impl/test/Test_OWLIMOntology.java
      2012-07-13 12:37:22 UTC (rev 15934)
@@ -7,47 +7,47 @@
  */
 package gate.creole.ontology.impl.test;
 
-import gate.creole.ontology.*;
+import gate.Factory;
+import gate.FeatureMap;
+import gate.Gate;
+import gate.creole.ResourceInstantiationException;
+import gate.creole.ontology.AnnotationProperty;
+import gate.creole.ontology.DatatypeProperty;
+import gate.creole.ontology.OClass;
+import gate.creole.ontology.OConstants;
+import gate.creole.ontology.OConstants.Closure;
+import gate.creole.ontology.OInstance;
+import gate.creole.ontology.OURI;
+import gate.creole.ontology.ObjectProperty;
+import gate.creole.ontology.Ontology;
+import gate.creole.ontology.RDFProperty;
+import gate.creole.ontology.SymmetricProperty;
+import gate.creole.ontology.TransitiveProperty;
 import gate.util.GateException;
+
 import java.io.File;
 import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.HashSet;
 import java.util.Set;
 
-import gate.Factory;
-import gate.FeatureMap;
-import gate.Gate;
-import gate.creole.ResourceInstantiationException;
-import gate.creole.ontology.OConstants.Closure;
-import gate.creole.ontology.impl.AbstractOntologyImpl;
-import java.io.FileOutputStream;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.apache.commons.io.FileUtils;
 import org.apache.log4j.Logger;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
 
 /**
  * Run various tests ...
  */
-public class Test_OWLIMOntology extends TestCase {
-  public static void main(String[] args) throws GateException, 
MalformedURLException {
-    System.out.println("Running main");
-    junit.textui.TestRunner.run(Test_OWLIMOntology.class);
-  }
-
-  public Test_OWLIMOntology(String arg0) throws GateException, 
MalformedURLException {
-    super(arg0);
-  }
-
-  File ontologiesDir = null;
-  File configDir = null;
-  File tmpDir = null;
+public class Test_OWLIMOntology {
+  static File ontologiesDir = null;
+  static File configDir = null;
+  static File tmpDir = null;
   // TODO: it seems we cannot use a static as intended here: the
   // init code still gets run for each fixture?
   static boolean isInitialized = false;
@@ -55,9 +55,8 @@
   OConstants.Closure DIRECT_CLOSURE = Closure.DIRECT_CLOSURE;
   OConstants.Closure TRANSITIVE_CLOSURE = Closure.TRANSITIVE_CLOSURE;
 
-  // global preparation stuff - check if stuff already initialized, if
-  // yes, do nothing
-  protected void init() throws GateException, MalformedURLException {
+  @BeforeClass
+  public static void init() throws GateException, MalformedURLException {
     if(!isInitialized) {
     System.out.println("Inititalizing ...");
     Gate.init();
@@ -78,23 +77,18 @@
       isInitialized = true;
     }
   }
-
-
-  /**
-   * per-test set up stuff
-   * @throws Exception
-   */
-  protected void setUp() throws Exception {
-    super.setUp();
-    init();
+  
+  @AfterClass
+  public static void cleanup() throws Exception {
+    if(tmpDir != null) {
+      FileUtils.deleteDirectory(tmpDir);
+    }
   }
 
-  protected void tearDown() throws Exception {
-    super.tearDown();
-  }
 
   // testLoadImports: test the loading of an existing ontology, finding the 
ontology
   // URI, import mappings, imports etc.
+  @Test
   public void testLoadImports() throws MalformedURLException,
           ResourceInstantiationException {
     FeatureMap fm = Factory.newFeatureMap();
@@ -132,6 +126,7 @@
   // testAccessOldNew: test ontology methods that were already present in the 
old
   // implementation - output measurements and do some benchmarking so
   // we can compare.
+  @Test
   public void testAccessOldNew() throws MalformedURLException,
           ResourceInstantiationException {
     FeatureMap fm = Factory.newFeatureMap();
@@ -245,8 +240,8 @@
     ontology.cleanup();
   }
 
-
-   public void testCreateModify() throws MalformedURLException,
+  @Test
+  public void testCreateModify() throws MalformedURLException,
           ResourceInstantiationException,
           FileNotFoundException,
           IOException {
@@ -422,10 +417,4 @@
   protected OURI getURI4Name(Ontology o, String uri) {
     return o.createOURIForName(uri);
   }
-
-  /** Test suite routine for the test runner */
-  public static Test suite() {
-    System.out.println("Running suite");
-    return new TestSuite(Test_OWLIMOntology.class);
-  } // suite
 }

Modified: 
gate/trunk/plugins/Ontology/src/gate/creole/ontology/impl/test/Test_OntoTest1.java
===================================================================
--- 
gate/trunk/plugins/Ontology/src/gate/creole/ontology/impl/test/Test_OntoTest1.java
  2012-07-13 11:34:08 UTC (rev 15933)
+++ 
gate/trunk/plugins/Ontology/src/gate/creole/ontology/impl/test/Test_OntoTest1.java
  2012-07-13 12:37:22 UTC (rev 15934)
@@ -21,27 +21,21 @@
 import gate.creole.ontology.OConstants.Closure;
 import java.util.HashSet;
 import java.util.List;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+import org.apache.commons.io.FileUtils;
 import org.apache.log4j.Logger;
 
 /**
  * Run tests on the test1.ttl ontology
  */
-public class Test_OntoTest1 extends TestCase {
-  public static void main(String[] args) throws GateException, 
MalformedURLException {
-    System.out.println("Running main");
-    junit.textui.TestRunner.run(Test_OntoTest1.class);
-  }
-
-  public Test_OntoTest1(String arg0) throws GateException, 
MalformedURLException {
-    super(arg0);
-  }
-
-  File ontologiesDir = null;
-  File configDir = null;
-  File tmpDir = null;
+public class Test_OntoTest1 {
+  static File ontologiesDir = null;
+  static File configDir = null;
+  static File tmpDir = null;
   // TODO: it seems we cannot use a static as intended here: the
   // init code still gets run for each fixture?
   static boolean isInitialized = false;
@@ -51,7 +45,8 @@
 
   // global preparation stuff - check if stuff already initialized, if
   // yes, do nothing
-  protected void init() throws GateException, MalformedURLException {
+  @BeforeClass
+  public static void init() throws GateException, MalformedURLException {
     if(!isInitialized) {
     System.out.println("Inititalizing ...");
     Gate.init();
@@ -73,21 +68,15 @@
     }
   }
 
-
-  /**
-   * per-test set up stuff
-   * @throws Exception
-   */
-  protected void setUp() throws Exception {
-    super.setUp();
-    init();
+  @AfterClass
+  public static void cleanup() throws Exception {
+    if(tmpDir != null) {
+      FileUtils.deleteDirectory(tmpDir);
+    }
   }
+  
 
-  protected void tearDown() throws Exception {
-    super.tearDown();
-  }
-
-
+  @Test
   public void testOntologyTest1() throws ResourceInstantiationException, 
MalformedURLException {
     FeatureMap fm = Factory.newFeatureMap();
     File demoFile = new File(ontologiesDir,"test1.ttl");
@@ -324,9 +313,4 @@
     return o.createOURIForName(uri);
   }
 
-  /** Test suite routine for the test runner */
-  public static Test suite() {
-    System.out.println("Running suite");
-    return new TestSuite(Test_OntoTest1.class);
-  } // suite
 }

Modified: 
gate/trunk/plugins/Ontology/src/gate/creole/ontology/impl/test/Test_OntoWine.java
===================================================================
--- 
gate/trunk/plugins/Ontology/src/gate/creole/ontology/impl/test/Test_OntoWine.java
   2012-07-13 11:34:08 UTC (rev 15933)
+++ 
gate/trunk/plugins/Ontology/src/gate/creole/ontology/impl/test/Test_OntoWine.java
   2012-07-13 12:37:22 UTC (rev 15934)
@@ -7,47 +7,44 @@
  */
 package gate.creole.ontology.impl.test;
 
-import gate.creole.ontology.*;
-import gate.util.GateException;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Set;
-
 import gate.Factory;
 import gate.FeatureMap;
 import gate.Gate;
 import gate.creole.ResourceInstantiationException;
+import gate.creole.ontology.DatatypeProperty;
+import gate.creole.ontology.OClass;
+import gate.creole.ontology.OConstants;
 import gate.creole.ontology.OConstants.Closure;
+import gate.creole.ontology.OInstance;
+import gate.creole.ontology.OResource;
+import gate.creole.ontology.OURI;
+import gate.creole.ontology.ObjectProperty;
+import gate.creole.ontology.Ontology;
 import gate.creole.ontology.impl.AbstractOntologyImpl;
-import java.io.FileOutputStream;
-import java.util.ArrayList;
-import java.util.Collections;
+import gate.util.GateException;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.util.HashSet;
 import java.util.List;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import java.util.Set;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+import org.apache.commons.io.FileUtils;
 import org.apache.log4j.Logger;
 
 /**
  * Run tests on the wine ontology
  */
-public class Test_OntoWine extends TestCase {
-  public static void main(String[] args) throws GateException, 
MalformedURLException {
-    System.out.println("Running main");
-    junit.textui.TestRunner.run(Test_OntoWine.class);
-  }
-
-  public Test_OntoWine(String arg0) throws GateException, 
MalformedURLException {
-    super(arg0);
-  }
-
-  File ontologiesDir = null;
-  File configDir = null;
-  File tmpDir = null;
+public class Test_OntoWine {
+  static File ontologiesDir = null;
+  static File configDir = null;
+  static File tmpDir = null;
   // TODO: it seems we cannot use a static as intended here: the
   // init code still gets run for each fixture?
   static boolean isInitialized = false;
@@ -57,7 +54,8 @@
 
   // global preparation stuff - check if stuff already initialized, if
   // yes, do nothing
-  protected void init() throws GateException, MalformedURLException {
+  @BeforeClass
+  public static void init() throws GateException, MalformedURLException {
     if(!isInitialized) {
     System.out.println("Inititalizing ...");
     Gate.init();
@@ -79,20 +77,14 @@
     }
   }
 
-
-  /**
-   * per-test set up stuff
-   * @throws Exception
-   */
-  protected void setUp() throws Exception {
-    super.setUp();
-    init();
+  @AfterClass
+  public static void cleanup() throws Exception {
+    if(tmpDir != null) {
+      FileUtils.deleteDirectory(tmpDir);
+    }
   }
 
-  protected void tearDown() throws Exception {
-    super.tearDown();
-  }
-
+  @Test
   public void testWineOntology() throws MalformedURLException,
           ResourceInstantiationException {
     FeatureMap fm = Factory.newFeatureMap();
@@ -310,9 +302,4 @@
     return o.createOURIForName(uri);
   }
 
-  /** Test suite routine for the test runner */
-  public static Test suite() {
-    System.out.println("Running suite");
-    return new TestSuite(Test_OntoWine.class);
-  } // suite
 }

Modified: 
gate/trunk/plugins/Ontology/src/gate/creole/ontology/impl/test/Test_TripleStore.java
===================================================================
--- 
gate/trunk/plugins/Ontology/src/gate/creole/ontology/impl/test/Test_TripleStore.java
        2012-07-13 11:34:08 UTC (rev 15933)
+++ 
gate/trunk/plugins/Ontology/src/gate/creole/ontology/impl/test/Test_TripleStore.java
        2012-07-13 12:37:22 UTC (rev 15934)
@@ -19,27 +19,20 @@
 import gate.creole.ResourceInstantiationException;
 import gate.creole.ontology.OConstants.Closure;
 import gate.creole.ontology.impl.sesame.AbstractOntologyImplSesame;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
+import org.apache.commons.io.FileUtils;
 import org.apache.log4j.Logger;
 
 /**
  * Run tests on the test1.ttl ontology
  */
-public class Test_TripleStore extends TestCase {
-  public static void main(String[] args) throws GateException, 
MalformedURLException {
-    System.out.println("Running main");
-    junit.textui.TestRunner.run(Test_TripleStore.class);
-  }
-
-  public Test_TripleStore(String arg0) throws GateException, 
MalformedURLException {
-    super(arg0);
-  }
-
-  File ontologiesDir = null;
-  File configDir = null;
-  File tmpDir = null;
+public class Test_TripleStore {
+  static File ontologiesDir = null;
+  static File configDir = null;
+  static File tmpDir = null;
   // TODO: it seems we cannot use a static as intended here: the
   // init code still gets run for each fixture?
   static boolean isInitialized = false;
@@ -49,7 +42,8 @@
 
   // global preparation stuff - check if stuff already initialized, if
   // yes, do nothing
-  protected void init() throws GateException, MalformedURLException {
+  @BeforeClass
+  public static void init() throws GateException, MalformedURLException {
     if(!isInitialized) {
     System.out.println("Inititalizing ...");
     Gate.init();
@@ -70,22 +64,15 @@
       isInitialized = true;
     }
   }
-
-
-  /**
-   * per-test set up stuff
-   * @throws Exception
-   */
-  protected void setUp() throws Exception {
-    super.setUp();
-    init();
+  
+  @AfterClass
+  public static void cleanup() throws Exception {
+    if(tmpDir != null) {
+      FileUtils.deleteDirectory(tmpDir);
+    }
   }
 
-  protected void tearDown() throws Exception {
-    super.tearDown();
-  }
-
-
+  @Test
   public void testTripleStoreTest1() throws ResourceInstantiationException, 
MalformedURLException {
     FeatureMap fm = Factory.newFeatureMap();
     File demoFile = new File(ontologiesDir,"test1.ttl");
@@ -208,9 +195,4 @@
     return o.createOURIForName(uri);
   }
 
-  /** Test suite routine for the test runner */
-  public static Test suite() {
-    System.out.println("Running suite");
-    return new TestSuite(Test_TripleStore.class);
-  } // suite
 }

Modified: 
gate/trunk/plugins/Ontology/src/gate/creole/ontology/impl/test/Test_TupleQuery.java
===================================================================
--- 
gate/trunk/plugins/Ontology/src/gate/creole/ontology/impl/test/Test_TupleQuery.java
 2012-07-13 11:34:08 UTC (rev 15933)
+++ 
gate/trunk/plugins/Ontology/src/gate/creole/ontology/impl/test/Test_TupleQuery.java
 2012-07-13 12:37:22 UTC (rev 15934)
@@ -7,42 +7,38 @@
  */
 package gate.creole.ontology.impl.test;
 
-import gate.creole.ontology.*;
-import gate.util.GateException;
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Set;
-
 import gate.Factory;
 import gate.FeatureMap;
 import gate.Gate;
 import gate.creole.ResourceInstantiationException;
+import gate.creole.ontology.LiteralOrONodeID;
+import gate.creole.ontology.OConstants;
 import gate.creole.ontology.OConstants.Closure;
-import java.util.HashSet;
-import java.util.List;
+import gate.creole.ontology.OURI;
+import gate.creole.ontology.Ontology;
+import gate.creole.ontology.OntologyTupleQuery;
+import gate.util.GateException;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.util.Vector;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+import org.apache.commons.io.FileUtils;
 import org.apache.log4j.Logger;
 
 /**
  * Run tests on the test1.ttl ontology
  */
-public class Test_TupleQuery extends TestCase {
-  public static void main(String[] args) throws GateException, 
MalformedURLException {
-    System.out.println("Running main");
-    junit.textui.TestRunner.run(Test_TupleQuery.class);
-  }
-
-  public Test_TupleQuery(String arg0) throws GateException, 
MalformedURLException {
-    super(arg0);
-  }
-
-  File ontologiesDir = null;
-  File configDir = null;
-  File tmpDir = null;
+public class Test_TupleQuery {
+  static File ontologiesDir = null;
+  static File configDir = null;
+  static File tmpDir = null;
   // TODO: it seems we cannot use a static as intended here: the
   // init code still gets run for each fixture?
   static boolean isInitialized = false;
@@ -52,7 +48,8 @@
 
   // global preparation stuff - check if stuff already initialized, if
   // yes, do nothing
-  protected void init() throws GateException, MalformedURLException {
+  @BeforeClass
+  public static void init() throws GateException, MalformedURLException {
     if(!isInitialized) {
     System.out.println("Inititalizing ...");
     Gate.init();
@@ -74,21 +71,14 @@
     }
   }
 
-
-  /**
-   * per-test set up stuff
-   * @throws Exception
-   */
-  protected void setUp() throws Exception {
-    super.setUp();
-    init();
+  @AfterClass
+  public static void cleanup() throws Exception {
+    if(tmpDir != null) {
+      FileUtils.deleteDirectory(tmpDir);
+    }
   }
 
-  protected void tearDown() throws Exception {
-    super.tearDown();
-  }
-
-
+  @Test
   public void testOntologyTest1() throws ResourceInstantiationException, 
MalformedURLException {
     FeatureMap fm = Factory.newFeatureMap();
     File demoFile = new File(ontologiesDir,"test2.ttl");
@@ -174,9 +164,4 @@
     return o.createOURIForName(uri);
   }
 
-  /** Test suite routine for the test runner */
-  public static Test suite() {
-    System.out.println("Running suite");
-    return new TestSuite(Test_TupleQuery.class);
-  } // suite
 }

Modified: 
gate/trunk/plugins/Ontology/src/gate/creole/ontology/impl/test/Test_W3Tests.java
===================================================================
--- 
gate/trunk/plugins/Ontology/src/gate/creole/ontology/impl/test/Test_W3Tests.java
    2012-07-13 11:34:08 UTC (rev 15933)
+++ 
gate/trunk/plugins/Ontology/src/gate/creole/ontology/impl/test/Test_W3Tests.java
    2012-07-13 12:37:22 UTC (rev 15934)
@@ -18,32 +18,27 @@
 import gate.creole.ResourceInstantiationException;
 import gate.creole.ontology.OConstants.Closure;
 import java.util.HashSet;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
+import org.apache.commons.io.FileUtils;
 import org.apache.log4j.Logger;
 
 /**
  * Run tests based on selected examples from the W3 ontology test suite
  */
-public class Test_W3Tests extends TestCase {
-  public static void main(String[] args) throws GateException, 
MalformedURLException {
-    junit.textui.TestRunner.run(Test_W3Tests.class);
-  }
+public class Test_W3Tests {
+  static File ontologiesDir = null;
+  static File configDir = null;
+  static File tmpDir = null;
 
-  public Test_W3Tests(String arg0) throws GateException, MalformedURLException 
{
-    super(arg0);
-  }
-
-  File ontologiesDir = null;
-  File configDir = null;
-  File tmpDir = null;
-
   Logger log =  Logger.getLogger(this.getClass());
   OConstants.Closure DIRECT_CLOSURE = Closure.DIRECT_CLOSURE;
   OConstants.Closure TRANSITIVE_CLOSURE = Closure.TRANSITIVE_CLOSURE;
 
-  protected void init() throws GateException, MalformedURLException {
+  @BeforeClass
+  public static void init() throws GateException, MalformedURLException {
     System.out.println("Inititalizing ...");
     Gate.init();
     File pluginHome =
@@ -61,32 +56,19 @@
     System.out.println("Init complete");
   }
 
-
-  /**
-   * per-test set up stuff
-   * @throws Exception
-   */
-  protected void setUp() throws Exception {
-    super.setUp();
-    init();
+  @AfterClass
+  public static void cleanup() throws Exception {
+    if(tmpDir != null) {
+      FileUtils.deleteDirectory(tmpDir);
+    }
   }
-
-  protected void tearDown() throws Exception {
-    super.tearDown();
-  }
-
-  /** Test suite routine for the test runner */
-  public static Test suite() {
-    System.out.println("Running suite");
-    return new TestSuite(Test_W3Tests.class);
-  } // suite
-
+  
   // ************************************ TESTS ***************************
   // **********************************************************************
 
 
 
-
+  @Test
   public void testAPI01()
       throws MalformedURLException,
           ResourceInstantiationException {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to