epugh commented on code in PR #2557:
URL: https://github.com/apache/solr/pull/2557#discussion_r1679567571
##########
solr/core/src/java/org/apache/solr/cli/PostTool.java:
##########
@@ -311,6 +312,8 @@ public void runImpl(CommandLine cli) throws Exception {
args = cli.getArgs();
+ params = cli.hasOption("params") ? cli.getOptionValue("params") : "";
Review Comment:
The pattern we have mostly been using is this one:
```
params = cli.getOptionValue("params", "");
```
##########
solr/core/src/test/org/apache/solr/cli/PostToolTest.java:
##########
@@ -147,6 +147,43 @@ public void testRunWithCollectionParam() throws Exception {
assertEquals("*:* found unexpected number of documents", expectedDocCount,
numFound);
}
+ @Test
+ public void testRunCsvWithCustomSeparatorParam() throws Exception {
+ final String collection = "testRunCsvWithCustomSeparatorParam";
+
+ // Provide the port for the PostTool to look up.
+ EnvUtils.setProperty("jetty.port",
cluster.getJettySolrRunner(0).getLocalPort() + "");
+
+ withBasicAuth(CollectionAdminRequest.createCollection(collection, "conf1",
1, 1, 0, 0))
+ .processAndWait(cluster.getSolrClient(), 10);
+
+ File tsvDoc = File.createTempFile("temp", ".tsv");
+
+ FileWriter fw = new FileWriter(tsvDoc, StandardCharsets.UTF_8);
+ fw.write("1\tmytitle\n");
+ fw.close();
+
+ String[] args = {
+ "post", "-c", collection, "-credentials", SecurityJson.USER_PASS,
"-params", "\"separator=%09&header=false&fieldnames=id,title_s\"", "-type",
"text/csv", tsvDoc.getAbsolutePath()
+ };
+ assertEquals(0, runTool(args));
+
+ int numFound = 0;
+ int expectedDocCount = 1;
+
+ for (int idx = 0; idx < 100; ++idx) {
Review Comment:
Do we need this loop? Won't it always be returning the same results?
##########
solr/core/src/test/org/apache/solr/cli/PostToolTest.java:
##########
@@ -147,6 +147,43 @@ public void testRunWithCollectionParam() throws Exception {
assertEquals("*:* found unexpected number of documents", expectedDocCount,
numFound);
}
+ @Test
+ public void testRunCsvWithCustomSeparatorParam() throws Exception {
+ final String collection = "testRunCsvWithCustomSeparatorParam";
+
+ // Provide the port for the PostTool to look up.
Review Comment:
this is actually probably a nice test of the alternative way to look up your
port versus passing in the solr url or zk url...
##########
solr/core/src/test/org/apache/solr/cli/PostToolTest.java:
##########
@@ -147,6 +147,43 @@ public void testRunWithCollectionParam() throws Exception {
assertEquals("*:* found unexpected number of documents", expectedDocCount,
numFound);
}
+ @Test
+ public void testRunCsvWithCustomSeparatorParam() throws Exception {
+ final String collection = "testRunCsvWithCustomSeparatorParam";
+
+ // Provide the port for the PostTool to look up.
+ EnvUtils.setProperty("jetty.port",
cluster.getJettySolrRunner(0).getLocalPort() + "");
+
+ withBasicAuth(CollectionAdminRequest.createCollection(collection, "conf1",
1, 1, 0, 0))
+ .processAndWait(cluster.getSolrClient(), 10);
+
+ File tsvDoc = File.createTempFile("temp", ".tsv");
+
+ FileWriter fw = new FileWriter(tsvDoc, StandardCharsets.UTF_8);
+ fw.write("1\tmytitle\n");
+ fw.close();
+
+ String[] args = {
Review Comment:
i think if you run the gradle tidy command this line will wrap some!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]