Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 51 additions & 8 deletions solr/core/src/test/org/apache/solr/cloud/ZkCLITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,19 @@
*/
package org.apache.solr.cloud;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.PrintStream;
import java.io.*;
import java.lang.invoke.MethodHandles;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.util.Collection;
import java.util.List;
import java.util.Properties;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.filefilter.RegexFileFilter;
import org.apache.commons.io.filefilter.TrueFileFilter;
import org.apache.solr.SolrJettyTestBase;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.cloud.ClusterProperties;
Expand Down Expand Up @@ -75,14 +71,61 @@ public static void afterClass() throws InterruptedException {
System.clearProperty("solrcloud.skip.autorecovery");
}

public static String setupCollection1() {

// I don't know why I have to go through all this rigamorole, copied from when this should work:
//
// File workDir = createTempDir().toFile();
// setupJettyTestHome(workDir, "collection1");
// initCore("solrconfig.xml", "schema.xml");
// createAndStartJetty(workDir.getAbsolutePath());

// However the test testBootstrapWithChroot only works when I do all the rigamorole... The others all pass with the
// above commented out code.


File tempSolrHome = LuceneTestCase.createTempDir().toFile();
try {

org.apache.commons.io.FileUtils.copyFileToDirectory(getFile("solr/solr.xml"), tempSolrHome);
File collection1Dir = new File(tempSolrHome, "collection1");
org.apache.commons.io.FileUtils.forceMkdir(collection1Dir);

File configSetDir = getFile("solr/collection1/conf");
org.apache.commons.io.FileUtils.copyDirectoryToDirectory(configSetDir, collection1Dir);
Properties props = new Properties();
props.setProperty("name", "collection1");
OutputStreamWriter writer = null;
try {
writer = new OutputStreamWriter(FileUtils.openOutputStream(
new File(collection1Dir, "core.properties")), StandardCharsets.UTF_8);
props.store(writer, null);
} finally {
if (writer != null) {
try {
writer.close();
} catch (Exception ignore){}
}
}
} catch (Exception exc) {
if (exc instanceof RuntimeException) {
throw (RuntimeException)exc;
} else {
throw new RuntimeException(exc);
}
}

return tempSolrHome.getAbsolutePath();
}

