Revision: 17068
http://sourceforge.net/p/gate/code/17068
Author: markagreenwood
Date: 2013-11-08 17:40:00 +0000 (Fri, 08 Nov 2013)
Log Message:
-----------
changed the way we get the URLs to the test resources so that it works no
matter where er run the tests from
Modified Paths:
--------------
gate/branches/sawdust/plugins/Machine_Learning/src/gate/creole/ml/maxent/TestMaxentWrapper.java
Modified:
gate/branches/sawdust/plugins/Machine_Learning/src/gate/creole/ml/maxent/TestMaxentWrapper.java
===================================================================
---
gate/branches/sawdust/plugins/Machine_Learning/src/gate/creole/ml/maxent/TestMaxentWrapper.java
2013-11-08 13:02:21 UTC (rev 17067)
+++
gate/branches/sawdust/plugins/Machine_Learning/src/gate/creole/ml/maxent/TestMaxentWrapper.java
2013-11-08 17:40:00 UTC (rev 17068)
@@ -21,6 +21,8 @@
import gate.corpora.*;
import java.io.File;
import java.net.*;
+
+import sun.reflect.ReflectionFactory.GetReflectionFactoryAction;
import gate.gui.MainFrame;
import gate.util.Files;
import gate.util.GateRuntimeException;
@@ -38,6 +40,8 @@
*/
private static boolean gateInited = false;
+ private static URL pluginURL;
+
private static synchronized void initGate() throws Exception {
if(!gateInited) {
File gateHome = new File(System.getProperty("gate.home.location"));
@@ -50,6 +54,11 @@
Gate.getCreoleRegister().registerDirectories(mlPlugin.toURI().toURL());
gateInited = true;
}
+
+ URL url =
Gate.getClassLoader().getResource(TestMaxentWrapper.class.getCanonicalName().replace(".",
"/")+".class");
+ JarURLConnection connection = (JarURLConnection)url.openConnection();
+ pluginURL = connection.getJarFileURL();
+ System.out.println(pluginURL);
}
/** Fixture set up - init GATE*/
@@ -86,7 +95,7 @@
// tests/doc0.html is a simple html document.
Document doc = Factory.newDocument(
//new URL(TestDocument.getTestServerName() + "tests/doc0.html"));
- (new File("tests/doc0.html")).toURI().toURL());
+ new URL(pluginURL,"tests/doc0.html"));
// Get a tokeniser - just use all the default settings.
@@ -102,7 +111,7 @@
// Create the Maxent ML Processing resource.
// First set up the parameters
FeatureMap maxentParameters = Factory.newFeatureMap();
- maxentParameters.put("configFileURL", (new
File("tests/TestMaxentConfigFile.xml")).toURI().toURL());
+ maxentParameters.put("configFileURL", new
URL(pluginURL,"tests/TestMaxentConfigFile.xml"));
//Files.getGateResource("/gate.ac.uk/tests/TestMaxentConfigFile.xml"));
// Then actually make the PR
LanguageAnalyser maxentPR =
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs