r108947 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108946‎ | r108947 | r108948 >
Date:01:46, 15 January 2012
Author:oren
Status:deferred
Tags:
Comment:
fixed portability issue for running tests
Modified paths:
  • /trunk/lucene-search-2/test/org/wikimedia/lsearch/test/WikiTestCase.java (modified) (history)

Diff [purge]

Index: trunk/lucene-search-2/test/org/wikimedia/lsearch/test/WikiTestCase.java
@@ -1,19 +1,65 @@
22 package org.wikimedia.lsearch.test;
33
 4+import java.io.File;
 5+
 6+import junit.framework.TestCase;
 7+
48 import org.wikimedia.lsearch.analyzers.WikiQueryParser;
59 import org.wikimedia.lsearch.config.Configuration;
610 import org.wikimedia.lsearch.config.GlobalConfiguration;
711
8 -import junit.framework.TestCase;
 12+public abstract class WikiTestCase extends TestCase {
 13+
 14+ public Configuration getConfig() {
 15+ return config;
 16+ }
917
10 -public abstract class WikiTestCase extends TestCase {
 18+
 19+ public void setConfig(final Configuration config) {
 20+ this.config = config;
 21+ }
 22+
 23+
 24+ public GlobalConfiguration getGlobal() {
 25+ return global;
 26+ }
 27+
 28+
 29+ public void setGlobal(final GlobalConfiguration global) {
 30+ this.global = global;
 31+ }
 32+
 33+
1134 protected Configuration config = null;
 35+
1236 protected GlobalConfiguration global = null;
1337
 38+
1439 protected void setUp() throws Exception {
15 - if(config == null){
16 - Configuration.setConfigFile(System.getProperty("user.dir")+"/test-data/lsearch.conf.test");
17 - Configuration.setGlobalConfigUrl("file://"+System.getProperty("user.dir")+"/test-data/lsearch-global.test");
 40+ if(config == null)
 41+ {
 42+ String winPathFixer;
 43+ if(System.getProperty("os.name").startsWith("Windows")){
 44+ winPathFixer = File.separator;
 45+ }else{
 46+ winPathFixer="";
 47+ }
 48+
 49+ Configuration.setConfigFile(
 50+ System.getProperty("user.dir")+
 51+ winPathFixer+
 52+ File.separator+
 53+ "test-data"+
 54+ File.separator+
 55+ "lsearch.conf.test");
 56+
 57+ Configuration.setGlobalConfigUrl(
 58+ "file://"+
 59+ winPathFixer+
 60+ System.getProperty("user.dir")+
 61+ File.separator+"test-data"+
 62+ File.separator+"lsearch-global.test");
 63+
1864 config = Configuration.open();
1965 global = GlobalConfiguration.getInstance();
2066 WikiQueryParser.TITLE_BOOST = 2;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r108020Add the totals row to <tfoot> to exclude it from sorting. Requested by Siebra...nikerabbit13:03, 4 January 2012

Status & tagging log