@Override
public void setUp() throws Exception {
super.setUp();
if (log.isInfoEnabled()) {
log.info("####SETUP_START {}", getTestName());
}

String exampleHome = SolrJettyTestBase.legacyExampleCollection1SolrHome();
String exampleHome = setupCollection1();

Path tmpDir = createTempDir();
solrHome = exampleHome;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.apache.solr.response.SolrQueryResponse;
import org.junit.BeforeClass;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
Expand All @@ -46,8 +47,10 @@ public class ShowFileRequestHandlerTest extends SolrJettyTestBase {

@BeforeClass
public static void beforeTest() throws Exception {
File workDir = createTempDir().toFile();
setupJettyTestHome(workDir, "collection1");
initCore("solrconfig.xml", "schema.xml");
createAndStartJetty(legacyExampleCollection1SolrHome());
createAndStartJetty(workDir.getAbsolutePath());
}

public void test404ViaHttp() throws Exception {
Expand Down Expand Up @@ -88,7 +91,7 @@ public void testDirList() throws SolrServerException, IOException {
public void testGetRawFile() throws SolrServerException, IOException {
SolrClient client = getSolrClient();
//assertQ(req("qt", "/admin/file")); TODO file bug that SolrJettyTestBase extends SolrTestCaseJ4
QueryRequest request = new QueryRequest(params("file", "managed-schema"));
QueryRequest request = new QueryRequest(params("file", "schema.xml"));
request.setPath("/admin/file");
final AtomicBoolean readFile = new AtomicBoolean();
request.setResponseParser(new ResponseParser() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package org.apache.solr.metrics;

import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
Expand Down Expand Up @@ -56,7 +57,10 @@ public class JvmMetricsTest extends SolrJettyTestBase {

@BeforeClass
public static void beforeTest() throws Exception {
createAndStartJetty(legacyExampleCollection1SolrHome());
File workDir = createTempDir().toFile();
setupJettyTestHome(workDir, "collection1");
initCore("solrconfig.xml", "schema.xml");
createAndStartJetty(workDir.getAbsolutePath());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"initArgs":{},"managedList":[]}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"initArgs":{"ignoreCase":true},
"managedList":[
"a",
"an",
"and",
"are",
"as",
"at",
"be",
"but",
"by",
"for",
"if",
"in",
"into",
"is",
"it",
"no",
"not",
"of",
"on",
"or",
"stopworda",
"stopwordb",
"such",
"that",
"the",
"their",
"then",
"there",
"these",
"they",
"this",
"to",
"was",
"will",
"with"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"initArgs":{
"ignoreCase":true,
"format":"solr"
},
"managedMap":{
"GB":["GiB","Gigabyte"],
"happy":["glad","joyful"],
"TV":["Television"]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!-- Example exchange rates file for CurrencyField type named "currency" in example schema -->

<currencyConfig version="1.0">
<rates>
<!-- Updated from http://www.exchangerate.com/ at 2011-09-27 -->
<rate from="USD" to="ARS" rate="4.333871" comment="ARGENTINA Peso" />
<rate from="USD" to="AUD" rate="1.025768" comment="AUSTRALIA Dollar" />
<rate from="USD" to="EUR" rate="0.743676" comment="European Euro" />
<rate from="USD" to="BRL" rate="1.881093" comment="BRAZIL Real" />
<rate from="USD" to="CAD" rate="1.030815" comment="CANADA Dollar" />
<rate from="USD" to="CLP" rate="519.0996" comment="CHILE Peso" />
<rate from="USD" to="CNY" rate="6.387310" comment="CHINA Yuan" />
<rate from="USD" to="CZK" rate="18.47134" comment="CZECH REP. Koruna" />
<rate from="USD" to="DKK" rate="5.515436" comment="DENMARK Krone" />
<rate from="USD" to="HKD" rate="7.801922" comment="HONG KONG Dollar" />
<rate from="USD" to="HUF" rate="215.6169" comment="HUNGARY Forint" />
<rate from="USD" to="ISK" rate="118.1280" comment="ICELAND Krona" />
<rate from="USD" to="INR" rate="49.49088" comment="INDIA Rupee" />
<rate from="USD" to="XDR" rate="0.641358" comment="INTNL MON. FUND SDR" />
<rate from="USD" to="ILS" rate="3.709739" comment="ISRAEL Sheqel" />
<rate from="USD" to="JPY" rate="76.32419" comment="JAPAN Yen" />
<rate from="USD" to="KRW" rate="1169.173" comment="KOREA (SOUTH) Won" />
<rate from="USD" to="KWD" rate="0.275142" comment="KUWAIT Dinar" />
<rate from="USD" to="MXN" rate="13.85895" comment="MEXICO Peso" />
<rate from="USD" to="NZD" rate="1.285159" comment="NEW ZEALAND Dollar" />
<rate from="USD" to="NOK" rate="5.859035" comment="NORWAY Krone" />
<rate from="USD" to="PKR" rate="87.57007" comment="PAKISTAN Rupee" />
<rate from="USD" to="PEN" rate="2.730683" comment="PERU Sol" />
<rate from="USD" to="PHP" rate="43.62039" comment="PHILIPPINES Peso" />
<rate from="USD" to="PLN" rate="3.310139" comment="POLAND Zloty" />
<rate from="USD" to="RON" rate="3.100932" comment="ROMANIA Leu" />
<rate from="USD" to="RUB" rate="32.14663" comment="RUSSIA Ruble" />
<rate from="USD" to="SAR" rate="3.750465" comment="SAUDI ARABIA Riyal" />
<rate from="USD" to="SGD" rate="1.299352" comment="SINGAPORE Dollar" />
<rate from="USD" to="ZAR" rate="8.329761" comment="SOUTH AFRICA Rand" />
<rate from="USD" to="SEK" rate="6.883442" comment="SWEDEN Krona" />
<rate from="USD" to="CHF" rate="0.906035" comment="SWITZERLAND Franc" />
<rate from="USD" to="TWD" rate="30.40283" comment="TAIWAN Dollar" />
<rate from="USD" to="THB" rate="30.89487" comment="THAILAND Baht" />
<rate from="USD" to="AED" rate="3.672955" comment="U.A.E. Dirham" />
<rate from="USD" to="UAH" rate="7.988582" comment="UKRAINE Hryvnia" />
<rate from="USD" to="GBP" rate="0.647910" comment="UNITED KINGDOM Pound" />

<!-- Cross-rates for some common currencies -->
<rate from="EUR" to="GBP" rate="0.869914" />
<rate from="EUR" to="NOK" rate="7.800095" />
<rate from="GBP" to="NOK" rate="8.966508" />
</rates>
</currencyConfig>
42 changes: 42 additions & 0 deletions solr/solrj/src/test-files/solrj/solr/testproducts/conf/elevate.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!-- If this file is found in the config directory, it will only be
loaded once at startup. If it is found in Solr's data
directory, it will be re-loaded every commit.

See https://solr.apache.org/guide/query-elevation-component.html for more info

-->
<elevate>
<!-- Query elevation examples
<query text="foo bar">
<doc id="1" />
<doc id="2" />
<doc id="3" />
</query>

for use with techproducts example

<query text="ipod">
<doc id="MA147LL/A" /> put the actual ipod at the top
<doc id="IW-02" exclude="true" /> exclude this cable
</query>
-->

</elevate>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Set of Catalan contractions for ElisionFilter
# TODO: load this as a resource from the analyzer and sync it in build.xml
d
l
m
n
s
t
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Set of French contractions for ElisionFilter
# TODO: load this as a resource from the analyzer and sync it in build.xml
l
m
t
qu
n
s
j
d
c
jusqu
quoiqu
lorsqu
puisqu
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Set of Irish contractions for ElisionFilter
# TODO: load this as a resource from the analyzer and sync it in build.xml
d
m
b
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Set of Italian contractions for ElisionFilter
# TODO: load this as a resource from the analyzer and sync it in build.xml
c
l
all
dall
dell
nell
sull
coll
pell
gl
agl
dagl
degl
negl
sugl
un
m
t
s
v
d
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Set of Irish hyphenations for StopFilter
# TODO: load this as a resource from the analyzer and sync it in build.xml
h
n
t
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Set of overrides for the dutch stemmer
# TODO: load this as a resource from the analyzer and sync it in build.xml
fiets fiets
bromfiets bromfiets
ei eier
kind kinder
Loading