EBernhardson has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/370777 )

Change subject: Rename tokencount package to router
......................................................................

Rename tokencount package to router

In preperation for adding a new router lets rename
this current package to something appropriate for
both.

Change-Id: I6f3479f90e11832993c415f8deb570b5800a3c8f
---
R 
src/main/java/org/wikimedia/search/extra/router/AbstractRouterQueryBuilder.java
R 
src/main/java/org/wikimedia/search/extra/router/TokenCountRouterQueryBuilder.java
M src/test/java/org/wikimedia/search/extra/QueryBuilderTestUtils.java
M src/test/java/org/wikimedia/search/extra/regex/SourceRegexBuilderESTest.java
R 
src/test/java/org/wikimedia/search/extra/router/TokenCountRouterBuilderESTest.java
R 
src/test/java/org/wikimedia/search/extra/router/TokenCountRouterParserTest.java
R 
src/test/java/org/wikimedia/search/extra/router/TokenCountRouterQueryIntegrationTest.java
7 files changed, 16 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/search/extra 
refs/changes/77/370777/1

diff --git 
a/src/main/java/org/wikimedia/search/extra/tokencount/AbstractRouterQueryBuilder.java
 
b/src/main/java/org/wikimedia/search/extra/router/AbstractRouterQueryBuilder.java
similarity index 100%
rename from 
src/main/java/org/wikimedia/search/extra/tokencount/AbstractRouterQueryBuilder.java
rename to 
src/main/java/org/wikimedia/search/extra/router/AbstractRouterQueryBuilder.java
diff --git 
a/src/main/java/org/wikimedia/search/extra/tokencount/TokenCountRouterQueryBuilder.java
 
b/src/main/java/org/wikimedia/search/extra/router/TokenCountRouterQueryBuilder.java
similarity index 97%
rename from 
src/main/java/org/wikimedia/search/extra/tokencount/TokenCountRouterQueryBuilder.java
rename to 
src/main/java/org/wikimedia/search/extra/router/TokenCountRouterQueryBuilder.java
index 0a2a12d..4aa0aeb 100644
--- 
a/src/main/java/org/wikimedia/search/extra/tokencount/TokenCountRouterQueryBuilder.java
+++ 
b/src/main/java/org/wikimedia/search/extra/router/TokenCountRouterQueryBuilder.java
@@ -1,4 +1,4 @@
-package org.wikimedia.search.extra.tokencount;
+package org.wikimedia.search.extra.router;
 
 import com.google.common.annotations.VisibleForTesting;
 import lombok.Getter;
@@ -18,7 +18,7 @@
 import org.elasticsearch.index.query.QueryBuilder;
 import org.elasticsearch.index.query.QueryParseContext;
 import org.elasticsearch.index.query.QueryRewriteContext;
-import 
org.wikimedia.search.extra.tokencount.AbstractRouterQueryBuilder.Condition;
+import org.wikimedia.search.extra.router.AbstractRouterQueryBuilder.Condition;
 
 import java.io.IOException;
 import java.util.Objects;
diff --git 
a/src/test/java/org/wikimedia/search/extra/QueryBuilderTestUtils.java 
b/src/test/java/org/wikimedia/search/extra/QueryBuilderTestUtils.java
index d60a3d5..4ba6137 100644
--- a/src/test/java/org/wikimedia/search/extra/QueryBuilderTestUtils.java
+++ b/src/test/java/org/wikimedia/search/extra/QueryBuilderTestUtils.java
@@ -10,7 +10,6 @@
 import org.elasticsearch.search.SearchModule;
 
 import java.io.IOException;
-import java.nio.file.Paths;
 import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
diff --git 
a/src/test/java/org/wikimedia/search/extra/regex/SourceRegexBuilderESTest.java 
b/src/test/java/org/wikimedia/search/extra/regex/SourceRegexBuilderESTest.java
index 4b84523..2fa7b3c 100644
--- 
a/src/test/java/org/wikimedia/search/extra/regex/SourceRegexBuilderESTest.java
+++ 
b/src/test/java/org/wikimedia/search/extra/regex/SourceRegexBuilderESTest.java
@@ -13,7 +13,7 @@
 import org.elasticsearch.search.internal.SearchContext;
 import org.elasticsearch.test.AbstractQueryTestCase;
 import org.wikimedia.search.extra.ExtraPlugin;
-import org.wikimedia.search.extra.tokencount.TokenCountRouterQueryBuilder;
+import org.wikimedia.search.extra.router.TokenCountRouterQueryBuilder;
 import org.wikimedia.search.extra.util.FieldValues;
 
 import java.io.IOException;
@@ -23,7 +23,7 @@
 
 import static org.hamcrest.CoreMatchers.containsString;
 import static org.hamcrest.CoreMatchers.instanceOf;
-import static 
org.wikimedia.search.extra.tokencount.AbstractRouterQueryBuilder.ConditionDefinition.gte;
+import static 
org.wikimedia.search.extra.router.AbstractRouterQueryBuilder.ConditionDefinition.gte;
 
 public class SourceRegexBuilderESTest extends 
AbstractQueryTestCase<SourceRegexQueryBuilder> {
     protected Collection<Class<? extends Plugin>> getPlugins() {
diff --git 
a/src/test/java/org/wikimedia/search/extra/tokencount/TokenCountRouterBuilderESTest.java
 
b/src/test/java/org/wikimedia/search/extra/router/TokenCountRouterBuilderESTest.java
similarity index 96%
rename from 
src/test/java/org/wikimedia/search/extra/tokencount/TokenCountRouterBuilderESTest.java
rename to 
src/test/java/org/wikimedia/search/extra/router/TokenCountRouterBuilderESTest.java
index 9cede5c..2f89db0 100644
--- 
a/src/test/java/org/wikimedia/search/extra/tokencount/TokenCountRouterBuilderESTest.java
+++ 
b/src/test/java/org/wikimedia/search/extra/router/TokenCountRouterBuilderESTest.java
@@ -1,4 +1,4 @@
-package org.wikimedia.search.extra.tokencount;
+package org.wikimedia.search.extra.router;
 
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.index.Term;
@@ -22,7 +22,7 @@
 import org.elasticsearch.search.internal.SearchContext;
 import org.elasticsearch.test.AbstractQueryTestCase;
 import org.wikimedia.search.extra.ExtraPlugin;
-import 
org.wikimedia.search.extra.tokencount.AbstractRouterQueryBuilder.Condition;
+import org.wikimedia.search.extra.router.AbstractRouterQueryBuilder.Condition;
 
 import java.io.IOException;
 import java.util.Collection;
@@ -32,8 +32,8 @@
 import static org.hamcrest.CoreMatchers.containsString;
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.CoreMatchers.instanceOf;
-import static 
org.wikimedia.search.extra.tokencount.AbstractRouterQueryBuilder.ConditionDefinition.gt;
-import static 
org.wikimedia.search.extra.tokencount.AbstractRouterQueryBuilder.ConditionDefinition.gte;
+import static 
org.wikimedia.search.extra.router.AbstractRouterQueryBuilder.ConditionDefinition.gt;
+import static 
org.wikimedia.search.extra.router.AbstractRouterQueryBuilder.ConditionDefinition.gte;
 
 public class TokenCountRouterBuilderESTest extends 
AbstractQueryTestCase<TokenCountRouterQueryBuilder> {
     protected Collection<Class<? extends Plugin>> getPlugins() {
@@ -111,14 +111,14 @@
         builder.condition(gt, 1, new MatchNoneQueryBuilder());
 
         assertThat(expectThrows(ParsingException.class, () -> 
parseQuery(builder)).getMessage(),
-                containsString("No text provided"));
-        builder.text("test text");
-
-        assertThat(expectThrows(ParsingException.class, () -> 
parseQuery(builder)).getMessage(),
                 containsString("No fallback query defined"));
         builder.fallback(new MatchNoneQueryBuilder());
 
         assertThat(expectThrows(ParsingException.class, () -> 
parseQuery(builder)).getMessage(),
+                containsString("No text provided"));
+        builder.text("test text");
+
+        assertThat(expectThrows(ParsingException.class, () -> 
parseQuery(builder)).getMessage(),
                 containsString("Missing field or analyzer definition"));
 
         builder.field("test");
diff --git 
a/src/test/java/org/wikimedia/search/extra/tokencount/TokenCountRouterParserTest.java
 
b/src/test/java/org/wikimedia/search/extra/router/TokenCountRouterParserTest.java
similarity index 91%
rename from 
src/test/java/org/wikimedia/search/extra/tokencount/TokenCountRouterParserTest.java
rename to 
src/test/java/org/wikimedia/search/extra/router/TokenCountRouterParserTest.java
index 68dc63b..0823641 100644
--- 
a/src/test/java/org/wikimedia/search/extra/tokencount/TokenCountRouterParserTest.java
+++ 
b/src/test/java/org/wikimedia/search/extra/router/TokenCountRouterParserTest.java
@@ -1,4 +1,4 @@
-package org.wikimedia.search.extra.tokencount;
+package org.wikimedia.search.extra.router;
 
 import org.apache.lucene.util.LuceneTestCase;
 import org.elasticsearch.index.query.MatchNoneQueryBuilder;
@@ -7,13 +7,13 @@
 import org.elasticsearch.index.query.QueryBuilders;
 import org.junit.Test;
 import org.wikimedia.search.extra.QueryBuilderTestUtils;
-import 
org.wikimedia.search.extra.tokencount.AbstractRouterQueryBuilder.Condition;
+import org.wikimedia.search.extra.router.AbstractRouterQueryBuilder.Condition;
 
 import java.io.IOException;
 import java.util.Optional;
 
 import static org.hamcrest.CoreMatchers.instanceOf;
-import static 
org.wikimedia.search.extra.tokencount.AbstractRouterQueryBuilder.ConditionDefinition.gte;
+import static 
org.wikimedia.search.extra.router.AbstractRouterQueryBuilder.ConditionDefinition.gte;
 
 public class TokenCountRouterParserTest extends LuceneTestCase {
     @Test
diff --git 
a/src/test/java/org/wikimedia/search/extra/tokencount/TokenCountRouterQueryIntegrationTest.java
 
b/src/test/java/org/wikimedia/search/extra/router/TokenCountRouterQueryIntegrationTest.java
similarity index 98%
rename from 
src/test/java/org/wikimedia/search/extra/tokencount/TokenCountRouterQueryIntegrationTest.java
rename to 
src/test/java/org/wikimedia/search/extra/router/TokenCountRouterQueryIntegrationTest.java
index 2b226fd..e7b548c 100644
--- 
a/src/test/java/org/wikimedia/search/extra/tokencount/TokenCountRouterQueryIntegrationTest.java
+++ 
b/src/test/java/org/wikimedia/search/extra/router/TokenCountRouterQueryIntegrationTest.java
@@ -1,4 +1,4 @@
-package org.wikimedia.search.extra.tokencount;
+package org.wikimedia.search.extra.router;
 
 import org.elasticsearch.action.search.SearchResponse;
 import org.elasticsearch.index.query.QueryBuilders;

-- 
To view, visit https://gerrit.wikimedia.org/r/370777
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6f3479f90e11832993c415f8deb570b5800a3c8f
Gerrit-PatchSet: 1
Gerrit-Project: search/extra
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <ebernhard...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to