Revision: 15146
          http://gate.svn.sourceforge.net/gate/?rev=15146&view=rev
Author:   markagreenwood
Date:     2012-01-20 11:04:59 +0000 (Fri, 20 Jan 2012)
Log Message:
-----------
fixed some tests so that they still run if we want to check that sort of thing, 
the work around might be useful for supported plugins we move out of 
gate/plugins as well

Modified Paths:
--------------
    plugins/trunk/obsolete/Ontology_OWLIM2/build.xml
    
plugins/trunk/obsolete/Ontology_OWLIM2/src/gate/creole/ontology/owlim/test/TestOntologyAPI.java
    plugins/trunk/obsolete/build.xml

Modified: plugins/trunk/obsolete/Ontology_OWLIM2/build.xml
===================================================================
--- plugins/trunk/obsolete/Ontology_OWLIM2/build.xml    2012-01-20 09:32:49 UTC 
(rev 15145)
+++ plugins/trunk/obsolete/Ontology_OWLIM2/build.xml    2012-01-20 11:04:59 UTC 
(rev 15146)
@@ -72,6 +72,11 @@
   </target>
   
         <target name="test" depends="jar">
+               <makeurl property="creole.plugins" separator=";">
+                        <path>
+                            <pathelement location="." />
+                        </path>
+               </makeurl>                
                 <junit fork="true" showoutput="yes" printsummary="yes"  
maxmemory="${run.memory}">
                         <classpath>
                                 <pathelement location="OWLIM2Ontology.jar" />
@@ -79,6 +84,7 @@
                         </classpath>
                         <!-- run headless -->
                         <sysproperty key="java.awt.headless" value="true" />
+                        <sysproperty key="load.plugin.path" 
value="${creole.plugins}"/>
                         <formatter type="plain" />
 
                         <test 
name="gate.creole.ontology.owlim.test.TestOntologyAPI" />

Modified: 
plugins/trunk/obsolete/Ontology_OWLIM2/src/gate/creole/ontology/owlim/test/TestOntologyAPI.java
===================================================================
--- 
plugins/trunk/obsolete/Ontology_OWLIM2/src/gate/creole/ontology/owlim/test/TestOntologyAPI.java
     2012-01-20 09:32:49 UTC (rev 15145)
+++ 
plugins/trunk/obsolete/Ontology_OWLIM2/src/gate/creole/ontology/owlim/test/TestOntologyAPI.java
     2012-01-20 11:04:59 UTC (rev 15146)
@@ -7,28 +7,41 @@
  */
 package gate.creole.ontology.owlim.test;
 
-import gate.Executable;
-import gate.creole.ExecutionException;
-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.*;
-import gate.util.Benchmark;
+import gate.creole.ontology.AnnotationProperty;
+import gate.creole.ontology.DatatypeProperty;
+import gate.creole.ontology.OClass;
+import gate.creole.ontology.OConstants;
+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.RDFProperty;
+import gate.creole.ontology.SymmetricProperty;
+import gate.creole.ontology.URI;
+import gate.creole.ontology.owlim.Utils;
+import gate.util.Files;
+
+import java.io.File;
+import java.net.JarURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
+
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
+
 import org.apache.commons.io.FileUtils;
+import org.apache.log4j.BasicConfigurator;
 import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
-import org.apache.log4j.BasicConfigurator;
 
 
 /**
@@ -55,13 +68,15 @@
     super.setUp();
     System.out.println("Starting up");
     Gate.init();
-    File pluginHome =
-        new File(new File(Gate.getGateHome(), "plugins"),
-                 "Ontology_OWLIM2");
-    System.out.println("Plugins Home is "+pluginHome.getAbsolutePath());
-    Gate.getCreoleRegister().registerDirectories(
-            pluginHome.toURI().toURL());
-    File testingDir = new File(pluginHome,"test");
+    
+    URL jar = 
Utils.class.getClassLoader().getResource(Utils.class.getCanonicalName().replace('.','/')+".class");
+    if (jar.toExternalForm().startsWith("jar")) {
+      jar = ((JarURLConnection)jar.openConnection()).getJarFileURL();
+    }
+    
+    File pluginDir = Files.fileFromURL(jar).getParentFile();
+    
+    File testingDir = new File(pluginDir, "test");
     assertTrue(testingDir.exists());
     ontologiesDir = new File(testingDir, "ontologies");
     tmpDir = getUniqueTmpDir();

Modified: plugins/trunk/obsolete/build.xml
===================================================================
--- plugins/trunk/obsolete/build.xml    2012-01-20 09:32:49 UTC (rev 15145)
+++ plugins/trunk/obsolete/build.xml    2012-01-20 11:04:59 UTC (rev 15146)
@@ -33,6 +33,23 @@
     </for>
   </target>
 
+  <target name="test" depends="build">
+    <for param="plugin">
+      <path>
+        <dirset refid="plugins.to.build" />
+      </path>
+      <sequential>
+        <if>
+          <available file="@{plugin}/build.xml" />     
+          <then>
+            <echo>Testing plugin @{plugin}</echo>              
+            <ant dir="@{plugin}" inheritAll="false" target="test" />
+          </then>
+        </if>
+      </sequential>
+    </for>
+  </target>
+
   <target name="distro.prepare">
     <for param="plugin">
       <path>
@@ -67,7 +84,7 @@
     </for>
   </target>
   
-  <target name="distro" depends="build, distro.prepare">
+  <target name="distro" depends="test, distro.prepare">
     <echo file="site.xml" message="&lt;UpdateSite&gt;" append="false" />
     <for param="plugin">
       <path>

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


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to