r109421 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109420‎ | r109421 | r109422 >
Date:18:46, 18 January 2012
Author:oren
Status:deferred
Tags:
Comment:
changed WikiTesTcase to reflect the current project setup and renamed it to indicate that it is abstract
added folders for javascripts and php
Modified paths:
  • /trunk/lucene-search-3/pom.xml (modified) (history)
  • /trunk/lucene-search-3/src/main/javascript (added) (history)
  • /trunk/lucene-search-3/src/main/php (added) (history)
  • /trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/analyzers/AnalysisTest.java (modified) (history)
  • /trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/analyzers/FastWikiTokenizerTest.java (modified) (history)
  • /trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/analyzers/WikiQueryParserTest.java (modified) (history)
  • /trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/analyzers/WordNetTest.java (modified) (history)
  • /trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/beans/TitleTest.java (modified) (history)
  • /trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/config/GlobalConfigurationTest.java (modified) (history)
  • /trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/index/WikiIndexModifierTest.java (modified) (history)
  • /trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/search/PrefixMatchTest.java (modified) (history)
  • /trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/spell/SuggestUnitTest.java (modified) (history)
  • /trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/spell/api/SpellCheckIndexerTest.java (modified) (history)
  • /trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/test/AbstractWikiTestCase.java (added) (history)
  • /trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/test/WikiTestCase.java (deleted) (history)

Diff [purge]

Index: trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/spell/SuggestUnitTest.java
@@ -7,9 +7,9 @@
88 import org.wikimedia.lsearch.config.IndexId;
99 import org.wikimedia.lsearch.search.NamespaceFilter;
1010 import org.wikimedia.lsearch.spell.dist.EditDistance;
11 -import org.wikimedia.lsearch.test.WikiTestCase;
 11+import org.wikimedia.lsearch.test.AbstractWikiTestCase;
1212
13 -public class SuggestUnitTest extends WikiTestCase
 13+public class SuggestUnitTest extends AbstractWikiTestCase
1414 {
1515
1616 public void testMakeNamespaces() throws IOException {
Index: trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/spell/api/SpellCheckIndexerTest.java
@@ -1,8 +1,8 @@
22 package org.wikimedia.lsearch.spell.api;
33
4 -import org.wikimedia.lsearch.test.WikiTestCase;
 4+import org.wikimedia.lsearch.test.AbstractWikiTestCase;
55
6 -public class SpellCheckIndexerTest extends WikiTestCase {
 6+public class SpellCheckIndexerTest extends AbstractWikiTestCase {
77 public void testMakeIndex(){
88 // TODO retest what goes into the final .spell index
99 }
Index: trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/test/WikiTestCase.java
@@ -1,79 +0,0 @@
2 -package org.wikimedia.lsearch.test;
3 -
4 -import java.io.File;
5 -
6 -import junit.framework.TestCase;
7 -
8 -import org.wikimedia.lsearch.analyzers.WikiQueryParser;
9 -import org.wikimedia.lsearch.config.Configuration;
10 -import org.wikimedia.lsearch.config.GlobalConfiguration;
11 -
12 -
13 -/**
14 - * parent class for test that require that the configuration files be initialized
15 - *
16 - * @author rainman
17 - *
18 - */
19 -public abstract class WikiTestCase extends TestCase {
20 -
21 - public Configuration getConfig() {
22 - return config;
23 - }
24 -
25 -
26 -
27 - public void setConfig(final Configuration config) {
28 - this.config = config;
29 - }
30 -
31 -
32 - public GlobalConfiguration getGlobal() {
33 - return global;
34 - }
35 -
36 -
37 - public void setGlobal(final GlobalConfiguration global) {
38 - this.global = global;
39 - }
40 -
41 -
42 - protected Configuration config = null;
43 -
44 - protected GlobalConfiguration global = null;
45 -
46 - @Override
47 - protected void setUp() {
48 - if(config == null)
49 - {
50 - String winPathFixer;
51 - if(System.getProperty("os.name").startsWith("Windows")){
52 - winPathFixer = File.separator;
53 - }else{
54 - winPathFixer="";
55 - }
56 -
57 - Configuration.setConfigFile(
58 - System.getProperty("user.dir")+
59 - winPathFixer+
60 - File.separator+
61 - "test-data"+
62 - File.separator+
63 - "lsearch.conf.test");
64 -
65 - Configuration.setGlobalConfigUrl(
66 - "file://"+
67 - winPathFixer+
68 - System.getProperty("user.dir")+
69 - File.separator+"test-data"+
70 - File.separator+"lsearch-global.test");
71 -
72 - config = Configuration.open();
73 - global = GlobalConfiguration.getInstance();
74 - WikiQueryParser.TITLE_BOOST = 2;
75 - WikiQueryParser.ALT_TITLE_BOOST = 6;
76 - WikiQueryParser.CONTENTS_BOOST = 1;
77 - }
78 - }
79 -
80 -}
Index: trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/test/AbstractWikiTestCase.java
@@ -0,0 +1,81 @@
 2+package org.wikimedia.lsearch.test;
 3+
 4+import java.io.File;
 5+
 6+import junit.framework.TestCase;
 7+
 8+import org.wikimedia.lsearch.analyzers.WikiQueryParser;
 9+import org.wikimedia.lsearch.config.Configuration;
 10+import org.wikimedia.lsearch.config.GlobalConfiguration;
 11+
 12+
 13+/**
 14+ * parent class for test that require that the configuration files be initialized
 15+ *
 16+ * @author rainman
 17+ *
 18+ */
 19+public abstract class AbstractWikiTestCase extends TestCase {
 20+
 21+ public Configuration getConfig() {
 22+ return config;
 23+ }
 24+
 25+
 26+
 27+ public void setConfig(final Configuration config) {
 28+ this.config = config;
 29+ }
 30+
 31+
 32+ public GlobalConfiguration getGlobal() {
 33+ return global;
 34+ }
 35+
 36+
 37+ public void setGlobal(final GlobalConfiguration global) {
 38+ this.global = global;
 39+ }
 40+
 41+
 42+ protected Configuration config = null;
 43+
 44+ protected GlobalConfiguration global = null;
 45+
 46+ @Override
 47+ protected void setUp() {
 48+ if(config == null)
 49+ {
 50+ String winPathFixer;
 51+ if(System.getProperty("os.name").startsWith("Windows")){
 52+ winPathFixer = File.separator;
 53+ }else{
 54+ winPathFixer="";
 55+ }
 56+
 57+ Configuration.setConfigFile(
 58+ System.getProperty("user.dir")+
 59+ winPathFixer+
 60+ File.separator+"src"+
 61+ File.separator+"test"+
 62+ File.separator+"resources"+
 63+ File.separator+"lsearch.conf.test");
 64+
 65+ Configuration.setGlobalConfigUrl(
 66+ "file://"+
 67+ winPathFixer+
 68+ System.getProperty("user.dir")+
 69+ File.separator+"src"+
 70+ File.separator+"test"+
 71+ File.separator+"resources"+
 72+ File.separator+"lsearch-global.test");
 73+
 74+ config = Configuration.open();
 75+ global = GlobalConfiguration.getInstance();
 76+ WikiQueryParser.TITLE_BOOST = 2;
 77+ WikiQueryParser.ALT_TITLE_BOOST = 6;
 78+ WikiQueryParser.CONTENTS_BOOST = 1;
 79+ }
 80+ }
 81+
 82+}
Index: trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/config/GlobalConfigurationTest.java
@@ -12,14 +12,14 @@
1313
1414 import org.apache.log4j.Logger;
1515 import org.wikimedia.lsearch.search.NamespaceFilter;
16 -import org.wikimedia.lsearch.test.WikiTestCase;
 16+import org.wikimedia.lsearch.test.AbstractWikiTestCase;
1717 import org.wikimedia.lsearch.util.StringUtils;
1818
1919 /**
2020 * @author rainman
2121 *
2222 */
23 -public class GlobalConfigurationTest extends WikiTestCase { // NOPMD by OrenBochman on 1/15/12 3:38 AM
 23+public class GlobalConfigurationTest extends AbstractWikiTestCase { // NOPMD by OrenBochman on 1/15/12 3:38 AM
2424
2525 private static final Logger LOG = Logger.getLogger(GlobalConfigurationTest.class.getName());
2626 private transient GlobalConfiguration global = null;
Index: trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/search/PrefixMatchTest.java
@@ -1,11 +1,11 @@
22 package org.wikimedia.lsearch.search;
33
44 import org.apache.lucene.search.ArticleNamespaceScaling;
5 -import org.wikimedia.lsearch.test.WikiTestCase;
 5+import org.wikimedia.lsearch.test.AbstractWikiTestCase;
66 import org.wikimedia.lsearch.config.IndexId;
77 import org.wikimedia.lsearch.search.SearchEngine.PrefixMatch;
88
9 -public class PrefixMatchTest extends WikiTestCase {
 9+public class PrefixMatchTest extends AbstractWikiTestCase {
1010 public void testDeserialization(){
1111 IndexId iid = IndexId.get("enwiki");
1212 PrefixMatch m = new PrefixMatch("0:Some_title 10 ",iid.getNamespaceScaling());
Index: trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/index/WikiIndexModifierTest.java
@@ -19,9 +19,9 @@
2020 import org.wikimedia.lsearch.config.IndexId;
2121 import org.wikimedia.lsearch.ranks.StringList;
2222 import org.wikimedia.lsearch.related.RelatedTitle;
23 -import org.wikimedia.lsearch.test.WikiTestCase;
 23+import org.wikimedia.lsearch.test.AbstractWikiTestCase;
2424
25 -public class WikiIndexModifierTest extends WikiTestCase {
 25+public class WikiIndexModifierTest extends AbstractWikiTestCase {
2626 Document doc = null;
2727 Analyzer analyzer = null;
2828 Analyzer highlightAnalyzer = null;
Index: trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/analyzers/WordNetTest.java
@@ -2,9 +2,9 @@
33
44 import java.util.ArrayList;
55
6 -import org.wikimedia.lsearch.test.WikiTestCase;
 6+import org.wikimedia.lsearch.test.AbstractWikiTestCase;
77
8 -public class WordNetTest extends WikiTestCase {
 8+public class WordNetTest extends AbstractWikiTestCase {
99
1010 protected ArrayList<String> list(String[] strs){
1111 ArrayList<String> l = new ArrayList<String>();
Index: trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/analyzers/AnalysisTest.java
@@ -17,9 +17,9 @@
1818 import org.wikimedia.lsearch.config.GlobalConfiguration;
1919 import org.wikimedia.lsearch.config.IndexId;
2020 import org.wikimedia.lsearch.ranks.StringList;
21 -import org.wikimedia.lsearch.test.WikiTestCase;
 21+import org.wikimedia.lsearch.test.AbstractWikiTestCase;
2222
23 -public class AnalysisTest extends WikiTestCase {
 23+public class AnalysisTest extends AbstractWikiTestCase {
2424 Analyzer a = null;
2525 Configuration config = null;
2626
Index: trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/analyzers/WikiQueryParserTest.java
@@ -16,11 +16,11 @@
1717 import org.wikimedia.lsearch.config.GlobalConfiguration;
1818 import org.wikimedia.lsearch.config.IndexId;
1919 import org.wikimedia.lsearch.index.WikiIndexModifier;
20 -import org.wikimedia.lsearch.test.WikiTestCase;
 20+import org.wikimedia.lsearch.test.AbstractWikiTestCase;
2121
2222 import junit.framework.TestCase;
2323
24 -public class WikiQueryParserTest extends WikiTestCase {
 24+public class WikiQueryParserTest extends AbstractWikiTestCase {
2525
2626
2727
Index: trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/analyzers/FastWikiTokenizerTest.java
@@ -21,9 +21,9 @@
2222 import org.wikimedia.lsearch.config.Configuration;
2323 import org.wikimedia.lsearch.config.IndexId;
2424 import org.wikimedia.lsearch.index.WikiIndexModifier;
25 -import org.wikimedia.lsearch.test.WikiTestCase;
 25+import org.wikimedia.lsearch.test.AbstractWikiTestCase;
2626
27 -public class FastWikiTokenizerTest extends WikiTestCase {
 27+public class FastWikiTokenizerTest extends AbstractWikiTestCase {
2828 IndexId iid;
2929 TokenizerOptions options;
3030
Index: trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/beans/TitleTest.java
@@ -1,8 +1,8 @@
22 package org.wikimedia.lsearch.beans;
33
4 -import org.wikimedia.lsearch.test.WikiTestCase;
 4+import org.wikimedia.lsearch.test.AbstractWikiTestCase;
55
6 -public class TitleTest extends WikiTestCase {
 6+public class TitleTest extends AbstractWikiTestCase {
77
88 public void testStatic(){
99 assertEquals(0,Title.namespaceAsInt("0:Title"));
Index: trunk/lucene-search-3/pom.xml
@@ -410,6 +410,7 @@
411411 <scm>
412412 <developerConnection>oren</developerConnection>
413413 <url>http://svn.wikimedia.org/svnroot/mediawiki/trunk/lucene-search-3</url>
 414+ <connection>svn+ssh</connection>
414415 </scm>
415416 <ciManagement>
416417 <system>jenkins</system>

Status & tagging log