mirror of https://github.com/apache/lucene.git
SOLR-4952: get TestReplicationHandler using solrconfig.snippet.randomindexconfig.xml. This also fixes NumericFieldsTest and TestBinaryField which were using the replication configs for no explicable reason, and since i needed to fix TestBinaryField anyway, i simplified it to use SolrJettyTestBase instead of it's own kludgy setup
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1510838 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c12875f84e
commit
80fb94c647
|
@ -24,5 +24,6 @@
|
|||
<dataDir>${solr.data.dir:}</dataDir>
|
||||
<xi:include href="solrconfig.snippet.randomindexconfig.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.RAMDirectoryFactory}"/>
|
||||
<requestHandler name="standard" class="solr.StandardRequestHandler"></requestHandler>
|
||||
<requestHandler name="standard" class="solr.StandardRequestHandler" />
|
||||
<requestHandler name="/update" class="solr.UpdateRequestHandler" />
|
||||
</config>
|
||||
|
|
|
@ -22,10 +22,7 @@
|
|||
<directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.RAMDirectoryFactory}"/>
|
||||
<dataDir>${solr.data.dir:}</dataDir>
|
||||
|
||||
<indexConfig>
|
||||
<lockType>single</lockType>
|
||||
<useCompoundFile>${useCompoundFile:false}</useCompoundFile>
|
||||
</indexConfig>
|
||||
<xi:include href="solrconfig.snippet.randomindexconfig.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
|
||||
<updateHandler class="solr.DirectUpdateHandler2">
|
||||
</updateHandler>
|
||||
|
|
|
@ -21,10 +21,7 @@
|
|||
<dataDir>${solr.data.dir:}</dataDir>
|
||||
<directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.RAMDirectoryFactory}"/>
|
||||
|
||||
<indexConfig>
|
||||
<lockType>single</lockType>
|
||||
<useCompoundFile>${useCompoundFile:false}</useCompoundFile>
|
||||
</indexConfig>
|
||||
<xi:include href="solrconfig.snippet.randomindexconfig.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
|
||||
<updateHandler class="solr.DirectUpdateHandler2">
|
||||
</updateHandler>
|
||||
|
|
|
@ -22,10 +22,7 @@
|
|||
<dataDir>${solr.data.dir:}</dataDir>
|
||||
<directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.RAMDirectoryFactory}"/>
|
||||
|
||||
<indexConfig>
|
||||
<lockType>single</lockType>
|
||||
<useCompoundFile>${useCompoundFile:false}</useCompoundFile>
|
||||
</indexConfig>
|
||||
<xi:include href="solrconfig.snippet.randomindexconfig.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
|
||||
<updateHandler class="solr.DirectUpdateHandler2">
|
||||
</updateHandler>
|
||||
|
|
|
@ -22,10 +22,7 @@
|
|||
<dataDir>${solr.data.dir:}</dataDir>
|
||||
<directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.RAMDirectoryFactory}"/>
|
||||
|
||||
<indexConfig>
|
||||
<lockType>single</lockType>
|
||||
<useCompoundFile>${useCompoundFile:false}</useCompoundFile>
|
||||
</indexConfig>
|
||||
<xi:include href="solrconfig.snippet.randomindexconfig.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
|
||||
<updateHandler class="solr.DirectUpdateHandler2">
|
||||
</updateHandler>
|
||||
|
|
|
@ -22,10 +22,7 @@
|
|||
<dataDir>${solr.data.dir:}</dataDir>
|
||||
<directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.RAMDirectoryFactory}"/>
|
||||
|
||||
<indexConfig>
|
||||
<lockType>single</lockType>
|
||||
<useCompoundFile>${useCompoundFile:false}</useCompoundFile>
|
||||
</indexConfig>
|
||||
<xi:include href="solrconfig.snippet.randomindexconfig.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
|
||||
<updateHandler class="solr.DirectUpdateHandler2">
|
||||
</updateHandler>
|
||||
|
|
|
@ -22,10 +22,7 @@
|
|||
<directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.RAMDirectoryFactory}"/>
|
||||
<dataDir>${solr.data.dir:}</dataDir>
|
||||
|
||||
<indexConfig>
|
||||
<lockType>single</lockType>
|
||||
<useCompoundFile>${useCompoundFile:false}</useCompoundFile>
|
||||
</indexConfig>
|
||||
<xi:include href="solrconfig.snippet.randomindexconfig.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
|
||||
<updateHandler class="solr.DirectUpdateHandler2">
|
||||
</updateHandler>
|
||||
|
|
|
@ -22,10 +22,7 @@
|
|||
<dataDir>${solr.data.dir:}</dataDir>
|
||||
<directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.RAMDirectoryFactory}"/>
|
||||
|
||||
<indexConfig>
|
||||
<lockType>single</lockType>
|
||||
<useCompoundFile>${useCompoundFile:false}</useCompoundFile>
|
||||
</indexConfig>
|
||||
<xi:include href="solrconfig.snippet.randomindexconfig.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
|
||||
<updateHandler class="solr.DirectUpdateHandler2">
|
||||
</updateHandler>
|
||||
|
|
|
@ -1572,6 +1572,8 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
|
|||
|
||||
copyConfigFile(getSolrConfigFile(), "solrconfig.xml");
|
||||
copyConfigFile(getSchemaFile(), "schema.xml");
|
||||
copyConfigFile(CONF_DIR + "solrconfig.snippet.randomindexconfig.xml",
|
||||
"solrconfig.snippet.randomindexconfig.xml");
|
||||
}
|
||||
|
||||
public void tearDown() throws Exception {
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.junit.Test;
|
|||
public class NumericFieldsTest extends SolrTestCaseJ4 {
|
||||
@BeforeClass
|
||||
public static void beforeClass() throws Exception {
|
||||
initCore("solrconfig-master.xml", "schema-numeric.xml");
|
||||
initCore("solrconfig-basic.xml", "schema-numeric.xml");
|
||||
}
|
||||
|
||||
static String[] types = new String[]{"int", "long", "float", "double", "date"};
|
||||
|
|
|
@ -22,71 +22,47 @@ import java.nio.ByteBuffer;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import org.apache.solr.client.solrj.SolrServer;
|
||||
import org.apache.solr.client.solrj.SolrQuery;
|
||||
import org.apache.solr.client.solrj.beans.Field;
|
||||
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
|
||||
import org.apache.solr.client.solrj.impl.HttpSolrServer;
|
||||
import org.apache.solr.client.solrj.response.QueryResponse;
|
||||
import org.apache.solr.common.*;
|
||||
import org.apache.solr.core.SolrResourceLoader;
|
||||
import org.junit.Rule;
|
||||
import org.junit.rules.RuleChain;
|
||||
import org.junit.rules.TestRule;
|
||||
import org.apache.solr.SolrJettyTestBase;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
|
||||
public class TestBinaryField extends SolrJettyTestBase {
|
||||
|
||||
public class TestBinaryField extends LuceneTestCase {
|
||||
HttpSolrServer server;
|
||||
JettySolrRunner jetty;
|
||||
|
||||
int port = 0;
|
||||
static final String context = "/example";
|
||||
|
||||
@Rule
|
||||
public TestRule solrTestRules =
|
||||
RuleChain.outerRule(new SystemPropertiesRestoreRule());
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
File home = new File(TEMP_DIR,
|
||||
"solrtest-TestBinaryField-" + System.currentTimeMillis());
|
||||
|
||||
File homeDir = new File(home, "example");
|
||||
File dataDir = new File(homeDir + "/collection1", "data");
|
||||
File confDir = new File(homeDir + "/collection1", "conf");
|
||||
@BeforeClass
|
||||
public static void beforeTest() throws Exception {
|
||||
File homeDir = new File(TEMP_DIR,
|
||||
"solrtest-TestBinaryField-" + System.currentTimeMillis());
|
||||
File collDir = new File(homeDir, "collection1");
|
||||
File dataDir = new File(collDir, "data");
|
||||
File confDir = new File(collDir, "conf");
|
||||
|
||||
homeDir.mkdirs();
|
||||
collDir.mkdirs();
|
||||
dataDir.mkdirs();
|
||||
confDir.mkdirs();
|
||||
|
||||
SolrResourceLoader loader = new SolrResourceLoader("solr/collection1");
|
||||
File f = new File(confDir, "solrconfig.xml");
|
||||
String fname = "solr/collection1/conf/solrconfig-slave1.xml";
|
||||
FileOutputStream out = new FileOutputStream(f);
|
||||
IOUtils.copy(loader.openResource(fname), out);
|
||||
out.close();
|
||||
f = new File(confDir, "schema.xml");
|
||||
fname = "solr/collection1/conf/schema-binaryfield.xml";
|
||||
out = new FileOutputStream(f);
|
||||
IOUtils.copy(loader.openResource(fname), out);
|
||||
out.close();
|
||||
System.setProperty("solr.data.dir", dataDir.getAbsolutePath());
|
||||
System.setProperty("solr.test.sys.prop1", "propone");
|
||||
System.setProperty("solr.test.sys.prop2", "proptwo");
|
||||
System.setProperty("tests.shardhandler.randomSeed", Long.toString(random().nextLong()));
|
||||
String src_dir = TEST_HOME() + "/collection1/conf";
|
||||
FileUtils.copyFile(new File(src_dir, "schema-binaryfield.xml"),
|
||||
new File(confDir, "schema.xml"));
|
||||
FileUtils.copyFile(new File(src_dir, "solrconfig-basic.xml"),
|
||||
new File(confDir, "solrconfig.xml"));
|
||||
FileUtils.copyFile(new File(src_dir, "solrconfig.snippet.randomindexconfig.xml"),
|
||||
new File(confDir, "solrconfig.snippet.randomindexconfig.xml"));
|
||||
|
||||
jetty = new JettySolrRunner(homeDir.getAbsolutePath(), context, 0);
|
||||
jetty.start();
|
||||
port = jetty.getLocalPort();
|
||||
|
||||
String url = "http://127.0.0.1:" + jetty.getLocalPort() + context;
|
||||
server = new HttpSolrServer(url);
|
||||
createJetty(homeDir.getAbsolutePath(), null, null);
|
||||
}
|
||||
|
||||
|
||||
public void testSimple() throws Exception {
|
||||
SolrServer server = getSolrServer();
|
||||
byte[] buf = new byte[10];
|
||||
for (int i = 0; i < 10; i++) {
|
||||
buf[i] = (byte) i;
|
||||
|
@ -179,11 +155,4 @@ public class TestBinaryField extends LuceneTestCase {
|
|||
byte [] data;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void tearDown() throws Exception {
|
||||
jetty.stop();
|
||||
System.clearProperty("tests.shardhandler.randomSeed");
|
||||
super.tearDown();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue