SOLR-8938: add -x as short-form of --excluderegex ZkCLI arg

This commit is contained in:
Christine Poerschke 2016-04-15 15:52:53 +01:00
parent 09f92b7edf
commit 3ab579b7ec
3 changed files with 6 additions and 3 deletions

View File

@ -89,7 +89,7 @@ New Features
graph traversal to find the shortest path(s) in an unweighted, directed graph stored in a graph traversal to find the shortest path(s) in an unweighted, directed graph stored in a
SolrCloud collection. (Joel Bernstein) SolrCloud collection. (Joel Bernstein)
* SOLR-8938: Add optional -excluderegex argument to ZkCLI. (Christine Poerschke) * SOLR-8938: Add optional --excluderegex argument to ZkCLI. (Christine Poerschke)
* SOLR-8976: Add SolrJ support for REBALANCELEADERS Collections API (Anshum Gupta) * SOLR-8976: Add SolrJ support for REBALANCELEADERS Collections API (Anshum Gupta)

View File

@ -67,6 +67,7 @@ public class ZkCLI {
private static final String SOLRHOME = "solrhome"; private static final String SOLRHOME = "solrhome";
private static final String BOOTSTRAP = "bootstrap"; private static final String BOOTSTRAP = "bootstrap";
static final String UPCONFIG = "upconfig"; static final String UPCONFIG = "upconfig";
static final String EXCLUDE_REGEX_SHORT = "x";
static final String EXCLUDE_REGEX = "excluderegex"; static final String EXCLUDE_REGEX = "excluderegex";
static final String EXCLUDE_REGEX_DEFAULT = ZkConfigManager.UPLOAD_FILENAME_EXCLUDE_REGEX; static final String EXCLUDE_REGEX_DEFAULT = ZkConfigManager.UPLOAD_FILENAME_EXCLUDE_REGEX;
private static final String COLLECTION = "collection"; private static final String COLLECTION = "collection";
@ -122,7 +123,7 @@ public class ZkCLI {
options.addOption("c", COLLECTION, true, options.addOption("c", COLLECTION, true,
"for " + LINKCONFIG + ": name of the collection"); "for " + LINKCONFIG + ": name of the collection");
options.addOption(EXCLUDE_REGEX, true, options.addOption(EXCLUDE_REGEX_SHORT, EXCLUDE_REGEX, true,
"for " + UPCONFIG + ": files matching this regular expression won't be uploaded"); "for " + UPCONFIG + ": files matching this regular expression won't be uploaded");
options options

View File

@ -103,6 +103,7 @@ public class ZkCLITest extends SolrTestCaseJ4 {
@Test @Test
public void testCmdConstants() throws Exception { public void testCmdConstants() throws Exception {
assertEquals("upconfig", ZkCLI.UPCONFIG); assertEquals("upconfig", ZkCLI.UPCONFIG);
assertEquals("x", ZkCLI.EXCLUDE_REGEX_SHORT);
assertEquals("excluderegex", ZkCLI.EXCLUDE_REGEX); assertEquals("excluderegex", ZkCLI.EXCLUDE_REGEX);
assertEquals(ZkConfigManager.UPLOAD_FILENAME_EXCLUDE_REGEX, ZkCLI.EXCLUDE_REGEX_DEFAULT); assertEquals(ZkConfigManager.UPLOAD_FILENAME_EXCLUDE_REGEX, ZkCLI.EXCLUDE_REGEX_DEFAULT);
} }
@ -208,10 +209,11 @@ public class ZkCLITest extends SolrTestCaseJ4 {
"-confdir", ExternalPaths.TECHPRODUCTS_CONFIGSET, "-confdir", ExternalPaths.TECHPRODUCTS_CONFIGSET,
"-confname", confsetname}; "-confname", confsetname};
} else { } else {
final String excluderegexOption = (random().nextBoolean() ? "--"+ZkCLI.EXCLUDE_REGEX : "-"+ZkCLI.EXCLUDE_REGEX_SHORT);
upconfigArgs = new String[] { upconfigArgs = new String[] {
"-zkhost", zkServer.getZkAddress(), "-zkhost", zkServer.getZkAddress(),
"-cmd", ZkCLI.UPCONFIG, "-cmd", ZkCLI.UPCONFIG,
"-"+ZkCLI.EXCLUDE_REGEX, ZkCLI.EXCLUDE_REGEX_DEFAULT, excluderegexOption, ZkCLI.EXCLUDE_REGEX_DEFAULT,
"-confdir", ExternalPaths.TECHPRODUCTS_CONFIGSET, "-confdir", ExternalPaths.TECHPRODUCTS_CONFIGSET,
"-confname", confsetname}; "-confname", confsetname};
} }